crc16
Simon 4 years ago
parent 0a76fc08ef
commit c48c69802e
No known key found for this signature in database
GPG Key ID: 6ACF11630B5D8F82

@ -39,7 +39,7 @@ import importlib.util
import re
import copy
from setproctitle import setproctitle
from crccheck.crc import Crc32
from crccheck.crc import Crc16
# Twisted is pretty important, so I keep it separate
from twisted.internet.protocol import Factory, Protocol
@ -1464,7 +1464,7 @@ class routerOBP(OPENBRIDGE):
pkt_time = time()
dmrpkt = _data[20:53]
_bits = _data[15]
_pkt_crc = Crc32.calc(dmrpkt)
_pkt_crc = Crc16.calc(_data[5:53])
# 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)):
@ -1711,9 +1711,9 @@ class routerOBP(OPENBRIDGE):
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))
return
#Duplicate DMR payload to previuos packet (by Crc32)
#Duplicate DMR payload to previuos packet (by Crc16)
if _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, crcs: %s",self._system,_pkt_crc,int_id(_stream_id),int_id(_dst_id),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, crcs: %s",self._system,_pkt_crc,int_id(_stream_id),int_id(_dst_id),self.STATUS[_stream_id]['crcs'])
return
#Inbound out-of-order packets
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]
_bits = _data[15]
_pkt_crc = Crc32.calc(dmrpkt)
_pkt_crc = Crc16.calc(dmrpkt)
_nine = bytes_3(9)
@ -2430,9 +2430,9 @@ class routerHBP(HBSYSTEM):
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))
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']:
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
#Inbound out-of-order packets
if _seq and self.STATUS[_slot]['lastSeq'] and (_seq != 1) and (_seq < self.STATUS[_slot]['lastSeq']):

Loading…
Cancel
Save

Powered by TurnKey Linux.