From 26a52e30043630712f09bfed12d4fdcee013d1ec Mon Sep 17 00:00:00 2001 From: Simonas Date: Sun, 3 Jan 2021 18:37:20 +0200 Subject: [PATCH] Fix MTU - set after mesh interface is up Fix based on pytap2 docs/examples https://pypi.org/project/pytap2/ --- meshtastic/tunnel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meshtastic/tunnel.py b/meshtastic/tunnel.py index dd1c102..d897a92 100644 --- a/meshtastic/tunnel.py +++ b/meshtastic/tunnel.py @@ -87,12 +87,12 @@ class Tunnel: ip = self._nodeNumToIp(node["num"]) logging.info(f"Node { nodeId } has IP address { ip }") - logging.debug("creating TUN device") + logging.debug("creating TUN device with MTU=200") # FIXME - figure out real max MTU, it should be 240 - the overhead bytes for SubPacket and Data from pytap2 import TapDevice - self.tun = TapDevice(name="mesh", mtu=200) + self.tun = TapDevice(name="mesh") self.tun.up() - self.tun.ifconfig(address=myAddr,netmask=netmask) + self.tun.ifconfig(address=myAddr,netmask=netmask,mtu=200) logging.debug(f"starting TUN reader, our IP address is {myAddr}") self._rxThread = threading.Thread(target=self.__tunReader, args=(), daemon=True) self._rxThread.start()