From 72ca6316f607d126685d46ef3162a899a72662ee Mon Sep 17 00:00:00 2001 From: Dionysis Grigoropoulos Date: Thu, 26 Jan 2023 22:05:38 +0200 Subject: [PATCH 1/2] Fix bug where announce_identity could be undefined --- RNS/Transport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RNS/Transport.py b/RNS/Transport.py index 4f0cbcf..e4b328d 100755 --- a/RNS/Transport.py +++ b/RNS/Transport.py @@ -1427,12 +1427,12 @@ class Transport: # Check that the announced destination matches # the handlers aspect filter execute_callback = False + announce_identity = RNS.Identity.recall(packet.destination_hash) if handler.aspect_filter == None: # If the handlers aspect filter is set to # None, we execute the callback in all cases execute_callback = True else: - announce_identity = RNS.Identity.recall(packet.destination_hash) handler_expected_hash = RNS.Destination.hash_from_name_and_identity(handler.aspect_filter, announce_identity) if packet.destination_hash == handler_expected_hash: execute_callback = True From 6ecae615de42476e50c5e19bbececdb81276c4fe Mon Sep 17 00:00:00 2001 From: Dionysis Grigoropoulos Date: Fri, 27 Jan 2023 14:43:44 +0200 Subject: [PATCH 2/2] packet: Fix header_type matching according to IFAC Ever since IFAC/Interface Access Codes were introduced, the header type is one bit long and not two. --- RNS/Packet.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/RNS/Packet.py b/RNS/Packet.py index d888a86..cdc476c 100755 --- a/RNS/Packet.py +++ b/RNS/Packet.py @@ -58,9 +58,7 @@ class Packet: # Header types HEADER_1 = 0x00 # Normal header format HEADER_2 = 0x01 # Header format used for packets in transport - HEADER_3 = 0x02 # Reserved - HEADER_4 = 0x03 # Reserved - header_types = [HEADER_1, HEADER_2, HEADER_3, HEADER_4] + header_types = [HEADER_1, HEADER_2] # Packet context types NONE = 0x00 # Generic data packet @@ -215,7 +213,7 @@ class Packet: self.flags = self.raw[0] self.hops = self.raw[1] - self.header_type = (self.flags & 0b11000000) >> 6 + self.header_type = (self.flags & 0b01000000) >> 6 self.transport_type = (self.flags & 0b00110000) >> 4 self.destination_type = (self.flags & 0b00001100) >> 2 self.packet_type = (self.flags & 0b00000011)