00db10
commit 1c1e7fb65828c99d6e0f0f3857089b559a0c8189
00db10
Author: Carlos O'Donell <carlos@redhat.com>
00db10
Date:   Thu Jun 2 23:30:11 2016 -0400
00db10
00db10
    Fix macro API for __USE_KERNEL_IPV6_DEFS.
00db10
    
00db10
    The use of __USE_KERNEL_IPV6_DEFS with ifndef is bad
00db10
    practice per: https://sourceware.org/glibc/wiki/Wundef.
00db10
    This change moves it to use 'if' and always define the
00db10
    macro.
00db10
    
00db10
    Please note that this is not the only problem with this
00db10
    code. I have a series of fixes after this one to resolve
00db10
    breakage with this code and add regression tests for it
00db10
    via compile-only source testing (to be discussed in another
00db10
    thread).
00db10
    
00db10
    Unfortunately __USE_KERNEL_XATTR_DEFS is set by the kernel
00db10
    and not glibc, and uses 'define', so we can't fix that yet.
00db10
00db10
Index: glibc-2.17-c758a686/inet/netinet/in.h
00db10
===================================================================
00db10
--- glibc-2.17-c758a686.orig/inet/netinet/in.h
00db10
+++ glibc-2.17-c758a686/inet/netinet/in.h
00db10
@@ -91,10 +91,10 @@ enum
00db10
     IPPROTO_MAX
00db10
   };
00db10
 
00db10
-/* If __USER_KERNEL_IPV6_DEFS is defined then the user has included the kernel
00db10
+/* If __USE_KERNEL_IPV6_DEFS is 1 then the user has included the kernel
00db10
    network headers first and we should use those ABI-identical definitions
00db10
-   instead of our own.  */
00db10
-#ifndef __USE_KERNEL_IPV6_DEFS
00db10
+   instead of our own, otherwise 0.  */
00db10
+#if !__USE_KERNEL_IPV6_DEFS
00db10
 enum
00db10
   {
00db10
     IPPROTO_HOPOPTS = 0,   /* IPv6 Hop-by-Hop options.  */
00db10
@@ -205,7 +205,7 @@ enum
00db10
 #define INADDR_ALLRTRS_GROUP    ((in_addr_t) 0xe0000002) /* 224.0.0.2 */
00db10
 #define INADDR_MAX_LOCAL_GROUP  ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */
00db10
 
00db10
-#ifndef __USE_KERNEL_IPV6_DEFS
00db10
+#if !__USE_KERNEL_IPV6_DEFS
00db10
 /* IPv6 address */
00db10
 struct in6_addr
00db10
   {
00db10
@@ -248,7 +248,7 @@ struct sockaddr_in
00db10
 			   sizeof (struct in_addr)];
00db10
   };
00db10
 
00db10
-#ifndef __USE_KERNEL_IPV6_DEFS
00db10
+#if !__USE_KERNEL_IPV6_DEFS
00db10
 /* Ditto, for IPv6.  */
00db10
 struct sockaddr_in6
00db10
   {
00db10
@@ -284,7 +284,7 @@ struct ip_mreq_source
00db10
   };
00db10
 #endif
00db10
 
00db10
-#ifndef __USE_KERNEL_IPV6_DEFS
00db10
+#if !__USE_KERNEL_IPV6_DEFS
00db10
 /* Likewise, for IPv6.  */
00db10
 struct ipv6_mreq
00db10
   {
00db10
@@ -531,7 +531,7 @@ extern int bindresvport6 (int __sockfd,
00db10
 #ifdef __USE_GNU
00db10
 struct cmsghdr;			/* Forward declaration.  */
00db10
 
00db10
-#ifndef __USE_KERNEL_IPV6_DEFS
00db10
+#if !__USE_KERNEL_IPV6_DEFS
00db10
 /* IPv6 packet information.  */
00db10
 struct in6_pktinfo
00db10
   {
00db10
Index: glibc-2.17-c758a686/sysdeps/unix/sysv/linux/bits/in.h
00db10
===================================================================
00db10
--- glibc-2.17-c758a686.orig/sysdeps/unix/sysv/linux/bits/in.h
00db10
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/bits/in.h
00db10
@@ -30,7 +30,9 @@
00db10
 /* This is not quite the same API since the kernel always defines s6_addr16 and
00db10
    s6_addr32. This is not a violation of POSIX since POSIX says "at least the
00db10
    following member" and that holds true.  */
00db10
-# define __USE_KERNEL_IPV6_DEFS
00db10
+# define __USE_KERNEL_IPV6_DEFS 1
00db10
+#else
00db10
+# define __USE_KERNEL_IPV6_DEFS 0
00db10
 #endif
00db10
 
00db10
 /* Options for use with `getsockopt' and `setsockopt' at the IP level.