diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2018-01-03 17:14:21 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-01-04 14:30:52 -0500 |
commit | 6926e041a8920c8ec27e4e155efa760aa01551fd (patch) | |
tree | 84c94bc8ffb7e5738793ea78fd996a5294da94bf | |
parent | 7bbfe00e025240505db3e04c3b296d7c023b2a26 (diff) |
uapi/if_ether.h: prevent redefinition of struct ethhdr
Musl provides its own ethhdr struct definition. Add a guard to prevent
its definition of the appropriate musl header has already been included.
glibc does not implement this header, but when glibc will implement this
they can just define __UAPI_DEF_ETHHDR 0 to make it work with the
kernel.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/uapi/linux/if_ether.h | 3 | ||||
-rw-r--r-- | include/uapi/linux/libc-compat.h | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h index 3ee3bf7c8526..144de4d2f385 100644 --- a/include/uapi/linux/if_ether.h +++ b/include/uapi/linux/if_ether.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #define _UAPI_LINUX_IF_ETHER_H | 23 | #define _UAPI_LINUX_IF_ETHER_H |
24 | 24 | ||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/libc-compat.h> | ||
26 | 27 | ||
27 | /* | 28 | /* |
28 | * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble | 29 | * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble |
@@ -149,11 +150,13 @@ | |||
149 | * This is an Ethernet frame header. | 150 | * This is an Ethernet frame header. |
150 | */ | 151 | */ |
151 | 152 | ||
153 | #if __UAPI_DEF_ETHHDR | ||
152 | struct ethhdr { | 154 | struct ethhdr { |
153 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ | 155 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ |
154 | unsigned char h_source[ETH_ALEN]; /* source ether addr */ | 156 | unsigned char h_source[ETH_ALEN]; /* source ether addr */ |
155 | __be16 h_proto; /* packet type ID field */ | 157 | __be16 h_proto; /* packet type ID field */ |
156 | } __attribute__((packed)); | 158 | } __attribute__((packed)); |
159 | #endif | ||
157 | 160 | ||
158 | 161 | ||
159 | #endif /* _UAPI_LINUX_IF_ETHER_H */ | 162 | #endif /* _UAPI_LINUX_IF_ETHER_H */ |
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h index 8254c937c9f4..fc29efaa918c 100644 --- a/include/uapi/linux/libc-compat.h +++ b/include/uapi/linux/libc-compat.h | |||
@@ -264,4 +264,10 @@ | |||
264 | 264 | ||
265 | #endif /* __GLIBC__ */ | 265 | #endif /* __GLIBC__ */ |
266 | 266 | ||
267 | /* Definitions for if_ether.h */ | ||
268 | /* allow libcs like musl to deactivate this, glibc does not implement this. */ | ||
269 | #ifndef __UAPI_DEF_ETHHDR | ||
270 | #define __UAPI_DEF_ETHHDR 1 | ||
271 | #endif | ||
272 | |||
267 | #endif /* _UAPI_LIBC_COMPAT_H */ | 273 | #endif /* _UAPI_LIBC_COMPAT_H */ |