kernel/4.9: add missing newline character to UBI messages
[oweals/openwrt.git] / target / linux / generic / pending-4.9 / 272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch
1 From: David Heidelberger <david.heidelberger@ixit.cz>
2 Subject: uapi/if_ether.h: prevent redefinition of struct ethhdr
3
4 Musl provides its own ethhdr struct definition. Add a guard to prevent
5 its definition of the appropriate musl header has already been included.
6
7 Signed-off-by: John Spencer <maillist-linux@barfooze.de>
8 Tested-by: David Heidelberger <david.heidelberger@ixit.cz>
9 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
10 ---
11  include/uapi/linux/if_ether.h    |  3 +++
12  include/uapi/linux/libc-compat.h | 11 +++++++++++
13  2 files changed, 14 insertions(+)
14
15 --- a/include/uapi/linux/if_ether.h
16 +++ b/include/uapi/linux/if_ether.h
17 @@ -22,6 +22,7 @@
18  #define _UAPI_LINUX_IF_ETHER_H
19  
20  #include <linux/types.h>
21 +#include <linux/libc-compat.h>
22  
23  /*
24   *     IEEE 802.3 Ethernet magic constants.  The frame sizes omit the preamble
25 @@ -138,11 +139,13 @@
26   *     This is an Ethernet frame header.
27   */
28  
29 +#if __UAPI_DEF_ETHHDR
30  struct ethhdr {
31         unsigned char   h_dest[ETH_ALEN];       /* destination eth addr */
32         unsigned char   h_source[ETH_ALEN];     /* source ether addr    */
33         __be16          h_proto;                /* packet type ID field */
34  } __attribute__((packed));
35 +#endif
36  
37  
38  #endif /* _UAPI_LINUX_IF_ETHER_H */
39 --- a/include/uapi/linux/libc-compat.h
40 +++ b/include/uapi/linux/libc-compat.h
41 @@ -89,6 +89,14 @@
42  
43  #endif /* _NET_IF_H */
44  
45 +/* musl defines the ethhdr struct itself in its netinet/if_ether.h.
46 + * Glibc just includes the kernel header and uses a different guard. */
47 +#if defined(_NETINET_IF_ETHER_H)
48 +#define __UAPI_DEF_ETHHDR              0
49 +#else
50 +#define __UAPI_DEF_ETHHDR              1
51 +#endif
52 +
53  /* Coordinate with libc netinet/in.h header. */
54  #if defined(_NETINET_IN_H)
55  
56 @@ -184,6 +192,9 @@
57  /* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
58  #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
59  
60 +/* Definitions for if_ether.h */
61 +#define __UAPI_DEF_ETHHDR              1
62 +
63  /* Definitions for in.h */
64  #define __UAPI_DEF_IN_ADDR             1
65  #define __UAPI_DEF_IN_IPPROTO          1