Skip to content

Commit ac908ea

Browse files
committed
remote at: check the origin of 'Remote AT command response' frames
This commit checks the source (64-bit and 16-bit addresses) of `Remote AT command response' frames to ensure it matches with the destination of the initial 'Remote AT command'. Signed-off-by: Tatiana Leon <tatiana.leon@digi.com>
1 parent 38d4c5f commit ac908ea

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

digi/xbee/devices.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1718,7 +1718,13 @@ def packet_received_callback(received_packet):
17181718
# response and the command matches in both packets.
17191719
if packet_to_send.get_frame_type() == ApiFrameType.REMOTE_AT_COMMAND_REQUEST \
17201720
and (received_packet.get_frame_type() != ApiFrameType.REMOTE_AT_COMMAND_RESPONSE
1721-
or packet_to_send.command != received_packet.command):
1721+
or packet_to_send.command != received_packet.command
1722+
or (packet_to_send.x64bit_dest_addr != XBee64BitAddress.BROADCAST_ADDRESS
1723+
and packet_to_send.x64bit_dest_addr != XBee64BitAddress.UNKNOWN_ADDRESS
1724+
and packet_to_send.x64bit_dest_addr != received_packet.x64bit_source_addr)
1725+
or (packet_to_send.x16bit_dest_addr != XBee16BitAddress.BROADCAST_ADDRESS
1726+
and packet_to_send.x16bit_dest_addr != XBee16BitAddress.UNKNOWN_ADDRESS
1727+
and packet_to_send.x16bit_dest_addr != received_packet.x16bit_source_addr)):
17221728
return
17231729
# If the packet sent is a Socket Create, verify that the received one is a Socket Create Response.
17241730
if packet_to_send.get_frame_type() == ApiFrameType.SOCKET_CREATE \

0 commit comments

Comments
 (0)