Handle the absence of IP_MTU_DISCOVER

This commit is contained in:
Quentin Smith
2012-02-26 01:28:06 -05:00
committed by Keith Winstein
parent e8d14d35a6
commit a1671bcf3b
2 changed files with 7 additions and 0 deletions
+5
View File
@@ -89,6 +89,11 @@ AC_CHECK_DECL([htobe64],
[[#include <libkern/OSByteOrder.h>]])],
[[#include <endian.h>]])
AC_CHECK_DECL([IP_MTU_DISCOVER],
[AC_DEFINE([HAVE_IP_MTU_DISCOVER], [1],
[Define if IP_MTU_DISCOVER is a valid sockopt.])],
, [[#include <netinet/ip.h>]])
# Checks for protobuf
PKG_CHECK_MODULES([protobuf], [protobuf])
+2
View File
@@ -106,11 +106,13 @@ void Connection::setup( void )
}
/* Disable path MTU discovery */
#ifdef HAVE_IP_MTU_DISCOVER
char flag = IP_PMTUDISC_DONT;
socklen_t optlen = sizeof( flag );
if ( setsockopt( sock, IPPROTO_IP, IP_MTU_DISCOVER, &flag, optlen ) < 0 ) {
throw NetworkException( "setsockopt", errno );
}
#endif
}
Connection::Connection( const char *desired_ip ) /* server */