From c3acae034c4da2d1c70f31b852b14ca098c0eeb9 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sat, 24 Oct 2009 22:32:35 +0200 Subject: [PATCH] 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. --- src/net_socket.c | 5 +++++ 1 file changed, 5 insertions(+) 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) -- 2.39.5