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