diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 1d0c248..3d6616d 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -771,7 +771,10 @@ def onConnected(interface): 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( diff --git a/meshtastic/tunnel.py b/meshtastic/tunnel.py index b880efa..b3fe7d4 100644 --- a/meshtastic/tunnel.py +++ b/meshtastic/tunnel.py @@ -49,6 +49,12 @@ class Tunnel: 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