ce426f
commit c9bd40daaee18cf1d9824e4a7ebaebe321e0a5a8
ce426f
Author: Carlos O'Donell <carlos@redhat.com>
ce426f
Date:   Tue Jun 7 04:46:37 2016 -0400
ce426f
ce426f
    Bug 20214: Fix linux/in6.h and netinet/in.h sync.
ce426f
    
ce426f
    In: https://sourceware.org/glibc/wiki/Synchronizing_Headers
ce426f
    we explain how we synchronize our headers with Linux kernel
ce426f
    headers.
ce426f
    
ce426f
    In order to synchronize with the Linux linux/in6.h and
ce426f
    linux/ipv6.h headers we checked for their guard macros and
ce426f
    then defined __USE_KERNEL_IPV6_DEFS and conditionalized code
ce426f
    on this macro.
ce426f
    
ce426f
    In upstream kernel 56c176c9 the _UAPI prefix was stripped and
ce426f
    this broke our synchronized headers again. We now need to check
ce426f
    for _LINUX_IN6_H and _IPV6_H, and keep checking the old versions
ce426f
    of the header guard checks for maximum backwards compatibility
ce426f
    with older Linux headers (the history is actually a bit muddled
ce426f
    here and it appears upstream linus kernel broke this 10 months
ce426f
    *before* our fix was ever applied to glibc, but without glibc
ce426f
    testing we didn't notice and distro kernels have their own
ce426f
    testing to fix this).
ce426f
    
ce426f
    This patch fixes synchronization with linux/in6.h and
ce426f
    with netinet/in.h.
ce426f
ce426f
diff --git a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h
ce426f
index 9bdadf3..4d70a6b 100644
ce426f
--- a/sysdeps/unix/sysv/linux/bits/in.h
ce426f
+++ b/sysdeps/unix/sysv/linux/bits/in.h
ce426f
@@ -25,8 +25,14 @@
ce426f
    kernel then we will not define the IPv6 IPPROTO_* defines, in6_addr (nor the
ce426f
    defines), sockaddr_in6, or ipv6_mreq. Same for in6_ptkinfo or ip6_mtuinfo
ce426f
    in linux/ipv6.h. The ABI used by the linux-kernel and glibc match exactly.
ce426f
-   Neither the linux kernel nor glibc should break this ABI without coordination.  */
ce426f
-#if defined _UAPI_LINUX_IN6_H || defined _UAPI_IPV6_H
ce426f
+   Neither the linux kernel nor glibc should break this ABI without coordination.
ce426f
+   In upstream kernel 56c176c9 the _UAPI prefix was stripped so we need to check
ce426f
+   for _LINUX_IN6_H and _IPV6_H now, and keep checking the old versions for
ce426f
+   maximum backwards compatibility.  */
ce426f
+#if defined _UAPI_LINUX_IN6_H \
ce426f
+    || defined _UAPI_IPV6_H \
ce426f
+    || defined _LINUX_IN6_H \
ce426f
+    || defined _IPV6_H
ce426f
 /* This is not quite the same API since the kernel always defines s6_addr16 and
ce426f
    s6_addr32. This is not a violation of POSIX since POSIX says "at least the
ce426f
    following member" and that holds true.  */
ce426f
@@ -209,8 +215,10 @@ struct in_pktinfo
ce426f
 #define IPV6_TCLASS		67
ce426f
 
ce426f
 /* Obsolete synonyms for the above.  */
ce426f
-#define IPV6_ADD_MEMBERSHIP	IPV6_JOIN_GROUP
ce426f
-#define IPV6_DROP_MEMBERSHIP	IPV6_LEAVE_GROUP
ce426f
+#if !__USE_KERNEL_IPV6_DEFS
ce426f
+# define IPV6_ADD_MEMBERSHIP	IPV6_JOIN_GROUP
ce426f
+# define IPV6_DROP_MEMBERSHIP	IPV6_LEAVE_GROUP
ce426f
+#endif
ce426f
 #define IPV6_RXHOPOPTS		IPV6_HOPOPTS
ce426f
 #define IPV6_RXDSTOPTS		IPV6_DSTOPTS
ce426f