From 45da762a38e57e8a688ba2940782de0d2ae72448 Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Fri, 22 Nov 2013 09:23:55 -0600 Subject: [PATCH] Work on NAT --- bridge.py | 10 ++++++---- dmrlink.py | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) mode change 100644 => 100755 bridge.py diff --git a/bridge.py b/bridge.py old mode 100644 new mode 100755 index 0fdf79b..7e24123 --- a/bridge.py +++ b/bridge.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + # Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group. n0mjs@me.com # # This work is licensed under the Creative Commons Attribution-ShareAlike @@ -19,7 +21,8 @@ import binascii import dmrlink from dmrlink import IPSC, UnauthIPSC, NETWORK, networks, int_id, send_to_ipsc, dmr_nat, logger -NAT = True +NAT = 0 +#NAT = '\x2f\x9b\x80' # Notes and pieces of next steps... # RPT_WAKE_UP = b'\x85' + NETWORK[_network]['LOCAL']['RADIO_ID] + b'\x00\x00\x00\x01' + b'\x01' + b'\x01' @@ -45,7 +48,6 @@ class bridgeIPSC(IPSC): #************************************************ def group_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data): - print('packet ', h(_src_sub)) if (_ts not in self.ACTIVE_CALLS): self.ACTIVE_CALLS.append(_ts) # send repeater wake up, but send them when a repeater is likely not TXing check time since end (see below) @@ -64,8 +66,8 @@ class bridgeIPSC(IPSC): # Re-Write the destinaion Group ID _tmp_data = _tmp_data.replace(_dst_sub, source['DST_GROUP']) # Calculate and append the authentication hash for the target network... if necessary - if NAT: - _tmp_data = dmr_nat(_tmp_data, _src_sub, '\x00\x0C\x30') + if NAT: + _tmp_data = dmr_nat(_tmp_data, _src_sub, NAT) if NETWORK[_target]['LOCAL']['AUTH_ENABLED'] == True: _tmp_data = self.hashed_packet(NETWORK[_target]['LOCAL']['AUTH_KEY'], _tmp_data) # Send the packet to all peers in the target IPSC diff --git a/dmrlink.py b/dmrlink.py index 9322af3..35b4836 100644 --- a/dmrlink.py +++ b/dmrlink.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group. n0mjs@me.com # # This work is licensed under the Creative Commons Attribution-ShareAlike