From 822951853ee828a9f120b0e5907a5989198cb93a Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 28 Feb 2022 19:14:59 +0000 Subject: [PATCH] Squashed commit of the following: commit f7d0f3d757b9feb44ff12a9415e743d5a855d359 Author: Simon Date: Mon Feb 28 19:05:49 2022 +0000 flarty commit 2e96ec12dede313c67d6340b8246351c66d134e6 Author: Simon Date: Sun Feb 27 18:59:09 2022 +0000 dflvkjl commit 3298d6c3236ab65c8d34a357f33c6166d26262fb Author: Simon Date: Sun Feb 27 18:57:43 2022 +0000 fdkgvjdksj commit 471db6275c6860f60a18e0fbdcb20254eb983b79 Author: Simon Date: Sun Feb 27 18:55:11 2022 +0000 ffj commit 845a441b861ebfd182a98bb6c18ce1453a2c4a60 Author: Simon Date: Sun Feb 27 18:52:54 2022 +0000 frdo commit 9db3124d3770ab2d2ac80c2d908b077dad44278d Author: Simon Date: Sun Feb 27 18:50:08 2022 +0000 fod commit ec4dce00702b4158c10b1d29704676b95670f0e0 Author: Simon Date: Sun Feb 27 18:48:38 2022 +0000 exclude 0 --- hblink.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hblink.py b/hblink.py index cb2b684..e265099 100755 --- a/hblink.py +++ b/hblink.py @@ -395,7 +395,15 @@ class OPENBRIDGE(DatagramProtocol): if (int.from_bytes(_timestamp,'big')/1000000000) < (time() - 5): logger.warning('(%s) Packet more than 5s old!, discarding', self._system) return - + + #Discard bad source server + if (len(str(int.from_bytes(_source_server,'big'))) > 5) or (len(str(int.from_bytes(_source_server,'big'))) < 4) and int.from_bytes(_source_server,'big') > 0: + if _stream_id not in self._laststrid: + logger.warning('(%s) Source Server should be 4 or 5 digits, discarding Src: %s', self._system, int.from_bytes(_source_server,'big')) + self.send_bcsq(_dst_id,_stream_id) + self._laststrid.append(_stream_id) + return + #Increment max hops _inthops = _hops +1 @@ -442,12 +450,7 @@ class OPENBRIDGE(DatagramProtocol): self.send_bcsq(_dst_id,_stream_id) self._laststrid.append(_stream_id) return - - - #Remove timestamp from data. For now dmrd_received does not expect it - #Leaving it in screws up the AMBE data - #_data = b''.join([_data[:5],_data[12:]]) _data = b''.join([DMRD,_data[4:]]) _hops = _inthops.to_bytes(1,'big')