From 5a5ecb322bf304d7b8c5aa58e64b10bfb1d39d06 Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Fri, 31 Oct 2014 10:30:18 -0500 Subject: [PATCH] IP Interface may be specified now This is useful when using multiple interfaces and bridge.py is employed as an application gateway between multiple un-connected networks (like VPNs to the real world). --- bridge.py | 2 +- dmrlink.py | 3 ++- dmrlink_SAMPLE.cfg | 28 +++++++++++++++++----------- log.py | 2 +- play_group.py | 2 +- playback.py | 2 +- rcm.py | 2 +- record.py | 2 +- 8 files changed, 25 insertions(+), 18 deletions(-) diff --git a/bridge.py b/bridge.py index 1939711..5f0a0c5 100755 --- a/bridge.py +++ b/bridge.py @@ -264,5 +264,5 @@ if __name__ == '__main__': for ipsc_network in NETWORK: if NETWORK[ipsc_network]['LOCAL']['ENABLED']: networks[ipsc_network] = bridgeIPSC(ipsc_network) - reactor.listenUDP(NETWORK[ipsc_network]['LOCAL']['PORT'], networks[ipsc_network]) + reactor.listenUDP(NETWORK[ipsc_network]['LOCAL']['PORT'], networks[ipsc_network], interface=NETWORK[ipsc_network]['LOCAL']['IP']) reactor.run() \ No newline at end of file diff --git a/dmrlink.py b/dmrlink.py index c5062bc..521a9b8 100755 --- a/dmrlink.py +++ b/dmrlink.py @@ -119,6 +119,7 @@ try: # Things we need to know to connect and be a peer in this IPSC 'RADIO_ID': hex(int(config.get(section, 'RADIO_ID')))[2:].rjust(8,'0').decode('hex'), + 'IP': config.get(section, 'IP'), 'PORT': config.getint(section, 'PORT'), 'ALIVE_TIMER': config.getint(section, 'ALIVE_TIMER'), 'MAX_MISSED': config.getint(section, 'MAX_MISSED'), @@ -1285,7 +1286,7 @@ if __name__ == '__main__': for ipsc_network in NETWORK: if NETWORK[ipsc_network]['LOCAL']['ENABLED']: networks[ipsc_network] = IPSC(ipsc_network) - reactor.listenUDP(NETWORK[ipsc_network]['LOCAL']['PORT'], networks[ipsc_network]) + reactor.listenUDP(NETWORK[ipsc_network]['LOCAL']['PORT'], networks[ipsc_network], interface=NETWORK[ipsc_network]['LOCAL']['IP']) write_stats = task.LoopingCall(write_ipsc_stats) write_stats.start(10) reactor.run() \ No newline at end of file diff --git a/dmrlink_SAMPLE.cfg b/dmrlink_SAMPLE.cfg index 6691a8b..abd737c 100644 --- a/dmrlink_SAMPLE.cfg +++ b/dmrlink_SAMPLE.cfg @@ -52,6 +52,11 @@ LOG_NAME: DMRlink # ENABLED: Should we communiate with this network? Handy if you need to # shut one down but don't want to lose the config # RADIO_ID: This is the radio ID that DMRLink should use to communicate +# IP: This is the local IPv4 address to listen on. It may be left + blank if you do not need or wish to specify. It is mostly + useful when DMRlink uses multiple interfaces to serve as an + application gatway/proxy from private and/or VPN networks + to the real world. # PORT: This is the UDP source port for DMRLink to use for this # IPSC network, must be unique!!! # ALIVE_TIMER: Seconds between keep-alive transmissions @@ -84,22 +89,23 @@ LOG_NAME: DMRlink [IPSC1] ENABLED: True RADIO_ID: 12345 +IP: 4.3.2.1 PORT: 50000 ALIVE_TIMER: 5 MAX_MISSED: 20 -PEER_OPER = True -IPSC_MODE = DIGITAL +PEER_OPER: True +IPSC_MODE: DIGITAL TS1_LINK: True TS2_LINK: True -CSBK_CALL = False -RCM = True -CON_APP = True -XNL_CALL = False -XNL_MASTER = False -DATA_CALL = True -VOICE_CALL = True -MASTER_PEER = False -AUTH_ENABLED = True +CSBK_CALL: False +RCM: True +CON_APP: True +XNL_CALL: False +XNL_MASTER: False +DATA_CALL: True +VOICE_CALL: True +MASTER_PEER: False +AUTH_ENABLED: True AUTH_KEY: 1A2B3C MASTER_IP: 1.2.3.4 MASTER_PORT: 50000 diff --git a/log.py b/log.py index 216ce65..ce61e2e 100755 --- a/log.py +++ b/log.py @@ -86,5 +86,5 @@ if __name__ == '__main__': for ipsc_network in NETWORK: if NETWORK[ipsc_network]['LOCAL']['ENABLED']: networks[ipsc_network] = logIPSC(ipsc_network) - reactor.listenUDP(NETWORK[ipsc_network]['LOCAL']['PORT'], networks[ipsc_network]) + reactor.listenUDP(NETWORK[ipsc_network]['LOCAL']['PORT'], networks[ipsc_network], interface=NETWORK[ipsc_network]['LOCAL']['IP']) reactor.run() \ No newline at end of file diff --git a/play_group.py b/play_group.py index b12f487..d860e50 100755 --- a/play_group.py +++ b/play_group.py @@ -59,5 +59,5 @@ if __name__ == '__main__': for ipsc_network in NETWORK: if NETWORK[ipsc_network]['LOCAL']['ENABLED']: networks[ipsc_network] = playIPSC(ipsc_network) - reactor.listenUDP(NETWORK[ipsc_network]['LOCAL']['PORT'], networks[ipsc_network]) + reactor.listenUDP(NETWORK[ipsc_network]['LOCAL']['PORT'], networks[ipsc_network], interface=NETWORK[ipsc_network]['LOCAL']['IP']) reactor.run() diff --git a/playback.py b/playback.py index 7b2627c..bb1b827 100755 --- a/playback.py +++ b/playback.py @@ -99,5 +99,5 @@ if __name__ == '__main__': for ipsc_network in NETWORK: if NETWORK[ipsc_network]['LOCAL']['ENABLED']: networks[ipsc_network] = playbackIPSC(ipsc_network) - reactor.listenUDP(NETWORK[ipsc_network]['LOCAL']['PORT'], networks[ipsc_network]) + reactor.listenUDP(NETWORK[ipsc_network]['LOCAL']['PORT'], networks[ipsc_network], interface=NETWORK[ipsc_network]['LOCAL']['IP']) reactor.run() diff --git a/rcm.py b/rcm.py index ee471a4..94f0b0d 100755 --- a/rcm.py +++ b/rcm.py @@ -141,5 +141,5 @@ if __name__ == '__main__': for ipsc_network in NETWORK: if NETWORK[ipsc_network]['LOCAL']['ENABLED']: networks[ipsc_network] = rcmIPSC(ipsc_network) - reactor.listenUDP(NETWORK[ipsc_network]['LOCAL']['PORT'], networks[ipsc_network]) + reactor.listenUDP(NETWORK[ipsc_network]['LOCAL']['PORT'], networks[ipsc_network], interface=NETWORK[ipsc_network]['LOCAL']['IP']) reactor.run() \ No newline at end of file diff --git a/record.py b/record.py index 2d863fe..877088e 100755 --- a/record.py +++ b/record.py @@ -99,5 +99,5 @@ if __name__ == '__main__': for ipsc_network in NETWORK: if NETWORK[ipsc_network]['LOCAL']['ENABLED']: networks[ipsc_network] = recordIPSC(ipsc_network) - reactor.listenUDP(NETWORK[ipsc_network]['LOCAL']['PORT'], networks[ipsc_network]) + reactor.listenUDP(NETWORK[ipsc_network]['LOCAL']['PORT'], networks[ipsc_network], interface=NETWORK[ipsc_network]['LOCAL']['IP']) reactor.run()