From 04983f2272382af92eb8f8838964ff944fbb8258 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 7 Nov 2016 23:19:19 -0500 Subject: [PATCH] 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. --- include/netinet/in.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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_SOCKADDR_IN 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 } #endif -- GitLab