Skip to content

Commit

Permalink
Merge pull request #469 from marek22k/improve-argument-handling
Browse files Browse the repository at this point in the history
Improve argument handling
  • Loading branch information
thebentern authored Jan 5, 2024
2 parents 7908fda + b468a0c commit fe8ae62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion meshtastic/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 6 additions & 0 deletions meshtastic/tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit fe8ae62

Please sign in to comment.