1
2
3
4
5
6
7
8
9
10
11
12
13
14 #ifndef _UAPI_LINUX_IF_BRIDGE_H
15 #define _UAPI_LINUX_IF_BRIDGE_H
16
17 #include <linux/types.h>
18 #include <linux/if_ether.h>
19 #include <linux/in6.h>
20
21 #define SYSFS_BRIDGE_ATTR "bridge"
22 #define SYSFS_BRIDGE_FDB "brforward"
23 #define SYSFS_BRIDGE_PORT_SUBDIR "brif"
24 #define SYSFS_BRIDGE_PORT_ATTR "brport"
25 #define SYSFS_BRIDGE_PORT_LINK "bridge"
26
27 #define BRCTL_VERSION 1
28
29 #define BRCTL_GET_VERSION 0
30 #define BRCTL_GET_BRIDGES 1
31 #define BRCTL_ADD_BRIDGE 2
32 #define BRCTL_DEL_BRIDGE 3
33 #define BRCTL_ADD_IF 4
34 #define BRCTL_DEL_IF 5
35 #define BRCTL_GET_BRIDGE_INFO 6
36 #define BRCTL_GET_PORT_LIST 7
37 #define BRCTL_SET_BRIDGE_FORWARD_DELAY 8
38 #define BRCTL_SET_BRIDGE_HELLO_TIME 9
39 #define BRCTL_SET_BRIDGE_MAX_AGE 10
40 #define BRCTL_SET_AGEING_TIME 11
41 #define BRCTL_SET_GC_INTERVAL 12
42 #define BRCTL_GET_PORT_INFO 13
43 #define BRCTL_SET_BRIDGE_STP_STATE 14
44 #define BRCTL_SET_BRIDGE_PRIORITY 15
45 #define BRCTL_SET_PORT_PRIORITY 16
46 #define BRCTL_SET_PATH_COST 17
47 #define BRCTL_GET_FDB_ENTRIES 18
48
49 #define BR_STATE_DISABLED 0
50 #define BR_STATE_LISTENING 1
51 #define BR_STATE_LEARNING 2
52 #define BR_STATE_FORWARDING 3
53 #define BR_STATE_BLOCKING 4
54
55 struct __bridge_info {
56 __u64 designated_root;
57 __u64 bridge_id;
58 __u32 root_path_cost;
59 __u32 max_age;
60 __u32 hello_time;
61 __u32 forward_delay;
62 __u32 bridge_max_age;
63 __u32 bridge_hello_time;
64 __u32 bridge_forward_delay;
65 __u8 topology_change;
66 __u8 topology_change_detected;
67 __u8 root_port;
68 __u8 stp_enabled;
69 __u32 ageing_time;
70 __u32 gc_interval;
71 __u32 hello_timer_value;
72 __u32 tcn_timer_value;
73 __u32 topology_change_timer_value;
74 __u32 gc_timer_value;
75 };
76
77 struct __port_info {
78 __u64 designated_root;
79 __u64 designated_bridge;
80 __u16 port_id;
81 __u16 designated_port;
82 __u32 path_cost;
83 __u32 designated_cost;
84 __u8 state;
85 __u8 top_change_ack;
86 __u8 config_pending;
87 __u8 unused0;
88 __u32 message_age_timer_value;
89 __u32 forward_delay_timer_value;
90 __u32 hold_timer_value;
91 };
92
93 struct __fdb_entry {
94 __u8 mac_addr[ETH_ALEN];
95 __u8 port_no;
96 __u8 is_local;
97 __u32 ageing_timer_value;
98 __u8 port_hi;
99 __u8 pad0;
100 __u16 unused;
101 };
102
103
104 #define BRIDGE_FLAGS_MASTER 1
105 #define BRIDGE_FLAGS_SELF 2
106
107 #define BRIDGE_MODE_VEB 0
108 #define BRIDGE_MODE_VEPA 1
109 #define BRIDGE_MODE_UNDEF 0xFFFF
110
111
112
113
114
115
116
117
118 enum {
119 IFLA_BRIDGE_FLAGS,
120 IFLA_BRIDGE_MODE,
121 IFLA_BRIDGE_VLAN_INFO,
122 IFLA_BRIDGE_VLAN_TUNNEL_INFO,
123 __IFLA_BRIDGE_MAX,
124 };
125 #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
126
127 #define BRIDGE_VLAN_INFO_MASTER (1<<0)
128 #define BRIDGE_VLAN_INFO_PVID (1<<1)
129 #define BRIDGE_VLAN_INFO_UNTAGGED (1<<2)
130 #define BRIDGE_VLAN_INFO_RANGE_BEGIN (1<<3)
131 #define BRIDGE_VLAN_INFO_RANGE_END (1<<4)
132 #define BRIDGE_VLAN_INFO_BRENTRY (1<<5)
133
134 struct bridge_vlan_info {
135 __u16 flags;
136 __u16 vid;
137 };
138
139 enum {
140 IFLA_BRIDGE_VLAN_TUNNEL_UNSPEC,
141 IFLA_BRIDGE_VLAN_TUNNEL_ID,
142 IFLA_BRIDGE_VLAN_TUNNEL_VID,
143 IFLA_BRIDGE_VLAN_TUNNEL_FLAGS,
144 __IFLA_BRIDGE_VLAN_TUNNEL_MAX,
145 };
146
147 #define IFLA_BRIDGE_VLAN_TUNNEL_MAX (__IFLA_BRIDGE_VLAN_TUNNEL_MAX - 1)
148
149 struct bridge_vlan_xstats {
150 __u64 rx_bytes;
151 __u64 rx_packets;
152 __u64 tx_bytes;
153 __u64 tx_packets;
154 __u16 vid;
155 __u16 flags;
156 __u32 pad2;
157 };
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175 enum {
176 MDBA_UNSPEC,
177 MDBA_MDB,
178 MDBA_ROUTER,
179 __MDBA_MAX,
180 };
181 #define MDBA_MAX (__MDBA_MAX - 1)
182
183 enum {
184 MDBA_MDB_UNSPEC,
185 MDBA_MDB_ENTRY,
186 __MDBA_MDB_MAX,
187 };
188 #define MDBA_MDB_MAX (__MDBA_MDB_MAX - 1)
189
190 enum {
191 MDBA_MDB_ENTRY_UNSPEC,
192 MDBA_MDB_ENTRY_INFO,
193 __MDBA_MDB_ENTRY_MAX,
194 };
195 #define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1)
196
197
198 enum {
199 MDBA_MDB_EATTR_UNSPEC,
200 MDBA_MDB_EATTR_TIMER,
201 __MDBA_MDB_EATTR_MAX
202 };
203 #define MDBA_MDB_EATTR_MAX (__MDBA_MDB_EATTR_MAX - 1)
204
205
206 enum {
207 MDB_RTR_TYPE_DISABLED,
208 MDB_RTR_TYPE_TEMP_QUERY,
209 MDB_RTR_TYPE_PERM,
210 MDB_RTR_TYPE_TEMP
211 };
212
213 enum {
214 MDBA_ROUTER_UNSPEC,
215 MDBA_ROUTER_PORT,
216 __MDBA_ROUTER_MAX,
217 };
218 #define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1)
219
220
221 enum {
222 MDBA_ROUTER_PATTR_UNSPEC,
223 MDBA_ROUTER_PATTR_TIMER,
224 MDBA_ROUTER_PATTR_TYPE,
225 __MDBA_ROUTER_PATTR_MAX
226 };
227 #define MDBA_ROUTER_PATTR_MAX (__MDBA_ROUTER_PATTR_MAX - 1)
228
229 struct br_port_msg {
230 __u8 family;
231 __u32 ifindex;
232 };
233
234 struct br_mdb_entry {
235 __u32 ifindex;
236 #define MDB_TEMPORARY 0
237 #define MDB_PERMANENT 1
238 __u8 state;
239 #define MDB_FLAGS_OFFLOAD (1 << 0)
240 #define MDB_FLAGS_FAST_LEAVE (1 << 1)
241 __u8 flags;
242 __u16 vid;
243 struct {
244 union {
245 __be32 ip4;
246 struct in6_addr ip6;
247 } u;
248 __be16 proto;
249 } addr;
250 };
251
252 enum {
253 MDBA_SET_ENTRY_UNSPEC,
254 MDBA_SET_ENTRY,
255 __MDBA_SET_ENTRY_MAX,
256 };
257 #define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1)
258
259
260 enum {
261 BRIDGE_XSTATS_UNSPEC,
262 BRIDGE_XSTATS_VLAN,
263 BRIDGE_XSTATS_MCAST,
264 BRIDGE_XSTATS_PAD,
265 __BRIDGE_XSTATS_MAX
266 };
267 #define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1)
268
269 enum {
270 BR_MCAST_DIR_RX,
271 BR_MCAST_DIR_TX,
272 BR_MCAST_DIR_SIZE
273 };
274
275
276 struct br_mcast_stats {
277 __u64 igmp_v1queries[BR_MCAST_DIR_SIZE];
278 __u64 igmp_v2queries[BR_MCAST_DIR_SIZE];
279 __u64 igmp_v3queries[BR_MCAST_DIR_SIZE];
280 __u64 igmp_leaves[BR_MCAST_DIR_SIZE];
281 __u64 igmp_v1reports[BR_MCAST_DIR_SIZE];
282 __u64 igmp_v2reports[BR_MCAST_DIR_SIZE];
283 __u64 igmp_v3reports[BR_MCAST_DIR_SIZE];
284 __u64 igmp_parse_errors;
285
286 __u64 mld_v1queries[BR_MCAST_DIR_SIZE];
287 __u64 mld_v2queries[BR_MCAST_DIR_SIZE];
288 __u64 mld_leaves[BR_MCAST_DIR_SIZE];
289 __u64 mld_v1reports[BR_MCAST_DIR_SIZE];
290 __u64 mld_v2reports[BR_MCAST_DIR_SIZE];
291 __u64 mld_parse_errors;
292
293 __u64 mcast_bytes[BR_MCAST_DIR_SIZE];
294 __u64 mcast_packets[BR_MCAST_DIR_SIZE];
295 };
296
297
298
299
300
301
302
303 enum br_boolopt_id {
304 BR_BOOLOPT_NO_LL_LEARN,
305 BR_BOOLOPT_MAX
306 };
307
308
309
310
311
312
313 struct br_boolopt_multi {
314 __u32 optval;
315 __u32 optmask;
316 };
317 #endif