[OpenWrt-Devel] [PATCH] linux-3.18: prevent redefinition of struct ethhdr
amery at geeks.cl
Mon Jun 22 17:48:28 EDT 2015
On 22/06/15 21:08, Alejandro Mery wrote:
> On 22/06/15 11:32, Karl Palsson wrote:
>> Alejandro Mery <amery at geeks.cl> wrote:
>>> 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
>> If this gets merged, could we then drop the large and growing pile of
>> musl ether.h patches in each of the packages? Is this going to get
>> _merged_ upstream, or was it just posted to LKML? I didn't see any
>> discussion of it there.
> not sure if *all* related patches can be removed because some packages
> do very nasty stuff, but this at least fixes those not doing
> define/include witchcraft. also, here I'm only patching 3.18 and will
> 4.0 need similar love.
> this patch is happily used by openembedded and sabotage linux, but it
> might take a while upstream decides to take it into consideration...
> it's not that they enjoy becoming part of libc wars.
> but they did at least replace the #ifdef __GLIBC__ with a #ifndef
> __KERNEL__ in libc-compat.h, and that's something :)
An example of weakness of this patch is etherwake which breaks because
it includes the kernel headers before libc's. so I suppose it's hard
(impossible?) to find an almighty patch that fixes every case.
From d25df0f20a5fd690a502a169c56a4cc0458bb6b1 Mon Sep 17 00:00:00 2001
From: Alejandro Mery <amery at geeks.cl>
Date: Mon, 22 Jun 2015 23:44:27 +0200
Subject: [PATCH] etherwake: prevent the redefinition of struct ethhdr
by including the libc headers first
Signed-off-by: Alejandro Mery <amery at geeks.cl>
net/etherwake/patches/200-netinit-if_ether_h.patch | 24
1 file changed, 24 insertions(+)
create mode 100644 net/etherwake/patches/200-netinit-if_ether_h.patch
diff --git a/net/etherwake/patches/200-netinit-if_ether_h.patch
new file mode 100644
@@ -0,0 +1,24 @@
+avoid redefinition of struct struct ethhdr by including
+the libc headers first.
+--- ./ether-wake.c.orig 2015-06-22 23:39:23.271788072 +0200
++++ ./ether-wake.c 2015-06-22 23:39:52.771788072 +0200
+@@ -82,6 +82,9 @@
+ #include <linux/if.h>
+ #include <features.h>
+ #if __GLIBC__ >= 2 && __GLIBC_MINOR >= 1
+ #include <netpacket/packet.h>
+ #include <net/ethernet.h>
+@@ -90,8 +93,6 @@
+ #include <linux/if_packet.h>
+ #include <linux/if_ether.h>
+ /* Grrr, no consistency between include versions.
+ Enable this if setsockopt() isn't declared with your library. */
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
More information about the openwrt-devel