From 13157cd4e214512cfb5adf255bfa48dc3b06372c Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Sat, 9 Nov 2013 10:14:39 -0600 Subject: [PATCH] 2 Peer Bug Fixed Fixed a bug where I accidentally over-wrote original packet data when forwarding to an IPSC peer... making it impossible to bridge a packet to more than one destination IPSC correctly. Currently, DMRlink is bridging three IPSCs and transcoding group IDs. --- bridge.py | 9 +++++---- dmrlink.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bridge.py b/bridge.py index e3b33ec..700e9e4 100644 --- a/bridge.py +++ b/bridge.py @@ -72,17 +72,18 @@ class bridgeIPSC(IPSC): for source in RULES[_network]['GROUP_VOICE']: # Matching for rules is against the Destination Group in the SOURCE packet (SRC_GROUP) if source['SRC_GROUP'] == _dst_sub: + _tmp_data = _data _target = source['DST_NET'] _target_sock = NETWORK[_target]['MASTER']['IP'], NETWORK[_target]['MASTER']['PORT'] # Re-Write the IPSC SRC to match the target network's ID - _data = _data.replace(_peerid, NETWORK[_target]['LOCAL']['RADIO_ID']) + _tmp_data = _tmp_data.replace(_peerid, NETWORK[_target]['LOCAL']['RADIO_ID']) # Re-Write the destinaion Group ID - _data = _data.replace(_dst_sub, source['DST_GROUP']) + _tmp_data = _tmp_data.replace(_dst_sub, source['DST_GROUP']) # Calculate and append the authentication hash for the target network... if necessary if NETWORK[_target]['LOCAL']['AUTH_ENABLED'] == True: - _data = self.hashed_packet(NETWORK[_target]['LOCAL']['AUTH_KEY'], _data) + _tmp_data = self.hashed_packet(NETWORK[_target]['LOCAL']['AUTH_KEY'], _tmp_data) # Send the packet to all peers in the target IPSC - send_to_ipsc(_target, _data) + send_to_ipsc(_target, _tmp_data) def private_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data): pass diff --git a/dmrlink.py b/dmrlink.py index 9b574ea..695f6c7 100644 --- a/dmrlink.py +++ b/dmrlink.py @@ -235,8 +235,8 @@ def send_to_ipsc(_target, _packet): if peer['STATUS']['CONNECTED'] == True: networks[_target].transport.write(_packet, (peer['IP'], peer['PORT'])) # _log(' Peer: %s', binascii.b2a_hex(peer['RADIO_ID'])) - - + + # De-register a peer from an IPSC by removing it's infomation # def de_register_peer(_network, _peerid):