diff options
authorRich Felker <>2016-11-07 23:19:19 -0500
committerRich Felker <>2016-11-07 23:19:19 -0500
commit04983f2272382af92eb8f8838964ff944fbb8258 (patch)
parent33ce920857405d4f4b342c85b74588a15e2702e5 (diff)
make netinet/in.h suppress clashing definitions from kernel headers
the linux kernel uapi headers provide their own definitions of the structures from netinet/in.h, resulting in errors when a program includes both the standard libc header and one or more of the networking-related kernel headers that pull in the kernel definitions. as before, we do not attempt to support the case where kernel headers are included before the libc ones, since the kernel definitions may have subtly incorrect types, namespace violations, etc. however, we can easily support the inclusion of the kernel headers after the libc ones, since the kernel headers provide a public interface for suppressing their definitions. this patch adds the necessary macro definitions for such suppression.
1 files changed, 15 insertions, 0 deletions
diff --git a/include/netinet/in.h b/include/netinet/in.h
index f6bb77b1..0d4d04aa 100644
--- a/include/netinet/in.h
+++ b/include/netinet/in.h
@@ -385,6 +385,21 @@ struct ip6_mtuinfo {
#define IPV6_RTHDR_TYPE_0 0
+#define __UAPI_DEF_IN_ADDR 0
+#define __UAPI_DEF_IN_IPPROTO 0
+#define __UAPI_DEF_IN_PKTINFO 0
+#define __UAPI_DEF_IP_MREQ 0
+#define __UAPI_DEF_IN_CLASS 0
+#define __UAPI_DEF_IN6_ADDR 0
+#define __UAPI_DEF_IN6_ADDR_ALT 0
+#define __UAPI_DEF_SOCKADDR_IN6 0
+#define __UAPI_DEF_IPV6_MREQ 0
+#define __UAPI_DEF_IPPROTO_V6 0
+#define __UAPI_DEF_IPV6_OPTIONS 0
+#define __UAPI_DEF_IN6_PKTINFO 0
+#define __UAPI_DEF_IP6_MTUINFO 0
#ifdef __cplusplus