0002-libbridge-fix-headers-conflict-with-musl-libc.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. From 24e5409190820a14e4d097924b1acaab62bb3b99 Mon Sep 17 00:00:00 2001
  2. From: Baruch Siach <baruch@tkos.co.il>
  3. Date: Sun, 30 Oct 2016 18:12:00 +0200
  4. Subject: [PATCH] libbridge: fix headers conflict with musl libc
  5. Don't including kernel headers directly to avoid headers conflict like:
  6. In file included from .../sysroot/usr/include/linux/if_bridge.h:18:0,
  7. from libbridge.h:26,
  8. from libbridge_if.c:26:
  9. .../sysroot/usr/include/linux/in6.h:32:8: error: redefinition of ‘struct in6_addr’
  10. struct in6_addr {
  11. ^
  12. In file included from libbridge.h:24:0,
  13. from libbridge_if.c:26:
  14. .../sysroot/usr/include/netinet/in.h:23:8: note: originally defined here
  15. struct in6_addr {
  16. ^
  17. Instead copy the required linux/if_bridge.h definitions into
  18. libbridge_private.h.
  19. Signed-off-by: Baruch Siach <baruch@tkos.co.il>
  20. ---
  21. Patch status: Nacked
  22. (https://lists.linuxfoundation.org/pipermail/bridge/2016-November/010107.html)
  23. ---
  24. libbridge/libbridge.h | 1 -
  25. libbridge/libbridge_private.h | 83 ++++++++++++++++++++++++++++++++++++++++++-
  26. 2 files changed, 82 insertions(+), 2 deletions(-)
  27. diff --git a/libbridge/libbridge.h b/libbridge/libbridge.h
  28. index ff047f933cd6..18b40cd90413 100644
  29. --- a/libbridge/libbridge.h
  30. +++ b/libbridge/libbridge.h
  31. @@ -23,7 +23,6 @@
  32. #include <sys/socket.h>
  33. #include <netinet/in.h>
  34. #include <linux/if.h>
  35. -#include <linux/if_bridge.h>
  36. /* defined in net/if.h but that conflicts with linux/if.h... */
  37. extern unsigned int if_nametoindex (const char *__ifname);
  38. diff --git a/libbridge/libbridge_private.h b/libbridge/libbridge_private.h
  39. index 99a511dae00a..565025b7bccb 100644
  40. --- a/libbridge/libbridge_private.h
  41. +++ b/libbridge/libbridge_private.h
  42. @@ -24,7 +24,88 @@
  43. #include <linux/sockios.h>
  44. #include <sys/time.h>
  45. #include <sys/ioctl.h>
  46. -#include <linux/if_bridge.h>
  47. +
  48. +/* From linux/if_ether.h */
  49. +#ifndef ETH_ALEN
  50. +#define ETH_ALEN 6
  51. +#endif
  52. +
  53. +/* From linux/if_bridge.h */
  54. +#ifndef BRCTL_GET_VERSION
  55. +#define BRCTL_GET_VERSION 0
  56. +#define BRCTL_GET_BRIDGES 1
  57. +#define BRCTL_ADD_BRIDGE 2
  58. +#define BRCTL_DEL_BRIDGE 3
  59. +#define BRCTL_ADD_IF 4
  60. +#define BRCTL_DEL_IF 5
  61. +#define BRCTL_GET_BRIDGE_INFO 6
  62. +#define BRCTL_GET_PORT_LIST 7
  63. +#define BRCTL_SET_BRIDGE_FORWARD_DELAY 8
  64. +#define BRCTL_SET_BRIDGE_HELLO_TIME 9
  65. +#define BRCTL_SET_BRIDGE_MAX_AGE 10
  66. +#define BRCTL_SET_AGEING_TIME 11
  67. +#define BRCTL_SET_GC_INTERVAL 12
  68. +#define BRCTL_GET_PORT_INFO 13
  69. +#define BRCTL_SET_BRIDGE_STP_STATE 14
  70. +#define BRCTL_SET_BRIDGE_PRIORITY 15
  71. +#define BRCTL_SET_PORT_PRIORITY 16
  72. +#define BRCTL_SET_PATH_COST 17
  73. +#define BRCTL_GET_FDB_ENTRIES 18
  74. +
  75. +#define BR_STATE_DISABLED 0
  76. +#define BR_STATE_LISTENING 1
  77. +#define BR_STATE_LEARNING 2
  78. +#define BR_STATE_FORWARDING 3
  79. +#define BR_STATE_BLOCKING 4
  80. +
  81. +struct __bridge_info {
  82. + __u64 designated_root;
  83. + __u64 bridge_id;
  84. + __u32 root_path_cost;
  85. + __u32 max_age;
  86. + __u32 hello_time;
  87. + __u32 forward_delay;
  88. + __u32 bridge_max_age;
  89. + __u32 bridge_hello_time;
  90. + __u32 bridge_forward_delay;
  91. + __u8 topology_change;
  92. + __u8 topology_change_detected;
  93. + __u8 root_port;
  94. + __u8 stp_enabled;
  95. + __u32 ageing_time;
  96. + __u32 gc_interval;
  97. + __u32 hello_timer_value;
  98. + __u32 tcn_timer_value;
  99. + __u32 topology_change_timer_value;
  100. + __u32 gc_timer_value;
  101. +};
  102. +
  103. +struct __port_info {
  104. + __u64 designated_root;
  105. + __u64 designated_bridge;
  106. + __u16 port_id;
  107. + __u16 designated_port;
  108. + __u32 path_cost;
  109. + __u32 designated_cost;
  110. + __u8 state;
  111. + __u8 top_change_ack;
  112. + __u8 config_pending;
  113. + __u8 unused0;
  114. + __u32 message_age_timer_value;
  115. + __u32 forward_delay_timer_value;
  116. + __u32 hold_timer_value;
  117. +};
  118. +
  119. +struct __fdb_entry {
  120. + __u8 mac_addr[ETH_ALEN];
  121. + __u8 port_no;
  122. + __u8 is_local;
  123. + __u32 ageing_timer_value;
  124. + __u8 port_hi;
  125. + __u8 pad0;
  126. + __u16 unused;
  127. +};
  128. +#endif /* BRCTL_GET_VERSION */
  129. #define MAX_BRIDGES 1024
  130. #define MAX_PORTS 1024
  131. --
  132. 2.10.1