if_bridge.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*
  2. * Linux ethernet bridge
  3. *
  4. * Authors:
  5. * Lennert Buytenhek <buytenh@gnu.org>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. */
  12. #ifndef _UAPI_LINUX_IF_BRIDGE_H
  13. #define _UAPI_LINUX_IF_BRIDGE_H
  14. #include <linux/types.h>
  15. #define SYSFS_BRIDGE_ATTR "bridge"
  16. #define SYSFS_BRIDGE_FDB "brforward"
  17. #define SYSFS_BRIDGE_PORT_SUBDIR "brif"
  18. #define SYSFS_BRIDGE_PORT_ATTR "brport"
  19. #define SYSFS_BRIDGE_PORT_LINK "bridge"
  20. #define BRCTL_VERSION 1
  21. #define BRCTL_GET_VERSION 0
  22. #define BRCTL_GET_BRIDGES 1
  23. #define BRCTL_ADD_BRIDGE 2
  24. #define BRCTL_DEL_BRIDGE 3
  25. #define BRCTL_ADD_IF 4
  26. #define BRCTL_DEL_IF 5
  27. #define BRCTL_GET_BRIDGE_INFO 6
  28. #define BRCTL_GET_PORT_LIST 7
  29. #define BRCTL_SET_BRIDGE_FORWARD_DELAY 8
  30. #define BRCTL_SET_BRIDGE_HELLO_TIME 9
  31. #define BRCTL_SET_BRIDGE_MAX_AGE 10
  32. #define BRCTL_SET_AGEING_TIME 11
  33. #define BRCTL_SET_GC_INTERVAL 12
  34. #define BRCTL_GET_PORT_INFO 13
  35. #define BRCTL_SET_BRIDGE_STP_STATE 14
  36. #define BRCTL_SET_BRIDGE_PRIORITY 15
  37. #define BRCTL_SET_PORT_PRIORITY 16
  38. #define BRCTL_SET_PATH_COST 17
  39. #define BRCTL_GET_FDB_ENTRIES 18
  40. #define BR_STATE_DISABLED 0
  41. #define BR_STATE_LISTENING 1
  42. #define BR_STATE_LEARNING 2
  43. #define BR_STATE_FORWARDING 3
  44. #define BR_STATE_BLOCKING 4
  45. struct __bridge_info {
  46. __u64 designated_root;
  47. __u64 bridge_id;
  48. __u32 root_path_cost;
  49. __u32 max_age;
  50. __u32 hello_time;
  51. __u32 forward_delay;
  52. __u32 bridge_max_age;
  53. __u32 bridge_hello_time;
  54. __u32 bridge_forward_delay;
  55. __u8 topology_change;
  56. __u8 topology_change_detected;
  57. __u8 root_port;
  58. __u8 stp_enabled;
  59. __u32 ageing_time;
  60. __u32 gc_interval;
  61. __u32 hello_timer_value;
  62. __u32 tcn_timer_value;
  63. __u32 topology_change_timer_value;
  64. __u32 gc_timer_value;
  65. };
  66. struct __port_info {
  67. __u64 designated_root;
  68. __u64 designated_bridge;
  69. __u16 port_id;
  70. __u16 designated_port;
  71. __u32 path_cost;
  72. __u32 designated_cost;
  73. __u8 state;
  74. __u8 top_change_ack;
  75. __u8 config_pending;
  76. __u8 unused0;
  77. __u32 message_age_timer_value;
  78. __u32 forward_delay_timer_value;
  79. __u32 hold_timer_value;
  80. };
  81. struct __fdb_entry {
  82. __u8 mac_addr[6];
  83. __u8 port_no;
  84. __u8 is_local;
  85. __u32 ageing_timer_value;
  86. __u8 port_hi;
  87. __u8 pad0;
  88. __u16 unused;
  89. };
  90. /* Bridge Flags */
  91. #define BRIDGE_FLAGS_MASTER 1 /* Bridge command to/from master */
  92. #define BRIDGE_FLAGS_SELF 2 /* Bridge command to/from lowerdev */
  93. #define BRIDGE_MODE_VEB 0 /* Default loopback mode */
  94. #define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */
  95. /* Bridge management nested attributes
  96. * [IFLA_AF_SPEC] = {
  97. * [IFLA_BRIDGE_FLAGS]
  98. * [IFLA_BRIDGE_MODE]
  99. * }
  100. */
  101. enum {
  102. IFLA_BRIDGE_FLAGS,
  103. IFLA_BRIDGE_MODE,
  104. __IFLA_BRIDGE_MAX,
  105. };
  106. #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
  107. /* Bridge multicast database attributes
  108. * [MDBA_MDB] = {
  109. * [MDBA_MDB_ENTRY] = {
  110. * [MDBA_MDB_ENTRY_INFO]
  111. * }
  112. * }
  113. * [MDBA_ROUTER] = {
  114. * [MDBA_ROUTER_PORT]
  115. * }
  116. */
  117. enum {
  118. MDBA_UNSPEC,
  119. MDBA_MDB,
  120. MDBA_ROUTER,
  121. __MDBA_MAX,
  122. };
  123. #define MDBA_MAX (__MDBA_MAX - 1)
  124. enum {
  125. MDBA_MDB_UNSPEC,
  126. MDBA_MDB_ENTRY,
  127. __MDBA_MDB_MAX,
  128. };
  129. #define MDBA_MDB_MAX (__MDBA_MDB_MAX - 1)
  130. enum {
  131. MDBA_MDB_ENTRY_UNSPEC,
  132. MDBA_MDB_ENTRY_INFO,
  133. __MDBA_MDB_ENTRY_MAX,
  134. };
  135. #define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1)
  136. enum {
  137. MDBA_ROUTER_UNSPEC,
  138. MDBA_ROUTER_PORT,
  139. __MDBA_ROUTER_MAX,
  140. };
  141. #define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1)
  142. struct br_port_msg {
  143. __u8 family;
  144. __u32 ifindex;
  145. };
  146. struct br_mdb_entry {
  147. __u32 ifindex;
  148. #define MDB_TEMPORARY 0
  149. #define MDB_PERMANENT 1
  150. __u8 state;
  151. struct {
  152. union {
  153. __be32 ip4;
  154. struct in6_addr ip6;
  155. } u;
  156. __be16 proto;
  157. } addr;
  158. };
  159. enum {
  160. MDBA_SET_ENTRY_UNSPEC,
  161. MDBA_SET_ENTRY,
  162. __MDBA_SET_ENTRY_MAX,
  163. };
  164. #define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1)
  165. #endif /* _UAPI_LINUX_IF_BRIDGE_H */