From de154e50ca89191a6882e8c12e1da0e0e4ed3271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20K=C3=BCthe?= Date: Mon, 4 Dec 2023 12:55:06 +0000 Subject: [PATCH 1/2] Tunnel: Pass variable only if it has content. Closes https://github.com/meshtastic/python/issues/468 --- meshtastic/__main__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 1d0c2480..3d6616d0 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -771,7 +771,10 @@ def setSimpleConfig(modem_preset): if interface.noProto: logging.warning(f"Not starting Tunnel - disabled by noProto") else: - tunnel.Tunnel(interface, subnet=args.tunnel_net) + if args.tunnel_net: + tunnel.Tunnel(interface, subnet=args.tunnel_net) + else: + tunnel.Tunnel(interface) if args.ack or (args.dest != BROADCAST_ADDR and waitForAckNak): print( From b468a0c908bb1c967b4aa2f2f2a8b7b735615dbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20K=C3=BCthe?= Date: Mon, 4 Dec 2023 12:55:36 +0000 Subject: [PATCH 2/2] Tunnel: Check other arguments --- meshtastic/tunnel.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meshtastic/tunnel.py b/meshtastic/tunnel.py index 65c5f5ce..d1b1d828 100644 --- a/meshtastic/tunnel.py +++ b/meshtastic/tunnel.py @@ -49,6 +49,12 @@ def __init__(self, iface, subnet="10.115", netmask="255.255.0.0"): if not iface: raise Exception("Tunnel() must have a interface") + if not subnet: + raise Exception("Tunnel() must have a subnet") + + if not netmask: + raise Exception("Tunnel() must have a netmask") + self.iface = iface self.subnetPrefix = subnet