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