lib/replace: add replacement for IPV6_V6ONLY on linux systems with broken headers
authorStefan Metzmacher <metze@samba.org>
Sat, 24 Apr 2010 17:02:22 +0000 (19:02 +0200)
committerKarolin Seeger <kseeger@samba.org>
Mon, 17 May 2010 07:50:19 +0000 (09:50 +0200)
This is needed on SLES8. See bug 7196.

metze
(cherry picked from commit e06cf3950252a46486aa046a4552ed6ebff175b3)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 15b509b4b03a2c19caf4abfe475666f0720b4441)

lib/replace/libreplace_network.m4
lib/replace/system/network.h

index b7d15eaddbd6ba309b4d21f032aa5ee295c9d58a..6554a59d386f428d9ae815d6ae9e09bc43e8d93d 100644 (file)
@@ -350,6 +350,50 @@ if test x"$libreplace_cv_HAVE_IFACE_IFREQ" = x"yes"; then
 fi
 fi
 
+dnl Some old Linux systems have broken header files and
+dnl miss the IPV6_V6ONLY define in netinet/in.h,
+dnl but have it in linux/in6.h.
+dnl We can't include both files so we just check if the value
+dnl if defined and do the replacement in system/network.h
+AC_CACHE_CHECK([for IPV6_V6ONLY support],libreplace_cv_HAVE_IPV6_V6ONLY,[
+       AC_TRY_COMPILE([
+#include <stdlib.h> /* for NULL */
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netdb.h>
+#include <netinet/in.h>
+               ],
+               [
+#ifndef IPV6_V6ONLY
+#error no IPV6_V6ONLY
+#endif
+               ],[
+               libreplace_cv_HAVE_IPV6_V6ONLY=yes
+               ],[
+               libreplace_cv_HAVE_IPV6_V6ONLY=no
+               ])
+])
+if test x"$libreplace_cv_HAVE_IPV6_V6ONLY" != x"yes"; then
+   dnl test for IPV6_V6ONLY
+   AC_CACHE_CHECK([for IPV6_V6ONLY in linux/in6.h],libreplace_cv_HAVE_LINUX_IPV6_V6ONLY_26,[
+       AC_TRY_COMPILE([
+       #include <linux/in6.h>
+               ],
+               [
+       #if (IPV6_V6ONLY != 26)
+       #error no linux IPV6_V6ONLY
+       #endif
+               ],[
+               libreplace_cv_HAVE_LINUX_IPV6_V6ONLY_26=yes
+               ],[
+               libreplace_cv_HAVE_LINUX_IPV6_V6ONLY_26=no
+               ])
+       ])
+       if test x"$libreplace_cv_HAVE_LINUX_IPV6_V6ONLY_26" = x"yes"; then
+               AC_DEFINE(HAVE_LINUX_IPV6_V6ONLY_26,1,[Whether the system has IPV6_V6ONLY in linux/in6.h])
+       fi
+fi
+
 dnl test for ipv6
 AC_CACHE_CHECK([for ipv6 support],libreplace_cv_HAVE_IPV6,[
        AC_TRY_LINK([
index 1f510350bd97ca129c55d38577a67be84a4aec10..93d533c9b972d660da676e9cefc45b789847e592 100644 (file)
@@ -360,6 +360,13 @@ struct addrinfo {
 #define ifr_netmask ifr_addr
 #endif
 
+/* Some old Linux systems have broken header files */
+#ifdef HAVE_IPV6
+#ifdef HAVE_LINUX_IPV6_V6ONLY_26
+#define IPV6_V6ONLY 26
+#endif /* HAVE_LINUX_IPV6_V6ONLY_26 */
+#endif /* HAVE_IPV6 */
+
 #ifdef SOCKET_WRAPPER
 #ifndef SOCKET_WRAPPER_DISABLE
 #ifndef SOCKET_WRAPPER_NOT_REPLACE