if_bridge.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. #include <linux/if_ether.h>
  16. #include <linux/in6.h>
  17. #define SYSFS_BRIDGE_ATTR "bridge"
  18. #define SYSFS_BRIDGE_FDB "brforward"
  19. #define SYSFS_BRIDGE_PORT_SUBDIR "brif"
  20. #define SYSFS_BRIDGE_PORT_ATTR "brport"
  21. #define SYSFS_BRIDGE_PORT_LINK "bridge"
  22. #define BRCTL_VERSION 1
  23. #define BRCTL_GET_VERSION 0
  24. #define BRCTL_GET_BRIDGES 1
  25. #define BRCTL_ADD_BRIDGE 2
  26. #define BRCTL_DEL_BRIDGE 3
  27. #define BRCTL_ADD_IF 4
  28. #define BRCTL_DEL_IF 5
  29. #define BRCTL_GET_BRIDGE_INFO 6
  30. #define BRCTL_GET_PORT_LIST 7
  31. #define BRCTL_SET_BRIDGE_FORWARD_DELAY 8
  32. #define BRCTL_SET_BRIDGE_HELLO_TIME 9
  33. #define BRCTL_SET_BRIDGE_MAX_AGE 10
  34. #define BRCTL_SET_AGEING_TIME 11
  35. #define BRCTL_SET_GC_INTERVAL 12
  36. #define BRCTL_GET_PORT_INFO 13
  37. #define BRCTL_SET_BRIDGE_STP_STATE 14
  38. #define BRCTL_SET_BRIDGE_PRIORITY 15
  39. #define BRCTL_SET_PORT_PRIORITY 16
  40. #define BRCTL_SET_PATH_COST 17
  41. #define BRCTL_GET_FDB_ENTRIES 18
  42. #define BR_STATE_DISABLED 0
  43. #define BR_STATE_LISTENING 1
  44. #define BR_STATE_LEARNING 2
  45. #define BR_STATE_FORWARDING 3
  46. #define BR_STATE_BLOCKING 4
  47. struct __bridge_info {
  48. __u64 designated_root;
  49. __u64 bridge_id;
  50. __u32 root_path_cost;
  51. __u32 max_age;
  52. __u32 hello_time;
  53. __u32 forward_delay;
  54. __u32 bridge_max_age;
  55. __u32 bridge_hello_time;
  56. __u32 bridge_forward_delay;
  57. __u8 topology_change;
  58. __u8 topology_change_detected;
  59. __u8 root_port;
  60. __u8 stp_enabled;
  61. __u32 ageing_time;
  62. __u32 gc_interval;
  63. __u32 hello_timer_value;
  64. __u32 tcn_timer_value;
  65. __u32 topology_change_timer_value;
  66. __u32 gc_timer_value;
  67. };
  68. struct __port_info {
  69. __u64 designated_root;
  70. __u64 designated_bridge;
  71. __u16 port_id;
  72. __u16 designated_port;
  73. __u32 path_cost;
  74. __u32 designated_cost;
  75. __u8 state;
  76. __u8 top_change_ack;
  77. __u8 config_pending;
  78. __u8 unused0;
  79. __u32 message_age_timer_value;
  80. __u32 forward_delay_timer_value;
  81. __u32 hold_timer_value;
  82. };
  83. struct __fdb_entry {
  84. __u8 mac_addr[ETH_ALEN];
  85. __u8 port_no;
  86. __u8 is_local;
  87. __u32 ageing_timer_value;
  88. __u8 port_hi;
  89. __u8 pad0;
  90. __u16 unused;
  91. };
  92. /* Bridge Flags */
  93. #define BRIDGE_FLAGS_MASTER 1 /* Bridge command to/from master */
  94. #define BRIDGE_FLAGS_SELF 2 /* Bridge command to/from lowerdev */
  95. #define BRIDGE_MODE_VEB 0 /* Default loopback mode */
  96. #define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */
  97. #define BRIDGE_MODE_UNDEF 0xFFFF /* mode undefined */
  98. /* Bridge management nested attributes
  99. * [IFLA_AF_SPEC] = {
  100. * [IFLA_BRIDGE_FLAGS]
  101. * [IFLA_BRIDGE_MODE]
  102. * [IFLA_BRIDGE_VLAN_INFO]
  103. * }
  104. */
  105. enum {
  106. IFLA_BRIDGE_FLAGS,
  107. IFLA_BRIDGE_MODE,
  108. IFLA_BRIDGE_VLAN_INFO,
  109. __IFLA_BRIDGE_MAX,
  110. };
  111. #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
  112. #define BRIDGE_VLAN_INFO_MASTER (1<<0) /* Operate on Bridge device as well */
  113. #define BRIDGE_VLAN_INFO_PVID (1<<1) /* VLAN is PVID, ingress untagged */
  114. #define BRIDGE_VLAN_INFO_UNTAGGED (1<<2) /* VLAN egresses untagged */
  115. #define BRIDGE_VLAN_INFO_RANGE_BEGIN (1<<3) /* VLAN is start of vlan range */
  116. #define BRIDGE_VLAN_INFO_RANGE_END (1<<4) /* VLAN is end of vlan range */
  117. #define BRIDGE_VLAN_INFO_BRENTRY (1<<5) /* Global bridge VLAN entry */
  118. struct bridge_vlan_info {
  119. __u16 flags;
  120. __u16 vid;
  121. };
  122. /* Bridge multicast database attributes
  123. * [MDBA_MDB] = {
  124. * [MDBA_MDB_ENTRY] = {
  125. * [MDBA_MDB_ENTRY_INFO]
  126. * }
  127. * }
  128. * [MDBA_ROUTER] = {
  129. * [MDBA_ROUTER_PORT]
  130. * }
  131. */
  132. enum {
  133. MDBA_UNSPEC,
  134. MDBA_MDB,
  135. MDBA_ROUTER,
  136. __MDBA_MAX,
  137. };
  138. #define MDBA_MAX (__MDBA_MAX - 1)
  139. enum {
  140. MDBA_MDB_UNSPEC,
  141. MDBA_MDB_ENTRY,
  142. __MDBA_MDB_MAX,
  143. };
  144. #define MDBA_MDB_MAX (__MDBA_MDB_MAX - 1)
  145. enum {
  146. MDBA_MDB_ENTRY_UNSPEC,
  147. MDBA_MDB_ENTRY_INFO,
  148. __MDBA_MDB_ENTRY_MAX,
  149. };
  150. #define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1)
  151. enum {
  152. MDBA_ROUTER_UNSPEC,
  153. MDBA_ROUTER_PORT,
  154. __MDBA_ROUTER_MAX,
  155. };
  156. #define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1)
  157. struct br_port_msg {
  158. __u8 family;
  159. __u32 ifindex;
  160. };
  161. struct br_mdb_entry {
  162. __u32 ifindex;
  163. #define MDB_TEMPORARY 0
  164. #define MDB_PERMANENT 1
  165. __u8 state;
  166. __u16 vid;
  167. struct {
  168. union {
  169. __be32 ip4;
  170. struct in6_addr ip6;
  171. } u;
  172. __be16 proto;
  173. } addr;
  174. };
  175. enum {
  176. MDBA_SET_ENTRY_UNSPEC,
  177. MDBA_SET_ENTRY,
  178. __MDBA_SET_ENTRY_MAX,
  179. };
  180. #define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1)
  181. #endif /* _UAPI_LINUX_IF_BRIDGE_H */