From 0fdfec8fc9b59c974ebd68cd50a6dd532e2f3cdb Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 9 Aug 2022 23:01:40 +0100 Subject: [PATCH 1/3] dkjdjk --- hblink.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hblink.py b/hblink.py index 5f9062f..4e3844e 100755 --- a/hblink.py +++ b/hblink.py @@ -278,6 +278,8 @@ class OPENBRIDGE(DatagramProtocol): if '_bcka' in self._CONFIG['SYSTEMS'][system] and self._CONFIG['SYSTEMS'][system]['_bcka'] < time() - 60: continue _uid = bytes_4(randint(0x00, 0xFFFFFFFF)) + #add data from this packet to our local TOPO view + self.process_bcto(self._CONFIG['GLOBAL']['SERVER_ID'],self._CONFIG['SYSTEMS'][system]['NETWORK_ID'],self._CONFIG['SYSTEMS'][system]['VER'].to_bytes(1,"big"),_hops) _packet = b''.join([BCTO,_uid,self._CONFIG['GLOBAL']['SERVER_ID'],self._CONFIG['SYSTEMS'][system]['NETWORK_ID'],self._CONFIG['SYSTEMS'][system]['VER'].to_bytes(1,"big"),_hops]) _h = blake2b(key=self._config['PASSPHRASE'], digest_size=16) _h.update(_packet) From 321360cce9f35d4de956d814b4377cf6f1c353c8 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 9 Aug 2022 23:20:03 +0100 Subject: [PATCH 2/3] Further refine self processing of BCTO --- hblink.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hblink.py b/hblink.py index 4e3844e..f51f4dc 100755 --- a/hblink.py +++ b/hblink.py @@ -766,11 +766,11 @@ class OPENBRIDGE(DatagramProtocol): if _hash == _hash2: logger.trace('(%s) *ProtoControl* BCTO received: %s connected to %s with proto ver. %s. HOPS: %s ',self._system, int_id(_src), int_id(_dst), int.from_bytes(_ver,'big'), int.from_bytes(_hops,'big')) if int.from_bytes(_hops,'big') < 10 and _src != self._CONFIG['GLOBAL']['SERVER_ID'] and not self.check_bcto_uid(_uid): + self.process_bcto(_uid,_src,_dst,_ver,_hops) self.retransmit_bcto(_packet[4:17],int.from_bytes(_hops,'big')) else: logger.trace('(%s) *BridgeControl* not retransmitting BCTO - hop count exceeded, already seen or my packet',self._system) - if not self.check_bcto_uid(_uid): - self.process_bcto(_uid,_src,_dst,_ver,_hops) + else: h,p = _sockaddr logger.warning('(%s) *ProtoControl* BCTO invalid, packet discarded - OPCODE: %s DATA: %s HMAC LENGTH: %s HMAC: %s SRC IP: %s SRC PORT: %s', self._system, _packet[:4], repr(_packet[:18]), len(_packet[18:]),repr(_packet[18:]),h,p) From 21de187d42c0098761285f6bc19a7f28528e0d2b Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 10 Aug 2022 00:24:32 +0100 Subject: [PATCH 3/3] Revert "Further refine self processing of BCTO" This reverts commit 321360cce9f35d4de956d814b4377cf6f1c353c8. --- hblink.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hblink.py b/hblink.py index f51f4dc..4e3844e 100755 --- a/hblink.py +++ b/hblink.py @@ -766,11 +766,11 @@ class OPENBRIDGE(DatagramProtocol): if _hash == _hash2: logger.trace('(%s) *ProtoControl* BCTO received: %s connected to %s with proto ver. %s. HOPS: %s ',self._system, int_id(_src), int_id(_dst), int.from_bytes(_ver,'big'), int.from_bytes(_hops,'big')) if int.from_bytes(_hops,'big') < 10 and _src != self._CONFIG['GLOBAL']['SERVER_ID'] and not self.check_bcto_uid(_uid): - self.process_bcto(_uid,_src,_dst,_ver,_hops) self.retransmit_bcto(_packet[4:17],int.from_bytes(_hops,'big')) else: logger.trace('(%s) *BridgeControl* not retransmitting BCTO - hop count exceeded, already seen or my packet',self._system) - + if not self.check_bcto_uid(_uid): + self.process_bcto(_uid,_src,_dst,_ver,_hops) else: h,p = _sockaddr logger.warning('(%s) *ProtoControl* BCTO invalid, packet discarded - OPCODE: %s DATA: %s HMAC LENGTH: %s HMAC: %s SRC IP: %s SRC PORT: %s', self._system, _packet[:4], repr(_packet[:18]), len(_packet[18:]),repr(_packet[18:]),h,p)