diff options
author | Stephen Hemminger <stephen@networkplumber.org> | 2015-06-29 20:57:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-06-29 21:56:21 -0400 |
commit | 279c6c7fa64f5763e6b9f05e7ab3840092e702e7 (patch) | |
tree | aa2d32e925fa5cf4dfb0529a87c4779014963251 | |
parent | 1625fecf56e077e832dd0ce22cf4b629f0e3d9b7 (diff) |
api: fix compatibility of linux/in.h with netinet/in.h
u
This fixes breakage to iproute2 build with recent kernel headers
caused by:
commit a263653ed798216c0069922d7b5237ca49436007
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Wed Jun 17 10:28:27 2015 -0500
netfilter: don't pull include/linux/netfilter.h from netns headers
The issue is that definitions in linux/in.h overlap with those
in netinet/in.h. This patch solves this by introducing the same
mechanism as was used to solve the same problem with linux/in6.h
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/uapi/linux/in.h | 16 | ||||
-rw-r--r-- | include/uapi/linux/libc-compat.h | 22 |
2 files changed, 35 insertions, 3 deletions
diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h index 83d6236a2f08..eaf94919291a 100644 --- a/include/uapi/linux/in.h +++ b/include/uapi/linux/in.h | |||
@@ -19,8 +19,10 @@ | |||
19 | #define _UAPI_LINUX_IN_H | 19 | #define _UAPI_LINUX_IN_H |
20 | 20 | ||
21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
22 | #include <linux/libc-compat.h> | ||
22 | #include <linux/socket.h> | 23 | #include <linux/socket.h> |
23 | 24 | ||
25 | #if __UAPI_DEF_IN_IPPROTO | ||
24 | /* Standard well-defined IP protocols. */ | 26 | /* Standard well-defined IP protocols. */ |
25 | enum { | 27 | enum { |
26 | IPPROTO_IP = 0, /* Dummy protocol for TCP */ | 28 | IPPROTO_IP = 0, /* Dummy protocol for TCP */ |
@@ -75,12 +77,14 @@ enum { | |||
75 | #define IPPROTO_RAW IPPROTO_RAW | 77 | #define IPPROTO_RAW IPPROTO_RAW |
76 | IPPROTO_MAX | 78 | IPPROTO_MAX |
77 | }; | 79 | }; |
80 | #endif | ||
78 | 81 | ||
79 | 82 | #if __UAPI_DEF_IN_ADDR | |
80 | /* Internet address. */ | 83 | /* Internet address. */ |
81 | struct in_addr { | 84 | struct in_addr { |
82 | __be32 s_addr; | 85 | __be32 s_addr; |
83 | }; | 86 | }; |
87 | #endif | ||
84 | 88 | ||
85 | #define IP_TOS 1 | 89 | #define IP_TOS 1 |
86 | #define IP_TTL 2 | 90 | #define IP_TTL 2 |
@@ -158,6 +162,7 @@ struct in_addr { | |||
158 | 162 | ||
159 | /* Request struct for multicast socket ops */ | 163 | /* Request struct for multicast socket ops */ |
160 | 164 | ||
165 | #if __UAPI_DEF_IP_MREQ | ||
161 | struct ip_mreq { | 166 | struct ip_mreq { |
162 | struct in_addr imr_multiaddr; /* IP multicast address of group */ | 167 | struct in_addr imr_multiaddr; /* IP multicast address of group */ |
163 | struct in_addr imr_interface; /* local IP address of interface */ | 168 | struct in_addr imr_interface; /* local IP address of interface */ |
@@ -209,14 +214,18 @@ struct group_filter { | |||
209 | #define GROUP_FILTER_SIZE(numsrc) \ | 214 | #define GROUP_FILTER_SIZE(numsrc) \ |
210 | (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \ | 215 | (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \ |
211 | + (numsrc) * sizeof(struct __kernel_sockaddr_storage)) | 216 | + (numsrc) * sizeof(struct __kernel_sockaddr_storage)) |
217 | #endif | ||
212 | 218 | ||
219 | #if __UAPI_DEF_IN_PKTINFO | ||
213 | struct in_pktinfo { | 220 | struct in_pktinfo { |
214 | int ipi_ifindex; | 221 | int ipi_ifindex; |
215 | struct in_addr ipi_spec_dst; | 222 | struct in_addr ipi_spec_dst; |
216 | struct in_addr ipi_addr; | 223 | struct in_addr ipi_addr; |
217 | }; | 224 | }; |
225 | #endif | ||
218 | 226 | ||
219 | /* Structure describing an Internet (IP) socket address. */ | 227 | /* Structure describing an Internet (IP) socket address. */ |
228 | #if __UAPI_DEF_SOCKADDR_IN | ||
220 | #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ | 229 | #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ |
221 | struct sockaddr_in { | 230 | struct sockaddr_in { |
222 | __kernel_sa_family_t sin_family; /* Address family */ | 231 | __kernel_sa_family_t sin_family; /* Address family */ |
@@ -228,8 +237,9 @@ struct sockaddr_in { | |||
228 | sizeof(unsigned short int) - sizeof(struct in_addr)]; | 237 | sizeof(unsigned short int) - sizeof(struct in_addr)]; |
229 | }; | 238 | }; |
230 | #define sin_zero __pad /* for BSD UNIX comp. -FvK */ | 239 | #define sin_zero __pad /* for BSD UNIX comp. -FvK */ |
240 | #endif | ||
231 | 241 | ||
232 | 242 | #if __UAPI_DEF_IN_CLASS | |
233 | /* | 243 | /* |
234 | * Definitions of the bits in an Internet address integer. | 244 | * Definitions of the bits in an Internet address integer. |
235 | * On subnets, host and network parts are found according | 245 | * On subnets, host and network parts are found according |
@@ -280,7 +290,7 @@ struct sockaddr_in { | |||
280 | #define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */ | 290 | #define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */ |
281 | #define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */ | 291 | #define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */ |
282 | #define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */ | 292 | #define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */ |
283 | 293 | #endif | |
284 | 294 | ||
285 | /* <asm/byteorder.h> contains the htonl type stuff.. */ | 295 | /* <asm/byteorder.h> contains the htonl type stuff.. */ |
286 | #include <asm/byteorder.h> | 296 | #include <asm/byteorder.h> |
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h index fa673e9cc040..7d024ceb075d 100644 --- a/include/uapi/linux/libc-compat.h +++ b/include/uapi/linux/libc-compat.h | |||
@@ -56,6 +56,13 @@ | |||
56 | 56 | ||
57 | /* GLIBC headers included first so don't define anything | 57 | /* GLIBC headers included first so don't define anything |
58 | * that would already be defined. */ | 58 | * that would already be defined. */ |
59 | #define __UAPI_DEF_IN_ADDR 0 | ||
60 | #define __UAPI_DEF_IN_IPPROTO 0 | ||
61 | #define __UAPI_DEF_IN_PKTINFO 0 | ||
62 | #define __UAPI_DEF_IP_MREQ 0 | ||
63 | #define __UAPI_DEF_SOCKADDR_IN 0 | ||
64 | #define __UAPI_DEF_IN_CLASS 0 | ||
65 | |||
59 | #define __UAPI_DEF_IN6_ADDR 0 | 66 | #define __UAPI_DEF_IN6_ADDR 0 |
60 | /* The exception is the in6_addr macros which must be defined | 67 | /* The exception is the in6_addr macros which must be defined |
61 | * if the glibc code didn't define them. This guard matches | 68 | * if the glibc code didn't define them. This guard matches |
@@ -78,6 +85,13 @@ | |||
78 | /* Linux headers included first, and we must define everything | 85 | /* Linux headers included first, and we must define everything |
79 | * we need. The expectation is that glibc will check the | 86 | * we need. The expectation is that glibc will check the |
80 | * __UAPI_DEF_* defines and adjust appropriately. */ | 87 | * __UAPI_DEF_* defines and adjust appropriately. */ |
88 | #define __UAPI_DEF_IN_ADDR 1 | ||
89 | #define __UAPI_DEF_IN_IPPROTO 1 | ||
90 | #define __UAPI_DEF_IN_PKTINFO 1 | ||
91 | #define __UAPI_DEF_IP_MREQ 1 | ||
92 | #define __UAPI_DEF_SOCKADDR_IN 1 | ||
93 | #define __UAPI_DEF_IN_CLASS 1 | ||
94 | |||
81 | #define __UAPI_DEF_IN6_ADDR 1 | 95 | #define __UAPI_DEF_IN6_ADDR 1 |
82 | /* We unconditionally define the in6_addr macros and glibc must | 96 | /* We unconditionally define the in6_addr macros and glibc must |
83 | * coordinate. */ | 97 | * coordinate. */ |
@@ -103,6 +117,14 @@ | |||
103 | * that we need. */ | 117 | * that we need. */ |
104 | #else /* !defined(__GLIBC__) */ | 118 | #else /* !defined(__GLIBC__) */ |
105 | 119 | ||
120 | /* Definitions for in.h */ | ||
121 | #define __UAPI_DEF_IN_ADDR 1 | ||
122 | #define __UAPI_DEF_IN_IPPROTO 1 | ||
123 | #define __UAPI_DEF_IN_PKTINFO 1 | ||
124 | #define __UAPI_DEF_IP_MREQ 1 | ||
125 | #define __UAPI_DEF_SOCKADDR_IN 1 | ||
126 | #define __UAPI_DEF_IN_CLASS 1 | ||
127 | |||
106 | /* Definitions for in6.h */ | 128 | /* Definitions for in6.h */ |
107 | #define __UAPI_DEF_IN6_ADDR 1 | 129 | #define __UAPI_DEF_IN6_ADDR 1 |
108 | #define __UAPI_DEF_IN6_ADDR_ALT 1 | 130 | #define __UAPI_DEF_IN6_ADDR_ALT 1 |