From 951f39f3db75aa4677a41b61350880adfbe85c05 Mon Sep 17 00:00:00 2001 From: "Dan Srebnick (K2IE)" Date: Sat, 24 Oct 2020 21:14:06 -0400 Subject: [PATCH] Re-add needed code removed when diffing to restore XLX --- config.py | 5 +++-- hblink-SAMPLE.cfg | 5 ++++- hblink.py | 13 +++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/config.py b/config.py index f86628c..d59d4d6 100755 --- a/config.py +++ b/config.py @@ -182,8 +182,8 @@ def build_config(_config_file): 'SOFTWARE_ID': bytes(config.get(section, 'SOFTWARE_ID').ljust(40)[:40], 'utf-8'), 'PACKAGE_ID': bytes(config.get(section, 'PACKAGE_ID').ljust(40)[:40], 'utf-8'), 'GROUP_HANGTIME': config.getint(section, 'GROUP_HANGTIME'), - 'OPTIONS': bytes(config.get(section, 'OPTIONS'), 'utf-8'), - 'USE_ACL': config.getboolean(section, 'USE_ACL'), + 'OPTIONS': b''.join([b'Type=HBlink;', bytes(config.get(section, 'OPTIONS'), 'utf-8')]), + 'USE_ACL': config.getboolean(section, 'USE_ACL'), 'SUB_ACL': config.get(section, 'SUB_ACL'), 'TG1_ACL': config.get(section, 'TGID_TS1_ACL'), 'TG2_ACL': config.get(section, 'TGID_TS2_ACL') @@ -274,6 +274,7 @@ def build_config(_config_file): 'TARGET_SOCK': (gethostbyname(config.get(section, 'TARGET_IP')), config.getint(section, 'TARGET_PORT')), 'TARGET_IP': gethostbyname(config.get(section, 'TARGET_IP')), 'TARGET_PORT': config.getint(section, 'TARGET_PORT'), + 'BOTH_SLOTS': config.getboolean(section, 'BOTH_SLOTS'), 'USE_ACL': config.getboolean(section, 'USE_ACL'), 'SUB_ACL': config.get(section, 'SUB_ACL'), 'TG1_ACL': config.get(section, 'TGID_ACL'), diff --git a/hblink-SAMPLE.cfg b/hblink-SAMPLE.cfg index a3b616c..c2e789d 100755 --- a/hblink-SAMPLE.cfg +++ b/hblink-SAMPLE.cfg @@ -120,7 +120,9 @@ STALE_DAYS: 7 # # ACLs: # OpenBridge does not 'register', so registration ACL is meaningless. -# OpenBridge passes all traffic on TS1, so there is only 1 TGID ACL. +# Proper OpenBridge passes all traffic on TS1. +# HBlink can extend OPB to use both slots for unit calls only. +# Setting "BOTH_SLOTS" True ONLY affects unit traffic! # Otherwise ACLs work as described in the global stanza [OBP-1] MODE: OPENBRIDGE @@ -131,6 +133,7 @@ NETWORK_ID: 3129100 PASSPHRASE: password TARGET_IP: 1.2.3.4 TARGET_PORT: 62035 +BOTH_SLOTS: True USE_ACL: True SUB_ACL: DENY:1 TGID_ACL: PERMIT:ALL diff --git a/hblink.py b/hblink.py index 7331b42..7896396 100755 --- a/hblink.py +++ b/hblink.py @@ -519,6 +519,18 @@ class HBSYSTEM(DatagramProtocol): self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr) logger.warning('(%s) Ping from Radio ID that is not logged in: %s', self._system, int_id(_peer_id)) + elif _command == RPTO: + _peer_id = _data[4:8] + if _peer_id in self._peers \ + and self._peers[_peer_id]['CONNECTION'] == 'YES' \ + and self._peers[_peer_id]['SOCKADDR'] == _sockaddr: + logger.info('(%s) Peer %s (%s) has send options: %s', self._system, self._peers[_peer_id]['CALLSIGN'], int_id(_peer_id), _data[8:]) + self.transport.write(b''.join([RPTACK, _peer_id]), _sockaddr) + + elif _command == DMRA: + _peer_id = _data[4:8] + logger.info('(%s) Recieved DMR Talker Alias from peer %s, subscriber %s', self._system, self._peers[_peer_id]['CALLSIGN'], int_id(_rf_src)) + else: logger.error('(%s) Unrecognized command. Raw HBP PDU: %s', self._system, ahex(_data)) @@ -648,6 +660,7 @@ class HBSYSTEM(DatagramProtocol): self._stats['CONNECTION'] = 'YES' self._stats['CONNECTED'] = time() logger.info('(%s) Connection to Master Completed', self._system) + # If we are an XLX, send the XLX module request here. if self._config['MODE'] == 'XLXPEER': self.send_xlxmaster(self._config['RADIO_ID'], int(4000), self._config['MASTER_SOCKADDR'])