0001-Fix-musl-build-issue.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. From cbf84a0bc377c6a368d30571f37ebfab27784697 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?J=C3=B6rg=20Krause?= <joerg.krause@embedded.rocks>
  3. Date: Wed, 2 Dec 2015 04:57:33 +0100
  4. Subject: [PATCH] Fix musl build issue
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Due to clashes in the namespace between the Linux Kernel headers and the
  9. netinet headers building arptables with the musl C library fails.
  10. Best advice from the musl developers is to not include both headers in a
  11. userspace tool (see the thread on the musl mailing list [1], especially [2]).
  12. Since arptables only requires a few definitions from the Linux Kernel headers
  13. we opt-out the clashing header files and define the needed definitions.
  14. [1] http://www.openwall.com/lists/musl/2012/10/09/1
  15. [2] http://www.openwall.com/lists/musl/2012/10/11/1
  16. Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
  17. ---
  18. extensions/arpt_CLASSIFY.c | 7 +++++++
  19. include/linux/netfilter_arp.h | 11 +++++++++++
  20. 2 files changed, 18 insertions(+)
  21. diff --git a/extensions/arpt_CLASSIFY.c b/extensions/arpt_CLASSIFY.c
  22. index cb5770b..c58129f 100644
  23. --- a/extensions/arpt_CLASSIFY.c
  24. +++ b/extensions/arpt_CLASSIFY.c
  25. @@ -21,7 +21,14 @@
  26. #include <stdio.h>
  27. #include <getopt.h>
  28. #include <arptables.h>
  29. +
  30. +#ifdef __KERNEL__
  31. #include <linux/netfilter/xt_CLASSIFY.h>
  32. +#else
  33. +struct xt_classify_target_info {
  34. + uint32_t priority;
  35. +};
  36. +#endif
  37. #define TC_H_MAJ_MASK (0xFFFF0000U)
  38. #define TC_H_MIN_MASK (0x0000FFFFU)
  39. diff --git a/include/linux/netfilter_arp.h b/include/linux/netfilter_arp.h
  40. index 92bc6dd..2a63e82 100644
  41. --- a/include/linux/netfilter_arp.h
  42. +++ b/include/linux/netfilter_arp.h
  43. @@ -5,7 +5,18 @@
  44. * (C)2002 Rusty Russell IBM -- This code is GPL.
  45. */
  46. +#ifdef __KERNEL__
  47. #include <linux/netfilter.h>
  48. +#else
  49. +/* Responses from hook functions. */
  50. +#define NF_DROP 0
  51. +#define NF_ACCEPT 1
  52. +#define NF_STOLEN 2
  53. +#define NF_QUEUE 3
  54. +#define NF_REPEAT 4
  55. +#define NF_STOP 5
  56. +#define NF_MAX_VERDICT NF_STOP
  57. +#endif
  58. /* There is no PF_ARP. */
  59. #define NF_ARP 0
  60. --
  61. 2.6.2