Skip to content

Commit

Permalink
IP Interface may be specified now
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
n0mjs710 committed Oct 31, 2014
1 parent 626cc36 commit 5a5ecb3
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,5 +264,5 @@ def group_voice(self, _network, _src_sub, _dst_group, _ts, _end, _peerid, _data)
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()
3 changes: 2 additions & 1 deletion dmrlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@

# 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'),
Expand Down Expand Up @@ -1285,7 +1286,7 @@ def datagramReceived(self, data, (host, port)):
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()
28 changes: 17 additions & 11 deletions dmrlink_SAMPLE.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion log.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@ def private_data(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data):
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()
2 changes: 1 addition & 1 deletion play_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ def group_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data):
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()
2 changes: 1 addition & 1 deletion playback.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ def private_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data)
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()
2 changes: 1 addition & 1 deletion rcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,5 @@ def repeater_wake_up(self, _network, _data):
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()
2 changes: 1 addition & 1 deletion record.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ def private_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data)
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()

0 comments on commit 5a5ecb3

Please sign in to comment.