switch back to 16 bit crc

crc16
Simon 4 years ago
parent 695154317c
commit d781355c05
No known key found for this signature in database
GPG Key ID: 6ACF11630B5D8F82

@ -39,7 +39,7 @@ import importlib.util
import re import re
import copy import copy
from setproctitle import setproctitle from setproctitle import setproctitle
from crccheck.crc import Crc32 from crccheck.crc import Crc16
# Twisted is pretty important, so I keep it separate # Twisted is pretty important, so I keep it separate
from twisted.internet.protocol import Factory, Protocol from twisted.internet.protocol import Factory, Protocol
@ -1464,7 +1464,7 @@ class routerOBP(OPENBRIDGE):
pkt_time = time() pkt_time = time()
dmrpkt = _data[20:53] dmrpkt = _data[20:53]
_bits = _data[15] _bits = _data[15]
_pkt_crc = Crc32.calc(_data[4:53]) _pkt_crc = Crc16.calc(_data[4:53])
# Match UNIT data, SMS/GPS, and send it to the dst_id if it is in SUB_MAP # Match UNIT data, SMS/GPS, and send it to the dst_id if it is in SUB_MAP
if _call_type == 'unit' and (_dtype_vseq == 6 or _dtype_vseq == 7 or _dtype_vseq == 8 or ((_stream_id not in self.STATUS) and _dtype_vseq == 3)): if _call_type == 'unit' and (_dtype_vseq == 6 or _dtype_vseq == 7 or _dtype_vseq == 8 or ((_stream_id not in self.STATUS) and _dtype_vseq == 3)):
@ -1711,9 +1711,9 @@ class routerOBP(OPENBRIDGE):
if _seq and _seq == self.STATUS[_stream_id]['lastSeq']: if _seq and _seq == self.STATUS[_stream_id]['lastSeq']:
logger.warning("(%s) *PacketControl* Duplicate sequence number %s, disgarding. Stream ID:, %s TGID: %s",self._system,_seq,int_id(_stream_id),int_id(_dst_id)) logger.warning("(%s) *PacketControl* Duplicate sequence number %s, disgarding. Stream ID:, %s TGID: %s",self._system,_seq,int_id(_stream_id),int_id(_dst_id))
return return
#Duplicate DMR payload to previuos packet (by Crc32) #Duplicate DMR payload to previuos packet (by Crc16)
if self.STATUS[_stream_id]['packets'] > 1 and _pkt_crc in self.STATUS[_stream_id]['crcs']: if self.STATUS[_stream_id]['packets'] > 1 and _pkt_crc in self.STATUS[_stream_id]['crcs']:
logger.warning("(%s) *PacketControl* DMR packet payload with Crc32: %s seen before in this stream, disgarding. Stream ID:, %s TGID: %s: SEQ:%s packets: %s %s ",self._system,_pkt_crc,int_id(_stream_id),int_id(_dst_id),_seq, self.STATUS[_stream_id]['packets'],self.STATUS[_stream_id]['crcs']) logger.warning("(%s) *PacketControl* DMR packet payload with Crc16: %s seen before in this stream, disgarding. Stream ID:, %s TGID: %s: SEQ:%s packets: %s %s ",self._system,_pkt_crc,int_id(_stream_id),int_id(_dst_id),_seq, self.STATUS[_stream_id]['packets'],self.STATUS[_stream_id]['crcs'])
return return
#Inbound out-of-order packets #Inbound out-of-order packets
if _seq and self.STATUS[_stream_id]['lastSeq'] and (_seq != 1) and (_seq < self.STATUS[_stream_id]['lastSeq']): if _seq and self.STATUS[_stream_id]['lastSeq'] and (_seq != 1) and (_seq < self.STATUS[_stream_id]['lastSeq']):
@ -2059,7 +2059,7 @@ class routerHBP(HBSYSTEM):
dmrpkt = _data[20:53] dmrpkt = _data[20:53]
_bits = _data[15] _bits = _data[15]
_pkt_crc = Crc32.calc(dmrpkt) _pkt_crc = Crc16.calc(dmrpkt)
_nine = bytes_3(9) _nine = bytes_3(9)
@ -2430,9 +2430,9 @@ class routerHBP(HBSYSTEM):
if _seq and _seq == self.STATUS[_slot]['lastSeq']: if _seq and _seq == self.STATUS[_slot]['lastSeq']:
logger.warning("(%s) *PacketControl* Duplicate sequence number %s, disgarding. Stream ID:, %s TGID: %s",self._system,_seq,int_id(_stream_id),int_id(_dst_id)) logger.warning("(%s) *PacketControl* Duplicate sequence number %s, disgarding. Stream ID:, %s TGID: %s",self._system,_seq,int_id(_stream_id),int_id(_dst_id))
return return
#Duplicate DMR payload to previuos packet (by Crc32) #Duplicate DMR payload to previuos packet (by Crc16)
if _pkt_crc in self.STATUS[_slot]['crcs']: if _pkt_crc in self.STATUS[_slot]['crcs']:
logger.warning("(%s) *PacketControl* DMR packet payload with Crc32: %s seen before in this stream, disgarding. Stream ID:, %s TGID: %s",self._system,_pkt_crc,int_id(_stream_id),int_id(_dst_id)) logger.warning("(%s) *PacketControl* DMR packet payload with Crc16: %s seen before in this stream, disgarding. Stream ID:, %s TGID: %s",self._system,_pkt_crc,int_id(_stream_id),int_id(_dst_id))
return return
#Inbound out-of-order packets #Inbound out-of-order packets
if _seq and self.STATUS[_slot]['lastSeq'] and (_seq != 1) and (_seq < self.STATUS[_slot]['lastSeq']): if _seq and self.STATUS[_slot]['lastSeq'] and (_seq != 1) and (_seq < self.STATUS[_slot]['lastSeq']):

Loading…
Cancel
Save

Powered by TurnKey Linux.