1 From 649affd04813c43e0a72886517fcfccd63230981 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Mon, 29 Jun 2015 16:53:03 +0200
4 Subject: uapi/if_ether.h: prevent redefinition of struct ethhdr
6 Musl provides its own ethhdr struct definition. Add a guard to prevent
7 its definition of the appropriate musl header has already been included.
9 glibc does not implement this header, but when glibc will implement this
10 they can just define __UAPI_DEF_ETHHDR 0 to make it work with the
13 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
15 include/uapi/linux/if_ether.h | 3 +++
16 include/uapi/linux/libc-compat.h | 6 ++++++
17 2 files changed, 9 insertions(+)
19 --- a/include/uapi/linux/if_ether.h
20 +++ b/include/uapi/linux/if_ether.h
22 #define _LINUX_IF_ETHER_H
24 #include <linux/types.h>
25 +#include <linux/libc-compat.h>
28 * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
30 * This is an Ethernet frame header.
33 +#if __UAPI_DEF_ETHHDR
35 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
36 unsigned char h_source[ETH_ALEN]; /* source ether addr */
37 __be16 h_proto; /* packet type ID field */
38 } __attribute__((packed));
42 #endif /* _LINUX_IF_ETHER_H */
43 --- a/include/uapi/linux/libc-compat.h
44 +++ b/include/uapi/linux/libc-compat.h
47 #endif /* __GLIBC__ */
49 +/* Definitions for if_ether.h */
50 +/* allow libcs like musl to deactivate this, glibc does not implement this. */
51 +#ifndef __UAPI_DEF_ETHHDR
52 +#define __UAPI_DEF_ETHHDR 1
55 #endif /* _LIBC_COMPAT_H */