101-add-musl-workaround-to-the-libc-compat.h-copy.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. diff -Naur libnl-3.3.0_rc1.orig/include/linux-private/linux/if_ether.h libnl-3.3.0_rc1/include/linux-private/linux/if_ether.h
  2. --- /include/linux-private/linux/if_ether.h 2017-03-08 19:56:31.824516933 -0800
  3. +++ /include/linux-private/linux/if_ether.h 2017-03-08 20:07:01.938237767 -0800
  4. @@ -22,6 +22,7 @@
  5. #define _LINUX_IF_ETHER_H
  6. #include <linux/types.h>
  7. +#include <linux/libc-compat.h>
  8. /*
  9. * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
  10. @@ -117,10 +118,12 @@
  11. * This is an Ethernet frame header.
  12. */
  13. +#if __UAPI_DEF_ETHHDR
  14. struct ethhdr {
  15. unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
  16. unsigned char h_source[ETH_ALEN]; /* source ether addr */
  17. __be16 h_proto; /* packet type ID field */
  18. } __attribute__((packed));
  19. +#endif
  20. #endif /* _LINUX_IF_ETHER_H */
  21. diff -Naur libnl-3.3.0_rc1.orig/include/linux-private/linux/libc-compat.h libnl-3.3.0_rc1/include/linux-private/linux/libc-compat.h
  22. --- /include/linux-private/linux/libc-compat.h 2017-03-08 19:56:31.823516923 -0800
  23. +++ /include/linux-private/linux/libc-compat.h 2017-03-08 20:12:30.376843489 -0800
  24. @@ -48,10 +48,18 @@
  25. #ifndef _LIBC_COMPAT_H
  26. #define _LIBC_COMPAT_H
  27. -/* We have included glibc headers... */
  28. -#if defined(__GLIBC__)
  29. +/* We're used from userspace... */
  30. +#if !defined(__KERNEL__)
  31. -/* Coordinate with glibc netinet/in.h header. */
  32. +/* Coordinate with libc netinet/if_ether.h */
  33. +#ifdef _NETINET_IF_ETHER_H /* musl */
  34. +#define __UAPI_DEF_ETHHDR 0
  35. +#else
  36. +/* glibc uses __NETINET_IF_ETHER_H, and uses the uapi header. */
  37. +#define __UAPI_DEF_ETHHDR 1
  38. +#endif
  39. +
  40. +/* Coordinate with libc netinet/in.h header. */
  41. #if defined(_NETINET_IN_H)
  42. /* GLIBC headers included first so don't define anything
  43. @@ -64,15 +72,7 @@
  44. #define __UAPI_DEF_IN_CLASS 0
  45. #define __UAPI_DEF_IN6_ADDR 0
  46. -/* The exception is the in6_addr macros which must be defined
  47. - * if the glibc code didn't define them. This guard matches
  48. - * the guard in glibc/inet/netinet/in.h which defines the
  49. - * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */
  50. -#if defined(__USE_MISC) || defined (__USE_GNU)
  51. #define __UAPI_DEF_IN6_ADDR_ALT 0
  52. -#else
  53. -#define __UAPI_DEF_IN6_ADDR_ALT 1
  54. -#endif
  55. #define __UAPI_DEF_SOCKADDR_IN6 0
  56. #define __UAPI_DEF_IPV6_MREQ 0
  57. #define __UAPI_DEF_IPPROTO_V6 0
  58. @@ -83,7 +83,7 @@
  59. #else
  60. /* Linux headers included first, and we must define everything
  61. - * we need. The expectation is that glibc will check the
  62. + * we need. The expectation is that libc will check the
  63. * __UAPI_DEF_* defines and adjust appropriately. */
  64. #define __UAPI_DEF_IN_ADDR 1
  65. #define __UAPI_DEF_IN_IPPROTO 1
  66. @@ -93,7 +93,7 @@
  67. #define __UAPI_DEF_IN_CLASS 1
  68. #define __UAPI_DEF_IN6_ADDR 1
  69. -/* We unconditionally define the in6_addr macros and glibc must
  70. +/* We unconditionally define the in6_addr macros and libc must
  71. * coordinate. */
  72. #define __UAPI_DEF_IN6_ADDR_ALT 1
  73. #define __UAPI_DEF_SOCKADDR_IN6 1
  74. @@ -115,7 +115,10 @@
  75. /* If we did not see any headers from any supported C libraries,
  76. * or we are being included in the kernel, then define everything
  77. * that we need. */
  78. -#else /* !defined(__GLIBC__) */
  79. +#else /* defined(__KERNEL__) */
  80. +
  81. +/* Definitions for if/ether.h */
  82. +#define __UAPI_DEF_ETHHDR 1
  83. /* Definitions for in.h */
  84. #define __UAPI_DEF_IN_ADDR 1
  85. @@ -138,6 +141,6 @@
  86. /* Definitions for xattr.h */
  87. #define __UAPI_DEF_XATTR 1
  88. -#endif /* __GLIBC__ */
  89. +#endif /* defined(__KERNEL__) */
  90. #endif /* _LIBC_COMPAT_H */