272-uapi-if_ether.h-prevent-redefinition-of-struct-ethhd.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From fcbb6fed85ea9ff4feb4f1ebd4f0f235fdaf06b6 Mon Sep 17 00:00:00 2001
  2. From: David Heidelberger <david.heidelberger@ixit.cz>
  3. Date: Mon, 29 Jun 2015 16:53:03 +0200
  4. Subject: [PATCH 3/3] uapi/if_ether.h: prevent redefinition of struct ethhdr
  5. Musl provides its own ethhdr struct definition. Add a guard to prevent
  6. its definition of the appropriate musl header has already been included.
  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. --- a/include/uapi/linux/if_ether.h
  15. +++ b/include/uapi/linux/if_ether.h
  16. @@ -22,6 +22,7 @@
  17. #define _UAPI_LINUX_IF_ETHER_H
  18. #include <linux/types.h>
  19. +#include <linux/libc-compat.h>
  20. /*
  21. * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
  22. --- a/include/uapi/linux/libc-compat.h
  23. +++ b/include/uapi/linux/libc-compat.h
  24. @@ -85,6 +85,14 @@
  25. #endif /* _NET_IF_H */
  26. +/* musl defines the ethhdr struct itself in its netinet/if_ether.h.
  27. + * Glibc just includes the kernel header and uses a different guard. */
  28. +#if defined(_NETINET_IF_ETHER_H)
  29. +#define __UAPI_DEF_ETHHDR 0
  30. +#else
  31. +#define __UAPI_DEF_ETHHDR 1
  32. +#endif
  33. +
  34. /* Coordinate with libc netinet/in.h header. */
  35. #if defined(_NETINET_IN_H)
  36. @@ -161,6 +169,9 @@
  37. /* For the future if glibc adds IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO */
  38. #define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
  39. +/* Definitions for if_ether.h */
  40. +#define __UAPI_DEF_ETHHDR 1
  41. +
  42. /* Definitions for in.h */
  43. #define __UAPI_DEF_IN_ADDR 1
  44. #define __UAPI_DEF_IN_IPPROTO 1