|
|
|
@ -137,12 +137,16 @@ class OPENBRIDGE(DatagramProtocol):
|
|
|
|
def dereg(self):
|
|
|
|
def dereg(self):
|
|
|
|
logger.info('(%s) is mode OPENBRIDGE. No De-Registration required, continuing shutdown', self._system)
|
|
|
|
logger.info('(%s) is mode OPENBRIDGE. No De-Registration required, continuing shutdown', self._system)
|
|
|
|
|
|
|
|
|
|
|
|
def send_system(self, _packet,_hops = bytes(0)):
|
|
|
|
def send_system(self, _packet,_hops = False):
|
|
|
|
#Don't do anything if we are STUNned
|
|
|
|
#Don't do anything if we are STUNned
|
|
|
|
if 'STUN' in self._CONFIG:
|
|
|
|
if 'STUN' in self._CONFIG:
|
|
|
|
logger.info('(%s) Bridge STUNned, discarding', self._system)
|
|
|
|
logger.info('(%s) Bridge STUNned, discarding', self._system)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not _hops:
|
|
|
|
|
|
|
|
_hops = 0
|
|
|
|
|
|
|
|
_hops = _hops.to_bytes(1,'big')
|
|
|
|
|
|
|
|
|
|
|
|
if _packet[:3] == DMR and self._config['TARGET_IP']:
|
|
|
|
if _packet[:3] == DMR and self._config['TARGET_IP']:
|
|
|
|
if 'VER' in self._config and self._config['VER'] > 1:
|
|
|
|
if 'VER' in self._config and self._config['VER'] > 1:
|
|
|
|
_packet = b''.join([DMRF,_packet[4:11], self._CONFIG['GLOBAL']['SERVER_ID'],_packet[15:], time_ns().to_bytes(8,'big')])
|
|
|
|
_packet = b''.join([DMRF,_packet[4:11], self._CONFIG['GLOBAL']['SERVER_ID'],_packet[15:], time_ns().to_bytes(8,'big')])
|
|
|
|
@ -203,7 +207,7 @@ class OPENBRIDGE(DatagramProtocol):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data,_hash,_hops = bytes(0)):
|
|
|
|
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data,_hash,_hops = False):
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
#print(int_id(_peer_id), int_id(_rf_src), int_id(_dst_id), int_id(_seq), _slot, _call_type, _frame_type, repr(_dtype_vseq), int_id(_stream_id))
|
|
|
|
#print(int_id(_peer_id), int_id(_rf_src), int_id(_dst_id), int_id(_seq), _slot, _call_type, _frame_type, repr(_dtype_vseq), int_id(_stream_id))
|
|
|
|
|
|
|
|
|
|
|
|
@ -315,7 +319,7 @@ class OPENBRIDGE(DatagramProtocol):
|
|
|
|
_hash = _packet[62:]
|
|
|
|
_hash = _packet[62:]
|
|
|
|
#_ckhs = hmac_new(self._config['PASSPHRASE'],_data,sha1).digest()
|
|
|
|
#_ckhs = hmac_new(self._config['PASSPHRASE'],_data,sha1).digest()
|
|
|
|
_h = blake2b(key=self._config['PASSPHRASE'], digest_size=16)
|
|
|
|
_h = blake2b(key=self._config['PASSPHRASE'], digest_size=16)
|
|
|
|
_h.update(_packet[:60])
|
|
|
|
_h.update(_packet[:61])
|
|
|
|
_ckhs = _h.digest()
|
|
|
|
_ckhs = _h.digest()
|
|
|
|
|
|
|
|
|
|
|
|
if compare_digest(_hash, _ckhs) and (_sockaddr == self._config['TARGET_SOCK'] or self._config['RELAX_CHECKS']):
|
|
|
|
if compare_digest(_hash, _ckhs) and (_sockaddr == self._config['TARGET_SOCK'] or self._config['RELAX_CHECKS']):
|
|
|
|
|