Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | From 75ba4a547282f91d653872a4bba5f5eae234ea6c Mon Sep 17 00:00:00 2001 |
| 2 | From: rofl0r <retnyg@gmx.net> |
| 3 | Date: Wed, 22 Jan 2014 00:57:48 +0100 |
| 4 | Subject: [PATCH 2/3] libc-compat.h: prevent redefinition of struct ethhdr |
| 5 | |
| 6 | --- |
| 7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 8 | Upstream-Status: Submitted |
| 9 | |
| 10 | include/uapi/linux/if_ether.h | 4 +++- |
| 11 | include/uapi/linux/libc-compat.h | 6 ++++++ |
| 12 | 2 files changed, 9 insertions(+), 1 deletion(-) |
| 13 | |
| 14 | diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h |
| 15 | index aa63ed0..e94da57 100644 |
| 16 | --- a/include/uapi/linux/if_ether.h |
| 17 | +++ b/include/uapi/linux/if_ether.h |
| 18 | @@ -22,6 +22,7 @@ |
| 19 | #define _UAPI_LINUX_IF_ETHER_H |
| 20 | |
| 21 | #include <linux/types.h> |
| 22 | +#include <linux/libc-compat.h> |
| 23 | |
| 24 | /* |
| 25 | * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble |
| 26 | @@ -134,11 +135,12 @@ |
| 27 | * This is an Ethernet frame header. |
| 28 | */ |
| 29 | |
| 30 | +#if __UAPI_DEF_ETHHDR |
| 31 | struct ethhdr { |
| 32 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ |
| 33 | unsigned char h_source[ETH_ALEN]; /* source ether addr */ |
| 34 | __be16 h_proto; /* packet type ID field */ |
| 35 | } __attribute__((packed)); |
| 36 | - |
| 37 | +#endif |
| 38 | |
| 39 | #endif /* _UAPI_LINUX_IF_ETHER_H */ |
| 40 | diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h |
| 41 | index afe15c2..7d0c78a 100644 |
| 42 | --- a/include/uapi/linux/libc-compat.h |
| 43 | +++ b/include/uapi/linux/libc-compat.h |
| 44 | @@ -50,6 +50,12 @@ |
| 45 | |
| 46 | #ifndef __KERNEL__ /* we're used from userspace */ |
| 47 | |
| 48 | +#ifdef _NETINET_IF_ETHER_H /* musl */ |
| 49 | +#define __UAPI_DEF_ETHHDR 0 |
| 50 | +#else /* glibc uses __NETINET_IF_ETHER_H, and includes the kernel header. */ |
| 51 | +#define __UAPI_DEF_ETHHDR 1 |
| 52 | +#endif |
| 53 | + |
| 54 | /* Coordinate with libc netinet/in.h header. */ |
| 55 | #if defined(_NETINET_IN_H) |
| 56 | |
| 57 | -- |
| 58 | 2.6.4 |
| 59 | |