mirror of
https://github.com/espressif/openthread.git
synced 2026-08-21 18:09:52 +00:00
[mac] change address filter and seek function to accept frame without PAN ID (#5389)
In 802.15.4-2015 spec Table 7-2, it is possible to receive frame with destination address but without destination PAN ID. This commit changes the address filter function to avoid dropping such frames.
This commit is contained in:
@@ -217,9 +217,25 @@ class MacFrame:
|
||||
self.payload = None
|
||||
return
|
||||
|
||||
# Presence of PAN Ids is not fully implemented yet but should be enough
|
||||
# for Thread.
|
||||
dest_pan_id = struct.unpack("<H", data.read(2))[0]
|
||||
dest_addr_present = dest_addr_mode != MacHeader.AddressMode.NOT_PRESENT
|
||||
src_addr_present = source_addr_mode != MacHeader.AddressMode.NOT_PRESENT
|
||||
|
||||
if frame_version < 2:
|
||||
dest_pan_present = dest_addr_present
|
||||
else:
|
||||
dest_pan_present = True
|
||||
if not src_addr_present:
|
||||
dest_pan_present = src_pan_present != panid_compression
|
||||
elif not dest_addr_present:
|
||||
dest_pan_present = False
|
||||
else:
|
||||
if dest_addr_mode == MacHeader.AddressMode.EXTENDED and source_addr_mode == MacHeader.AddressMode.EXTENDED and panid_compression:
|
||||
dest_pan_present = False
|
||||
|
||||
if dest_pan_present:
|
||||
dest_pan_id = struct.unpack("<H", data.read(2))[0]
|
||||
else:
|
||||
dest_pan_id = None
|
||||
|
||||
dest_address = self._parse_address(data, dest_addr_mode)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user