[OpenWrt-Devel] [PATCH] linux-3.18: prevent redefinition of struct ethhdr

Alejandro Mery amery at geeks.cl
Sun Jun 21 11:53:22 EDT 2015


when using musl packages include netinet/ether.h break because
struct ethhdr gets redefined.

this patch comes includes a patch originally from sabotage linux
and it has been submitted upstream https://lkml.org/lkml/2014/3/14/266

Signed-off-by: Alejandro Mery <amery at geeks.cl>
---
 ...206-prevent-redefinition-of-struct-ethhdr.patch | 53 ++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 target/linux/generic/patches-3.18/206-prevent-redefinition-of-struct-ethhdr.patch

diff --git a/target/linux/generic/patches-3.18/206-prevent-redefinition-of-struct-ethhdr.patch b/target/linux/generic/patches-3.18/206-prevent-redefinition-of-struct-ethhdr.patch
new file mode 100644
index 0000000..e888320
--- /dev/null
+++ b/target/linux/generic/patches-3.18/206-prevent-redefinition-of-struct-ethhdr.patch
@@ -0,0 +1,53 @@
+From 4ffbb51f2abfbefa73cbd418f55b20148d04959a Mon Sep 17 00:00:00 2001
+From: rofl0r <retnyg at gmx.net>
+Date: Wed, 22 Jan 2014 00:57:48 +0100
+Subject: [PATCH] libc-compat.h: prevent redefinition of struct ethhdr
+
+---
+ generic/include/linux/if_ether.h    | 4 +++-
+ generic/include/linux/libc-compat.h | 6 ++++++
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+Index: linux-3.19/include/uapi/linux/if_ether.h
+===================================================================
+--- linux-3.19.orig/include/uapi/linux/if_ether.h
++++ linux-3.19/include/uapi/linux/if_ether.h
+@@ -22,6 +22,7 @@
+ #define _UAPI_LINUX_IF_ETHER_H
+ 
+ #include <linux/types.h>
++#include <linux/libc-compat.h>
+ 
+ /*
+  *	IEEE 802.3 Ethernet magic constants.  The frame sizes omit the preamble
+@@ -134,11 +135,12 @@
+  *	This is an Ethernet frame header.
+  */
+ 
++#if __UAPI_DEF_ETHHDR
+ struct ethhdr {
+ 	unsigned char	h_dest[ETH_ALEN];	/* destination eth addr	*/
+ 	unsigned char	h_source[ETH_ALEN];	/* source ether addr	*/
+ 	__be16		h_proto;		/* packet type ID field	*/
+ } __attribute__((packed));
+-
++#endif
+ 
+ #endif /* _UAPI_LINUX_IF_ETHER_H */
+Index: linux-3.19/include/uapi/linux/libc-compat.h
+===================================================================
+--- linux-3.18.16.orig/include/uapi/linux/libc-compat.h
++++ linux-3.18.16/include/uapi/linux/libc-compat.h
+@@ -48,6 +48,12 @@
+ #ifndef _UAPI_LIBC_COMPAT_H
+ #define _UAPI_LIBC_COMPAT_H
+ 
++#ifdef _NETINET_IF_ETHER_H /* musl */
++#define __UAPI_DEF_ETHHDR 0
++#else /* glibc uses __NETINET_IF_ETHER_H, and includes the kernel header. */
++#define __UAPI_DEF_ETHHDR 1
++#endif
++
+ /* We have included glibc headers... */
+ #if defined(__GLIBC__)
+ 
-- 
2.3.6
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list