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