From 5fb173882209c6405c42138eddb8116f315ee4a2 Mon Sep 17 00:00:00 2001 From: Edward Moscardini Date: Thu, 27 Jul 2023 14:52:11 +0100 Subject: [PATCH 1/2] fixed issue with NF_PORT_BYPASS --- CHANGELOG | 5 +++++ router_registration.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 8198c5f..2b9cba5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.8] - 2023-07-27 + +### Fixed + +- NF_PORT_BYPASS need to be an integer for check to work. ## [1.0.7] - 2023-07-26 ### Changed diff --git a/router_registration.py b/router_registration.py index 6064efc..9d8a450 100755 --- a/router_registration.py +++ b/router_registration.py @@ -115,7 +115,7 @@ def check_port(ip_host, port, timeout): :return True if the host is reachable on the specified port, False otherwise. """ - bypass = os.environ.get('NF_PORT_BYPASS') + bypass = int(os.environ.get('NF_PORT_BYPASS')) if bypass == port: logging.debug("Bypassing port check for port: %s", bypass) return True @@ -235,7 +235,7 @@ def create_parser(): :return: A Namespace containing arguments """ - __version__ = '1.0.7' + __version__ = '1.0.8' parser = argparse.ArgumentParser() parser.add_argument('registration_key', From eb62c25a50e718f5da6f14dbfa29552788cc238b Mon Sep 17 00:00:00 2001 From: Edward Moscardini Date: Thu, 27 Jul 2023 16:38:28 +0100 Subject: [PATCH 2/2] added logging --- router_registration.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/router_registration.py b/router_registration.py index 9d8a450..05b68f6 100755 --- a/router_registration.py +++ b/router_registration.py @@ -115,9 +115,14 @@ def check_port(ip_host, port, timeout): :return True if the host is reachable on the specified port, False otherwise. """ - bypass = int(os.environ.get('NF_PORT_BYPASS')) + bypass = os.environ.get('NF_PORT_BYPASS') + logging.debug("Bypass value: %s", bypass) + if bypass: + bypass = int(os.environ.get('NF_PORT_BYPASS')) + else: + bypass = 0 if bypass == port: - logging.debug("Bypassing port check for port: %s", bypass) + logging.info("Bypassing port check for port: %s", bypass) return True socket_connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM) socket_connection.settimeout(timeout)