It turned out to be interesting ... In short, I needed to add both -ansi and -D_DEFAULT_SOURCE=1 . However, -D_DEFAULT_SOURCE=1 cancels what -ansi trying to do, so it should be contained.
Firstly, /usr/include/linux/in6.h was the wrong header. I found it through grep for struct in6_addr , and not the trace includes as needed.
Further ... -D_DEFAULT_SOURCE=1 indirectly came from /usr/include/netinet/in.h :
#ifndef __USE_KERNEL_IPV6_DEFS struct in6_addr { union { uint8_t __u6_addr8[16]; #ifdef __USE_MISC uint16_t __u6_addr16[8]; uint32_t __u6_addr32[4]; #endif } __in6_u; #define s6_addr __in6_u.__u6_addr8 #ifdef __USE_MISC # define s6_addr16 __in6_u.__u6_addr16 # define s6_addr32 __in6_u.__u6_addr32 #endif }; #endif
Manually enabling __USE_MISC failed. Tracking things for __USE_MISC in /usr/include/features.h :
#undef __USE_MISC ... #if defined _DEFAULT_SOURCE # define __USE_MISC 1 #endif
And finally, from the comment in /usr/include/features.h :
_DEFAULT_SOURCE The default set of features (taking precedence over __STRICT_ANSI__).
Although _DEFAULT_SOURCE=1 deviates from -ansi , exposure may be limited to a single source file, which is affected by IN6_IS_ADDR_V4MAPPED . That is, for the C source file crypto/bio/bss_dgram.c :
#ifndef _DEFAULT_SOURCE # define _DEFAULT_SOURCE 1 #endif #include <stdio.h> #include <errno.h> #include <netinet/in.h> ...
Twisting __USE_KERNEL_IPV6_DEFS made things even worse. I believe that he activated /usr/include/linux/in6.h , which had similar (but completely different) member names than <netinet/in.h> .
source share