From: Guus Sliepen Date: Sat, 24 Oct 2009 20:32:35 +0000 (+0200) Subject: Use IP_DONTFRAGMENT instead of IP_MTU_DISCOVER on Windows. X-Git-Tag: import-tinc-1.1~584^2~6 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=c3acae034c4da2d1c70f31b852b14ca098c0eeb9;p=meshlink Use IP_DONTFRAGMENT instead of IP_MTU_DISCOVER on Windows. This ensures the DF bit on outgoing UDP packets gets set on Windows when path MTU discovery is enabled, reducing fragmentation. --- diff --git a/src/net_socket.c b/src/net_socket.c index baf0227a..f5a569b2 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -279,6 +279,11 @@ int setup_vpn_in_socket(const sockaddr_t *sa) { option = IP_PMTUDISC_DO; setsockopt(nfd, SOL_IP, IP_MTU_DISCOVER, &option, sizeof(option)); } +#elif defined(IPPROTO_IP) && defined(IP_DONTFRAGMENT) + if(myself->options & OPTION_PMTU_DISCOVERY) { + option = 1; + setsockopt(nfd, IPPROTO_IP, IP_DONTFRAGMENT, &option, sizeof(option)); + } #endif #if defined(SOL_IPV6) && defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO)