From a0621985f6f750220f981b4d90e8a61700e4bcfd Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 13 Feb 2022 02:47:49 +0000 Subject: [PATCH 1/5] Prepare for 4 --- hblink.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hblink.py b/hblink.py index 17d38c3..5494a93 100755 --- a/hblink.py +++ b/hblink.py @@ -156,7 +156,7 @@ class OPENBRIDGE(DatagramProtocol): if _packet[:3] == DMR and self._config['TARGET_IP']: - if 'VER' in self._config and self._config['VER'] == 3: + if 'VER' in self._config and self._config['VER'] > 2: _packet = b''.join([DMRF,_packet[4:11], self._CONFIG['GLOBAL']['SERVER_ID'],_packet[15:]]) _h = blake2b(key=self._config['PASSPHRASE'], digest_size=16) _h.update(_packet) From 265519fe03a3248c91b63ba6988626fee34e7251 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 13 Feb 2022 14:31:14 +0000 Subject: [PATCH 2/5] Don't send UNIT DATA to ver 1 bridges --- bridge_master.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index 5708ac7..498cf33 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1568,7 +1568,8 @@ class routerOBP(OPENBRIDGE): if system == self._system: continue #We only want to send data calls to individual IDs via OpenBridge - if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE' and (_int_dst_id >= 1000000): + #Only send if proto ver for bridge is > 1 + if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE' and CONFIG['SYSTEMS'][system]['VER'] > 1 and (_int_dst_id >= 1000000): self.sendDataToOBP(system,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits,_slot,_hops) #If destination ID is in the Subscriber Map @@ -2152,7 +2153,7 @@ class routerHBP(HBSYSTEM): if system == self._system: continue #We only want to send data calls to individual IDs via OpenBridge - if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE' and (_int_dst_id >= 1000000): + if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE' and CONFIG['SYSTEMS'][system]['VER'] > 1 and (_int_dst_id >= 1000000): self.sendDataToOBP(system,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits,_slot) From a74919dd6116726e319bb5018e684e373dc0667b Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 13 Feb 2022 15:31:43 +0000 Subject: [PATCH 3/5] limit wrong ver logging --- hblink.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hblink.py b/hblink.py index 5494a93..2f13631 100755 --- a/hblink.py +++ b/hblink.py @@ -234,7 +234,9 @@ class OPENBRIDGE(DatagramProtocol): if _packet[:3] == DMR: # DMRData -- encapsulated DMR data frame if _packet[:4] == DMRD: if self._config['VER'] > 1: - logger.warning('(%s) *ProtoControl* Version 1 protocol prohibited by PROTO_VER, Ver: %s',self._system,self._config['VER']) + if _stream_id not in self._laststrid: + logger.warning('(%s) *ProtoControl* Version 1 protocol prohibited by PROTO_VER, Ver: %s',self._system,self._config['VER']) + self._laststrid.append(_stream_id) self.send_bcve() return _data = _packet[:53] From 7d03e65d1d47747368ab50d83a0222e0e62b73cd Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 13 Feb 2022 15:33:40 +0000 Subject: [PATCH 4/5] get streamid earlier --- hblink.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hblink.py b/hblink.py index 2f13631..4615a64 100755 --- a/hblink.py +++ b/hblink.py @@ -233,6 +233,7 @@ class OPENBRIDGE(DatagramProtocol): if _packet[:3] == DMR: # DMRData -- encapsulated DMR data frame if _packet[:4] == DMRD: + _stream_id = _data[16:20] if self._config['VER'] > 1: if _stream_id not in self._laststrid: logger.warning('(%s) *ProtoControl* Version 1 protocol prohibited by PROTO_VER, Ver: %s',self._system,self._config['VER']) @@ -262,7 +263,6 @@ class OPENBRIDGE(DatagramProtocol): _call_type = 'group' _frame_type = (_bits & 0x30) >> 4 _dtype_vseq = (_bits & 0xF) # data, 1=voice header, 2=voice terminator; voice, 0=burst A ... 5=burst F - _stream_id = _data[16:20] #logger.debug('(%s) DMRD - Seqence: %s, RF Source: %s, Destination ID: %s', self._system, int_id(_seq), int_id(_rf_src), int_id(_dst_id)) From 323be20ecfe87e212db0259e93af7c2eec969e83 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 13 Feb 2022 15:34:58 +0000 Subject: [PATCH 5/5] get data earlier --- hblink.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hblink.py b/hblink.py index 4615a64..612095d 100755 --- a/hblink.py +++ b/hblink.py @@ -233,6 +233,7 @@ class OPENBRIDGE(DatagramProtocol): if _packet[:3] == DMR: # DMRData -- encapsulated DMR data frame if _packet[:4] == DMRD: + _data = _packet[:53] _stream_id = _data[16:20] if self._config['VER'] > 1: if _stream_id not in self._laststrid: @@ -240,7 +241,6 @@ class OPENBRIDGE(DatagramProtocol): self._laststrid.append(_stream_id) self.send_bcve() return - _data = _packet[:53] _hash = _packet[53:] _ckhs = hmac_new(self._config['PASSPHRASE'],_data,sha1).digest()