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).
This commit is contained in:
Cort Buffington 2014-10-31 10:30:18 -05:00
parent 626cc3674b
commit 5a5ecb322b
8 changed files with 25 additions and 18 deletions

View File

@ -264,5 +264,5 @@ if __name__ == '__main__':
for ipsc_network in NETWORK: for ipsc_network in NETWORK:
if NETWORK[ipsc_network]['LOCAL']['ENABLED']: if NETWORK[ipsc_network]['LOCAL']['ENABLED']:
networks[ipsc_network] = bridgeIPSC(ipsc_network) 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() reactor.run()

View File

@ -119,6 +119,7 @@ try:
# Things we need to know to connect and be a peer in this IPSC # 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'), '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'), 'PORT': config.getint(section, 'PORT'),
'ALIVE_TIMER': config.getint(section, 'ALIVE_TIMER'), 'ALIVE_TIMER': config.getint(section, 'ALIVE_TIMER'),
'MAX_MISSED': config.getint(section, 'MAX_MISSED'), 'MAX_MISSED': config.getint(section, 'MAX_MISSED'),
@ -1285,7 +1286,7 @@ if __name__ == '__main__':
for ipsc_network in NETWORK: for ipsc_network in NETWORK:
if NETWORK[ipsc_network]['LOCAL']['ENABLED']: if NETWORK[ipsc_network]['LOCAL']['ENABLED']:
networks[ipsc_network] = IPSC(ipsc_network) 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 = task.LoopingCall(write_ipsc_stats)
write_stats.start(10) write_stats.start(10)
reactor.run() reactor.run()

View File

@ -52,6 +52,11 @@ LOG_NAME: DMRlink
# ENABLED: Should we communiate with this network? Handy if you need to # ENABLED: Should we communiate with this network? Handy if you need to
# shut one down but don't want to lose the config # shut one down but don't want to lose the config
# RADIO_ID: This is the radio ID that DMRLink should use to communicate # 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 # PORT: This is the UDP source port for DMRLink to use for this
# IPSC network, must be unique!!! # IPSC network, must be unique!!!
# ALIVE_TIMER: Seconds between keep-alive transmissions # ALIVE_TIMER: Seconds between keep-alive transmissions
@ -84,22 +89,23 @@ LOG_NAME: DMRlink
[IPSC1] [IPSC1]
ENABLED: True ENABLED: True
RADIO_ID: 12345 RADIO_ID: 12345
IP: 4.3.2.1
PORT: 50000 PORT: 50000
ALIVE_TIMER: 5 ALIVE_TIMER: 5
MAX_MISSED: 20 MAX_MISSED: 20
PEER_OPER = True PEER_OPER: True
IPSC_MODE = DIGITAL IPSC_MODE: DIGITAL
TS1_LINK: True TS1_LINK: True
TS2_LINK: True TS2_LINK: True
CSBK_CALL = False CSBK_CALL: False
RCM = True RCM: True
CON_APP = True CON_APP: True
XNL_CALL = False XNL_CALL: False
XNL_MASTER = False XNL_MASTER: False
DATA_CALL = True DATA_CALL: True
VOICE_CALL = True VOICE_CALL: True
MASTER_PEER = False MASTER_PEER: False
AUTH_ENABLED = True AUTH_ENABLED: True
AUTH_KEY: 1A2B3C AUTH_KEY: 1A2B3C
MASTER_IP: 1.2.3.4 MASTER_IP: 1.2.3.4
MASTER_PORT: 50000 MASTER_PORT: 50000

2
log.py
View File

@ -86,5 +86,5 @@ if __name__ == '__main__':
for ipsc_network in NETWORK: for ipsc_network in NETWORK:
if NETWORK[ipsc_network]['LOCAL']['ENABLED']: if NETWORK[ipsc_network]['LOCAL']['ENABLED']:
networks[ipsc_network] = logIPSC(ipsc_network) 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() reactor.run()

View File

@ -59,5 +59,5 @@ if __name__ == '__main__':
for ipsc_network in NETWORK: for ipsc_network in NETWORK:
if NETWORK[ipsc_network]['LOCAL']['ENABLED']: if NETWORK[ipsc_network]['LOCAL']['ENABLED']:
networks[ipsc_network] = playIPSC(ipsc_network) 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() reactor.run()

View File

@ -99,5 +99,5 @@ if __name__ == '__main__':
for ipsc_network in NETWORK: for ipsc_network in NETWORK:
if NETWORK[ipsc_network]['LOCAL']['ENABLED']: if NETWORK[ipsc_network]['LOCAL']['ENABLED']:
networks[ipsc_network] = playbackIPSC(ipsc_network) 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() reactor.run()

2
rcm.py
View File

@ -141,5 +141,5 @@ if __name__ == '__main__':
for ipsc_network in NETWORK: for ipsc_network in NETWORK:
if NETWORK[ipsc_network]['LOCAL']['ENABLED']: if NETWORK[ipsc_network]['LOCAL']['ENABLED']:
networks[ipsc_network] = rcmIPSC(ipsc_network) 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() reactor.run()

View File

@ -99,5 +99,5 @@ if __name__ == '__main__':
for ipsc_network in NETWORK: for ipsc_network in NETWORK:
if NETWORK[ipsc_network]['LOCAL']['ENABLED']: if NETWORK[ipsc_network]['LOCAL']['ENABLED']:
networks[ipsc_network] = recordIPSC(ipsc_network) 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() reactor.run()