Update to match master branch

This commit is contained in:
Mike Zingman 2018-02-02 16:43:18 -05:00
parent e0b979591e
commit 2de3737e57
7 changed files with 65869 additions and 50002 deletions

View File

@ -134,7 +134,7 @@ class bridgeallSYSTEM(HBSYSTEM):
for _target in self._CONFIG['SYSTEMS']:
if _target != self._system:
systems[_target].send_system(_data)
self._logger.debug('(%s) Packet routed to system: %s', self._system, _target)
#self._logger.debug('(%s) Packet routed to system: %s', self._system, _target)
# Final actions - Is this a voice terminator?
@ -228,4 +228,4 @@ if __name__ == '__main__':
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
logger.debug('%s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
reactor.run()
reactor.run()

View File

@ -98,10 +98,25 @@ def make_bridges(_hb_confbridge_bridges):
# are not yet implemented.
def build_acl(_sub_acl):
try:
logger.info('ACL file found, importing entries. This will take about 1.5 seconds per 1 million IDs')
acl_file = import_module(_sub_acl)
for i, e in enumerate(acl_file.ACL):
acl_file.ACL[i] = hex_str_3(acl_file.ACL[i])
logger.info('ACL file found and ACL entries imported')
sections = acl_file.ACL.split(':')
ACL_ACTION = sections[0]
entries_str = sections[1]
ACL = set()
for entry in entries_str.split(','):
if '-' in entry:
start,end = entry.split('-')
start,end = int(start), int(end)
for id in range(start, end+1):
ACL.add(hex_str_3(id))
else:
id = int(entry)
ACL.add(hex_str_3(id))
logger.info('ACL loaded: action "{}" for {:,} radio IDs'.format(ACL_ACTION, len(ACL)))
except ImportError:
logger.info('ACL file not found or invalid - all subscriber IDs are valid')
ACL_ACTION = 'NONE'
@ -109,13 +124,13 @@ def build_acl(_sub_acl):
# Depending on which type of ACL is used (PERMIT, DENY... or there isn't one)
# define a differnet function to be used to check the ACL
global allow_sub
if acl_file.ACL_ACTION == 'PERMIT':
if ACL_ACTION == 'PERMIT':
def allow_sub(_sub):
if _sub in ACL:
return True
else:
return False
elif acl_file.ACL_ACTION == 'DENY':
elif ACL_ACTION == 'DENY':
def allow_sub(_sub):
if _sub not in ACL:
return True
@ -125,7 +140,7 @@ def build_acl(_sub_acl):
def allow_sub(_sub):
return True
return acl_file.ACL
return ACL
# Run this every minute for rule timer updates

View File

@ -121,6 +121,7 @@ def build_config(_config_file):
'CONNECTION': 'NO', # NO, RTPL_SENT, AUTHENTICATED, CONFIG-SENT, YES
'PINGS_SENT': 0,
'PINGS_ACKD': 0,
'NUM_OUTSTANDING': 0,
'PING_OUTSTANDING': False,
'LAST_PING_TX_TIME': 0,
'LAST_PING_ACK_TIME': 0,

View File

@ -101,10 +101,25 @@ def make_rules(_hb_routing_rules):
# are not yet implemented.
def build_acl(_sub_acl):
try:
logger.info('ACL file found, importing entries. This will take about 1.5 seconds per 1 million IDs')
acl_file = import_module(_sub_acl)
for i, e in enumerate(acl_file.ACL):
acl_file.ACL[i] = hex_str_3(acl_file.ACL[i])
logger.info('ACL file found and ACL entries imported')
sections = acl_file.ACL.split(':')
ACL_ACTION = sections[0]
entries_str = sections[1]
ACL = set()
for entry in entries_str.split(','):
if '-' in entry:
start,end = entry.split('-')
start,end = int(start), int(end)
for id in range(start, end+1):
ACL.add(hex_str_3(id))
else:
id = int(entry)
ACL.add(hex_str_3(id))
logger.info('ACL loaded: action "{}" for {:,} radio IDs'.format(ACL_ACTION, len(ACL)))
except ImportError:
logger.info('ACL file not found or invalid - all subscriber IDs are valid')
ACL_ACTION = 'NONE'
@ -112,13 +127,13 @@ def build_acl(_sub_acl):
# Depending on which type of ACL is used (PERMIT, DENY... or there isn't one)
# define a differnet function to be used to check the ACL
global allow_sub
if acl_file.ACL_ACTION == 'PERMIT':
if ACL_ACTION == 'PERMIT':
def allow_sub(_sub):
if _sub in ACL:
return True
else:
return False
elif acl_file.ACL_ACTION == 'DENY':
elif ACL_ACTION == 'DENY':
def allow_sub(_sub):
if _sub not in ACL:
return True
@ -128,7 +143,7 @@ def build_acl(_sub_acl):
def allow_sub(_sub):
return True
return acl_file.ACL
return ACL
# Run this every minute for rule timer updates

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,5 @@
'''
This is the Access Control List (ACL) file for limiting call
routing/bridging in various hblink.py-based applications. It
is a VERY simple format. The action may be to PERMIT or DENY
and the ACL itself is a list of subscriber IDs that may be
permitted or denied.
'''
ACL_ACTION = "DENY" # May be PERMIT|DENY
ACL = [
1,2,3,4,5,6,7,8,9,10,100
]
# The 'action' May be PERMIT|DENY
# Each entry may be a single radio id, or a hypenated range (e.g. 1-2999)
# Format:
# ACL = 'action:id|start-end|,id|start-end,....'
ACL = 'DENY:0-2999,4000000-9999999'

File diff suppressed because it is too large Load Diff