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 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 14 | Index: linux-4.8-rc4/include/uapi/linux/if_ether.h |
| 15 | =================================================================== |
| 16 | --- linux-4.8-rc4.orig/include/uapi/linux/if_ether.h |
| 17 | +++ linux-4.8-rc4/include/uapi/linux/if_ether.h |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 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 |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 26 | @@ -138,11 +139,12 @@ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 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 */ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 40 | Index: linux-4.8-rc4/include/uapi/linux/libc-compat.h |
| 41 | =================================================================== |
| 42 | --- linux-4.8-rc4.orig/include/uapi/linux/libc-compat.h |
| 43 | +++ linux-4.8-rc4/include/uapi/linux/libc-compat.h |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 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 | + |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 54 | /* Coordinate with libc net/if.h header. */ |
| 55 | #if defined(_NET_IF_H) && defined(__USE_MISC) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 56 | |