diff --git a/bridge_master.py b/bridge_master.py index 5049f25..9a24957 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -421,9 +421,9 @@ def topoWrite(): logger.warning('(TOPO) Cannot write topography file to disk') def topoRead(): + _topo = {} try: _fh = open(CONFIG['ALIASES']['PATH'] + CONFIG['ALIASES']['TOPO_FILE'],'r') - _topo = {} _topo = json.load(_fh) _fh.close() logger.info('(TOPO) Reading topography file from disk') @@ -1664,7 +1664,7 @@ class routerOBP(OPENBRIDGE): self._report.send_bridgeEvent('UNIT CSBK,DATA,RX,{},{},{},{},{},{}'.format(self._system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), _slot, int_id(_dst_id)).encode(encoding='utf-8', errors='ignore')) elif _dtype_vseq == 6: logger.info('(%s) *UNIT DATA HEADER* STREAM ID: %s, RPTR: %s SUB: %s (%s) PEER: %s (%s) DST_ID %s (%s), TS %s, SRC: %s, RPTR: %s', \ - self._system, int_id(_stream_id),self.get_rptr(_source_rptr), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot,int_id(_source_server,int_id(_source_rptr))) + self._system, int_id(_stream_id),self.get_rptr(_source_rptr), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot,int_id(_source_server),int_id(_source_rptr)) if CONFIG['REPORTS']['REPORT']: self._report.send_bridgeEvent('UNIT DATA HEADER,DATA,RX,{},{},{},{},{},{}'.format(self._system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), _slot, int_id(_dst_id)).encode(encoding='utf-8', errors='ignore')) elif _dtype_vseq == 7: diff --git a/config.py b/config.py index 504b9c9..d465a57 100755 --- a/config.py +++ b/config.py @@ -29,7 +29,6 @@ change. import configparser import sys import const - import socket import ipaddress from socket import gethostbyname @@ -148,9 +147,8 @@ def build_config(_config_file): 'ANNOUNCEMENT_LANGUAGES': config.get(section, 'ANNOUNCEMENT_LANGUAGES'), 'SERVER_ID': config.getint(section, 'SERVER_ID').to_bytes(4, 'big'), 'DATA_GATEWAY': config.getboolean(section, 'DATA_GATEWAY'), - 'VALIDATE_SERVER_IDS': config.getboolean(section, 'VALIDATE_SERVER_IDS'), - 'ISO_COUNTRY_CODE' : config.get(section, 'ISO_COUNTRY_CODE'), - + + 'VALIDATE_SERVER_IDS': config.getboolean(section, 'VALIDATE_SERVER_IDS') }) if not CONFIG['GLOBAL']['ANNOUNCEMENT_LANGUAGES']: CONFIG['GLOBAL']['ANNOUNCEMENT_LANGUAGES'] = languages diff --git a/hblink.py b/hblink.py index a17f3ae..4c0f061 100755 --- a/hblink.py +++ b/hblink.py @@ -300,7 +300,8 @@ class OPENBRIDGE(DatagramProtocol): _h.update(_packet) _hash = _h.digest() _packet = b''.join([_packet,_hash]) - self.transport.write(_packet, (self._CONFIG['SYSTEMS'][system]['TARGET_IP'], self._CONFIG['SYSTEMS'][system]['TARGET_PORT'])) + + systems[system].transport.write(_packet, (self._CONFIG['SYSTEMS'][system]['TARGET_IP'], self._CONFIG['SYSTEMS'][system]['TARGET_PORT'])) logger.trace('(%s) *BridgeControl* retransmitted BCTO.',self._system) else: logger.trace('(%s) *BridgeControl* not retransmitting BCTO, TARGET_IP currently not known.',self._system) @@ -492,7 +493,10 @@ class OPENBRIDGE(DatagramProtocol): #Discard old packets if (int.from_bytes(_timestamp,'big')/1000000000) < (time() - 5): - logger.warning('(%s) Packet more than 5s old!, discarding', self._system) + if _stream_id not in self._laststrid: + logger.warning('(%s) Packet from server %s more than 5s old!, discarding', self._system,int.from_bytes(_source_server,'big')) + self.send_bcsq(_dst_id,_stream_id) + self._laststrid.append(_stream_id) return #Discard bad source server diff --git a/loro.cfg b/loro.cfg index 2c392ef..b0a01ec 100644 --- a/loro.cfg +++ b/loro.cfg @@ -116,6 +116,7 @@ STALE_DAYS: 7 SUB_MAP_FILE: SERVER_ID_URL: http://downloads.freedmr.uk/downloads/FreeDMR_Hosts.csv SERVER_ID_FILE: server_ids.tsv +TOPO_FILE: topography.json #Read further repeater configs from MySQL [MYSQL]