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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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
  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. glibc does not implement this header, but when glibc will implement this
  8. they can just define __UAPI_DEF_ETHHDR 0 to make it work with the
  9. kernel.
  10. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  11. ---
  12. include/uapi/linux/if_ether.h | 3 +++
  13. include/uapi/linux/libc-compat.h | 6 ++++++
  14. 2 files changed, 9 insertions(+)
  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. #include <linux/types.h>
  20. +#include <linux/libc-compat.h>
  21. /*
  22. * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
  23. @@ -135,11 +136,13 @@
  24. * This is an Ethernet frame header.
  25. */
  26. +#if __UAPI_DEF_ETHHDR
  27. struct ethhdr {
  28. unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
  29. unsigned char h_source[ETH_ALEN]; /* source ether addr */
  30. __be16 h_proto; /* packet type ID field */
  31. } __attribute__((packed));
  32. +#endif
  33. #endif /* _UAPI_LINUX_IF_ETHER_H */
  34. --- a/include/uapi/linux/libc-compat.h
  35. +++ b/include/uapi/linux/libc-compat.h
  36. @@ -161,4 +161,10 @@
  37. #endif /* __GLIBC__ */
  38. +/* Definitions for if_ether.h */
  39. +/* allow libcs like musl to deactivate this, glibc does not implement this. */
  40. +#ifndef __UAPI_DEF_ETHHDR
  41. +#define __UAPI_DEF_ETHHDR 1
  42. +#endif
  43. +
  44. #endif /* _UAPI_LIBC_COMPAT_H */