]> git.meshlink.io Git - meshlink/commitdiff
Use IP_DONTFRAGMENT instead of IP_MTU_DISCOVER on Windows.
authorGuus Sliepen <guus@tinc-vpn.org>
Sat, 24 Oct 2009 20:32:35 +0000 (22:32 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sat, 24 Oct 2009 20:32:35 +0000 (22:32 +0200)
This ensures the DF bit on outgoing UDP packets gets set on Windows when path
MTU discovery is enabled, reducing fragmentation.

src/net_socket.c

index baf0227a3cfd61c762b9bf0bff4a68d03a7491e3..f5a569b2102bcbe11ccd54fbcb43b00163b52e2c 100644 (file)
@@ -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)