From: Alan T. DeKok Date: Tue, 18 Aug 2009 08:31:43 +0000 (+0200) Subject: Turn off the DF bit. X-Git-Tag: release_2_1_7~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cea3e866f6fe0aa7e7a65a10a9dc0a626da6685a;p=thirdparty%2Ffreeradius-server.git Turn off the DF bit. --- diff --git a/src/lib/packet.c b/src/lib/packet.c index 5eb1f19a874..952a85b4220 100644 --- a/src/lib/packet.c +++ b/src/lib/packet.c @@ -225,6 +225,30 @@ int fr_socket(fr_ipaddr_t *ipaddr, int port) } #endif /* HAVE_STRUCT_SOCKADDR_IN6 */ + if (ipaddr->af == AF_INET) { + UNUSED int flag; + +#if defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DONT) + /* + * Disable PMTU discovery. On Linux, this + * also makes sure that the "don't fragment" + * flag is zero. + */ + flag = IP_PMTUDISC_DONT; + setsockopt(sock->fd, IPPROTO_IP, IP_MTU_DISCOVER, + &action, sizeof(action)); +#endif + +#if defined(IP_DONTFRAG) + /* + * Ensure that the "don't fragment" flag is zero. + */ + flag = 0; + setsockopt(sock->fd, IPPROTO_IP, IP_DONTFRAG, + &off, sizeof(off)); +#endif + } + if (bind(sockfd, (struct sockaddr *) &salocal, salen) < 0) { close(sockfd); fr_strerror_printf("cannot bind socket: %s", strerror(errno));