Skip to content

Commit

Permalink
NaCl: Add autoconf check for IPV6_PATHMTU getsockopt() call
Browse files Browse the repository at this point in the history
Unfortunately this feature is not yet supported under NaCl, and it
results in a compile error.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
cernekee authored and David Woodhouse committed May 6, 2016
1 parent 6244330 commit 7c76735
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
10 changes: 10 additions & 0 deletions configure.ac
Expand Up @@ -183,6 +183,16 @@ if test "$have_inet_aton" = "yes"; then
AC_DEFINE(HAVE_INET_ATON, 1, [Have inet_aton()])
fi

AC_MSG_CHECKING([for IPV6_PATHMTU socket option])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>],[
int foo = IPV6_PATHMTU; (void)foo;])],
[AC_DEFINE(HAVE_IPV6_PATHMTU, 1, [Have IPV6_PATHMTU socket option])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])

AC_CHECK_FUNC(__android_log_vprint, [], AC_CHECK_LIB(log, __android_log_vprint, [], []))

AC_ENABLE_SHARED
Expand Down
16 changes: 10 additions & 6 deletions dtls.c
Expand Up @@ -18,6 +18,8 @@
#include <config.h>

#include <errno.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
Expand Down Expand Up @@ -1069,11 +1071,6 @@ int dtls_mainloop(struct openconnect_info *vpninfo, int *timeout)

#if defined(DTLS_GNUTLS)

/* Old glibc doesn't define that */
#if defined(__linux__) && !defined(IPV6_PATHMTU)
# define IPV6_PATHMTU 61
#endif

static int is_cancelled(struct openconnect_info *vpninfo)
{
fd_set rd_set;
Expand Down Expand Up @@ -1195,6 +1192,13 @@ static int detect_mtu_ipv4(struct openconnect_info *vpninfo, unsigned char *buf)
}

#if defined(IPPROTO_IPV6)

/* This symbol is missing in glibc < 2.22 (bug 18643). */
#if defined(__linux__) && !defined(HAVE_IPV6_PATHMTU)
# define HAVE_IPV6_PATHMTU 1
# define IPV6_PATHMTU 61
#endif

/* Verifies whether current MTU is ok, or detects new MTU using IPv6's ICMP6 messages
* @buf: is preallocated with MTU size
* @id: a unique ID for our DPD exchange
Expand Down Expand Up @@ -1265,7 +1269,7 @@ static int detect_mtu_ipv6(struct openconnect_info *vpninfo, unsigned char *buf)
break;
} while(max_resends-- > 0);

#ifndef _WIN32
#ifdef HAVE_IPV6_PATHMTU
/* If we received back our DPD packet, do nothing; otherwise,
* attempt to get MTU from the ICMP6 packet we received */
if (ret <= 0) {
Expand Down

0 comments on commit 7c76735

Please sign in to comment.