Skip to content

Commit 7558e87

Browse files
committed
zdo: check the origin of 'Explicit RX indicator' frames
This commit checks the source (64-bit and 16-bit addresses) of `Explicit RX indicator' frames to ensure it matches with the destination of the initally sent 'Explicit Addressing' with a ZDO request. Signed-off-by: Tatiana Leon <tatiana.leon@digi.com>
1 parent ac908ea commit 7558e87

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

digi/xbee/models/zdo.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,20 @@ def _zdo_packet_callback(self, frame):
328328
return
329329

330330
if frame.get_frame_type() == ApiFrameType.EXPLICIT_RX_INDICATOR:
331+
# Check address
332+
x64 = self._xbee.get_64bit_addr()
333+
x16 = self._xbee.get_16bit_addr()
334+
if (not self._is_broadcast()
335+
and x64 != XBee64BitAddress.UNKNOWN_ADDRESS
336+
and x64 != frame.x64bit_source_addr
337+
and x16 != XBee16BitAddress.UNKNOWN_ADDRESS
338+
and x16 != frame.x16bit_source_addr):
339+
return
340+
# Check profile and endpoints
341+
if frame.profile_id != self.__class__._PROFILE_ID \
342+
or frame.source_endpoint != self.__class__._SOURCE_ENDPOINT \
343+
or frame.dest_endpoint != self.__class__._DESTINATION_ENDPOINT:
344+
return
331345
# Check if the cluster ID is correct.
332346
if frame.cluster_id != self.__receive_cluster_id:
333347
return

0 commit comments

Comments
 (0)