commit 8f4731520c519ba8c60955fe8e97cc9dcd2fcab7
parent f9c7f434c15db28d2e020de8292d21b83caf1c76
Author: sin <sin@2f30.org>
Date: Thu, 24 Mar 2016 10:29:35 +0000
fix tap mtu on linux
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/stun.c b/stun.c
@@ -200,7 +200,10 @@ opendev(char *dev)
s = socket(AF_INET, SOCK_STREAM, 0);
if (s < 0)
logerr("failed to create socket");
- ifr.ifr_mtu = MTU;
+ if (devtype == TUNDEV)
+ ifr.ifr_mtu = MTU;
+ else
+ ifr.ifr_mtu = MTU - 14; /* make some room for ethernet header */
if (ioctl(s, SIOCSIFMTU, &ifr) < 0)
logerr("failed to set MTU on %s", dev);
close(s);