]>
Commit | Line | Data |
---|---|---|
28d84b42 JP |
1 | /* |
2 | * iplink_bridge.c Bridge device support | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or | |
5 | * modify it under the terms of the GNU General Public License | |
6 | * as published by the Free Software Foundation; either version | |
7 | * 2 of the License, or (at your option) any later version. | |
8 | * | |
9 | * Authors: Jiri Pirko <jiri@resnulli.us> | |
10 | */ | |
11 | ||
12 | #include <stdio.h> | |
13 | #include <stdlib.h> | |
14 | #include <string.h> | |
15 | #include <linux/if_link.h> | |
70dfb0b8 | 16 | #include <netinet/ether.h> |
28d84b42 | 17 | |
1eea5c46 | 18 | #include "rt_names.h" |
28d84b42 JP |
19 | #include "utils.h" |
20 | #include "ip_common.h" | |
21 | ||
43367ef7 | 22 | static void print_explain(FILE *f) |
28d84b42 | 23 | { |
43367ef7 | 24 | fprintf(f, |
28d84b42 JP |
25 | "Usage: ... bridge [ forward_delay FORWARD_DELAY ]\n" |
26 | " [ hello_time HELLO_TIME ]\n" | |
27 | " [ max_age MAX_AGE ]\n" | |
6c99fb60 | 28 | " [ ageing_time AGEING_TIME ]\n" |
dab04962 | 29 | " [ stp_state STP_STATE ]\n" |
b0197a04 | 30 | " [ priority PRIORITY ]\n" |
8caaf33b | 31 | " [ group_fwd_mask MASK ]\n" |
0a61aa39 | 32 | " [ group_address ADDRESS ]\n" |
e4d456f0 | 33 | " [ vlan_filtering VLAN_FILTERING ]\n" |
1eea5c46 | 34 | " [ vlan_protocol VLAN_PROTOCOL ]\n" |
719832af | 35 | " [ vlan_default_pvid VLAN_DEFAULT_PVID ]\n" |
7ddd2d94 | 36 | " [ mcast_snooping MULTICAST_SNOOPING ]\n" |
963d137c | 37 | " [ mcast_router MULTICAST_ROUTER ]\n" |
449843d1 | 38 | " [ mcast_query_use_ifaddr MCAST_QUERY_USE_IFADDR ]\n" |
0778b741 | 39 | " [ mcast_querier MULTICAST_QUERIER ]\n" |
92c0ef70 | 40 | " [ mcast_hash_elasticity HASH_ELASTICITY ]\n" |
8b9eb7cd | 41 | " [ mcast_hash_max HASH_MAX ]\n" |
fb44cadb | 42 | " [ mcast_last_member_count LAST_MEMBER_COUNT ]\n" |
ceb64866 | 43 | " [ mcast_startup_query_count STARTUP_QUERY_COUNT ]\n" |
10082a25 | 44 | " [ mcast_last_member_interval LAST_MEMBER_INTERVAL ]\n" |
7f3d5592 | 45 | " [ mcast_membership_interval MEMBERSHIP_INTERVAL ]\n" |
1f2244b8 | 46 | " [ mcast_querier_interval QUERIER_INTERVAL ]\n" |
5a32388f | 47 | " [ mcast_query_interval QUERY_INTERVAL ]\n" |
483df11c | 48 | " [ mcast_query_response_interval QUERY_RESPONSE_INTERVAL ]\n" |
178b1806 | 49 | " [ mcast_startup_query_interval STARTUP_QUERY_INTERVAL ]\n" |
1eea5c46 TM |
50 | "\n" |
51 | "Where: VLAN_PROTOCOL := { 802.1Q | 802.1ad }\n" | |
28d84b42 JP |
52 | ); |
53 | } | |
54 | ||
43367ef7 ZS |
55 | static void explain(void) |
56 | { | |
57 | print_explain(stderr); | |
58 | } | |
59 | ||
70dfb0b8 NA |
60 | static void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, |
61 | size_t len) | |
62 | { | |
63 | char eaddr[32]; | |
64 | ||
65 | ether_ntoa_r((const struct ether_addr *)id->addr, eaddr); | |
66 | snprintf(buf, len, "%.2x%.2x.%s", id->prio[0], id->prio[1], eaddr); | |
67 | } | |
68 | ||
28d84b42 JP |
69 | static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, |
70 | struct nlmsghdr *n) | |
71 | { | |
72 | __u32 val; | |
73 | ||
74 | while (argc > 0) { | |
75 | if (matches(*argv, "forward_delay") == 0) { | |
76 | NEXT_ARG(); | |
6a9ce30e | 77 | if (get_u32(&val, *argv, 0)) |
28d84b42 | 78 | invarg("invalid forward_delay", *argv); |
6a9ce30e | 79 | |
28d84b42 JP |
80 | addattr32(n, 1024, IFLA_BR_FORWARD_DELAY, val); |
81 | } else if (matches(*argv, "hello_time") == 0) { | |
82 | NEXT_ARG(); | |
6a9ce30e | 83 | if (get_u32(&val, *argv, 0)) |
28d84b42 | 84 | invarg("invalid hello_time", *argv); |
6a9ce30e | 85 | |
28d84b42 JP |
86 | addattr32(n, 1024, IFLA_BR_HELLO_TIME, val); |
87 | } else if (matches(*argv, "max_age") == 0) { | |
88 | NEXT_ARG(); | |
6a9ce30e | 89 | if (get_u32(&val, *argv, 0)) |
28d84b42 | 90 | invarg("invalid max_age", *argv); |
6a9ce30e | 91 | |
28d84b42 | 92 | addattr32(n, 1024, IFLA_BR_MAX_AGE, val); |
6c99fb60 NA |
93 | } else if (matches(*argv, "ageing_time") == 0) { |
94 | NEXT_ARG(); | |
6a9ce30e | 95 | if (get_u32(&val, *argv, 0)) |
6c99fb60 | 96 | invarg("invalid ageing_time", *argv); |
6a9ce30e | 97 | |
6c99fb60 | 98 | addattr32(n, 1024, IFLA_BR_AGEING_TIME, val); |
dab04962 NA |
99 | } else if (matches(*argv, "stp_state") == 0) { |
100 | NEXT_ARG(); | |
6a9ce30e | 101 | if (get_u32(&val, *argv, 0)) |
dab04962 | 102 | invarg("invalid stp_state", *argv); |
6a9ce30e | 103 | |
dab04962 | 104 | addattr32(n, 1024, IFLA_BR_STP_STATE, val); |
b0197a04 NA |
105 | } else if (matches(*argv, "priority") == 0) { |
106 | __u16 prio; | |
107 | ||
108 | NEXT_ARG(); | |
6a9ce30e | 109 | if (get_u16(&prio, *argv, 0)) |
b0197a04 | 110 | invarg("invalid priority", *argv); |
6a9ce30e | 111 | |
b0197a04 | 112 | addattr16(n, 1024, IFLA_BR_PRIORITY, prio); |
e4d456f0 NA |
113 | } else if (matches(*argv, "vlan_filtering") == 0) { |
114 | __u8 vlan_filter; | |
115 | ||
116 | NEXT_ARG(); | |
117 | if (get_u8(&vlan_filter, *argv, 0)) { | |
118 | invarg("invalid vlan_filtering", *argv); | |
119 | return -1; | |
120 | } | |
121 | addattr8(n, 1024, IFLA_BR_VLAN_FILTERING, vlan_filter); | |
1eea5c46 TM |
122 | } else if (matches(*argv, "vlan_protocol") == 0) { |
123 | __u16 vlan_proto; | |
124 | ||
125 | NEXT_ARG(); | |
126 | if (ll_proto_a2n(&vlan_proto, *argv)) { | |
127 | invarg("invalid vlan_protocol", *argv); | |
128 | return -1; | |
129 | } | |
130 | addattr16(n, 1024, IFLA_BR_VLAN_PROTOCOL, vlan_proto); | |
8caaf33b NA |
131 | } else if (matches(*argv, "group_fwd_mask") == 0) { |
132 | __u16 fwd_mask; | |
133 | ||
134 | NEXT_ARG(); | |
135 | if (get_u16(&fwd_mask, *argv, 0)) | |
136 | invarg("invalid group_fwd_mask", *argv); | |
137 | ||
138 | addattr16(n, 1024, IFLA_BR_GROUP_FWD_MASK, fwd_mask); | |
0a61aa39 NA |
139 | } else if (matches(*argv, "group_address") == 0) { |
140 | char llabuf[32]; | |
141 | int len; | |
142 | ||
143 | NEXT_ARG(); | |
144 | len = ll_addr_a2n(llabuf, sizeof(llabuf), *argv); | |
145 | if (len < 0) | |
146 | return -1; | |
147 | addattr_l(n, 1024, IFLA_BR_GROUP_ADDR, llabuf, len); | |
719832af NA |
148 | } else if (matches(*argv, "vlan_default_pvid") == 0) { |
149 | __u16 default_pvid; | |
150 | ||
151 | NEXT_ARG(); | |
152 | if (get_u16(&default_pvid, *argv, 0)) | |
153 | invarg("invalid vlan_default_pvid", *argv); | |
154 | ||
155 | addattr16(n, 1024, IFLA_BR_VLAN_DEFAULT_PVID, | |
156 | default_pvid); | |
963d137c NA |
157 | } else if (matches(*argv, "mcast_router") == 0) { |
158 | __u8 mcast_router; | |
159 | ||
160 | NEXT_ARG(); | |
161 | if (get_u8(&mcast_router, *argv, 0)) | |
162 | invarg("invalid mcast_router", *argv); | |
163 | ||
164 | addattr8(n, 1024, IFLA_BR_MCAST_ROUTER, mcast_router); | |
7ddd2d94 NA |
165 | } else if (matches(*argv, "mcast_snooping") == 0) { |
166 | __u8 mcast_snoop; | |
167 | ||
168 | NEXT_ARG(); | |
169 | if (get_u8(&mcast_snoop, *argv, 0)) | |
170 | invarg("invalid mcast_snooping", *argv); | |
171 | ||
172 | addattr8(n, 1024, IFLA_BR_MCAST_SNOOPING, mcast_snoop); | |
449843d1 NA |
173 | } else if (matches(*argv, "mcast_query_use_ifaddr") == 0) { |
174 | __u8 mcast_qui; | |
175 | ||
176 | NEXT_ARG(); | |
177 | if (get_u8(&mcast_qui, *argv, 0)) | |
178 | invarg("invalid mcast_query_use_ifaddr", | |
179 | *argv); | |
180 | ||
181 | addattr8(n, 1024, IFLA_BR_MCAST_QUERY_USE_IFADDR, | |
182 | mcast_qui); | |
0778b741 NA |
183 | } else if (matches(*argv, "mcast_querier") == 0) { |
184 | __u8 mcast_querier; | |
185 | ||
186 | NEXT_ARG(); | |
187 | if (get_u8(&mcast_querier, *argv, 0)) | |
188 | invarg("invalid mcast_querier", *argv); | |
189 | ||
190 | addattr8(n, 1024, IFLA_BR_MCAST_QUERIER, mcast_querier); | |
92c0ef70 NA |
191 | } else if (matches(*argv, "mcast_hash_elasticity") == 0) { |
192 | __u32 mcast_hash_el; | |
193 | ||
194 | NEXT_ARG(); | |
195 | if (get_u32(&mcast_hash_el, *argv, 0)) | |
196 | invarg("invalid mcast_hash_elasticity", | |
197 | *argv); | |
198 | ||
199 | addattr32(n, 1024, IFLA_BR_MCAST_HASH_ELASTICITY, | |
200 | mcast_hash_el); | |
8b9eb7cd NA |
201 | } else if (matches(*argv, "mcast_hash_max") == 0) { |
202 | __u32 mcast_hash_max; | |
203 | ||
204 | NEXT_ARG(); | |
205 | if (get_u32(&mcast_hash_max, *argv, 0)) | |
206 | invarg("invalid mcast_hash_max", *argv); | |
207 | ||
208 | addattr32(n, 1024, IFLA_BR_MCAST_HASH_MAX, | |
209 | mcast_hash_max); | |
fb44cadb NA |
210 | } else if (matches(*argv, "mcast_last_member_count") == 0) { |
211 | __u32 mcast_lmc; | |
212 | ||
213 | NEXT_ARG(); | |
214 | if (get_u32(&mcast_lmc, *argv, 0)) | |
215 | invarg("invalid mcast_last_member_count", | |
216 | *argv); | |
217 | ||
218 | addattr32(n, 1024, IFLA_BR_MCAST_LAST_MEMBER_CNT, | |
219 | mcast_lmc); | |
ceb64866 NA |
220 | } else if (matches(*argv, "mcast_startup_query_count") == 0) { |
221 | __u32 mcast_sqc; | |
222 | ||
223 | NEXT_ARG(); | |
224 | if (get_u32(&mcast_sqc, *argv, 0)) | |
225 | invarg("invalid mcast_startup_query_count", | |
226 | *argv); | |
227 | ||
228 | addattr32(n, 1024, IFLA_BR_MCAST_STARTUP_QUERY_CNT, | |
229 | mcast_sqc); | |
10082a25 NA |
230 | } else if (matches(*argv, "mcast_last_member_interval") == 0) { |
231 | __u64 mcast_last_member_intvl; | |
232 | ||
233 | NEXT_ARG(); | |
234 | if (get_u64(&mcast_last_member_intvl, *argv, 0)) | |
235 | invarg("invalid mcast_last_member_interval", | |
236 | *argv); | |
237 | ||
238 | addattr64(n, 1024, IFLA_BR_MCAST_LAST_MEMBER_INTVL, | |
239 | mcast_last_member_intvl); | |
7f3d5592 NA |
240 | } else if (matches(*argv, "mcast_membership_interval") == 0) { |
241 | __u64 mcast_membership_intvl; | |
242 | ||
243 | NEXT_ARG(); | |
244 | if (get_u64(&mcast_membership_intvl, *argv, 0)) { | |
245 | invarg("invalid mcast_membership_interval", | |
246 | *argv); | |
247 | return -1; | |
248 | } | |
249 | addattr64(n, 1024, IFLA_BR_MCAST_MEMBERSHIP_INTVL, | |
250 | mcast_membership_intvl); | |
1f2244b8 NA |
251 | } else if (matches(*argv, "mcast_querier_interval") == 0) { |
252 | __u64 mcast_querier_intvl; | |
253 | ||
254 | NEXT_ARG(); | |
255 | if (get_u64(&mcast_querier_intvl, *argv, 0)) { | |
256 | invarg("invalid mcast_querier_interval", | |
257 | *argv); | |
258 | return -1; | |
259 | } | |
260 | addattr64(n, 1024, IFLA_BR_MCAST_QUERIER_INTVL, | |
261 | mcast_querier_intvl); | |
5a32388f NA |
262 | } else if (matches(*argv, "mcast_query_interval") == 0) { |
263 | __u64 mcast_query_intvl; | |
264 | ||
265 | NEXT_ARG(); | |
266 | if (get_u64(&mcast_query_intvl, *argv, 0)) { | |
267 | invarg("invalid mcast_query_interval", | |
268 | *argv); | |
269 | return -1; | |
270 | } | |
271 | addattr64(n, 1024, IFLA_BR_MCAST_QUERY_INTVL, | |
272 | mcast_query_intvl); | |
483df11c NA |
273 | } else if (!matches(*argv, "mcast_query_response_interval")) { |
274 | __u64 mcast_query_resp_intvl; | |
275 | ||
276 | NEXT_ARG(); | |
277 | if (get_u64(&mcast_query_resp_intvl, *argv, 0)) { | |
278 | invarg("invalid mcast_query_response_interval", | |
279 | *argv); | |
280 | return -1; | |
281 | } | |
282 | addattr64(n, 1024, IFLA_BR_MCAST_QUERY_RESPONSE_INTVL, | |
283 | mcast_query_resp_intvl); | |
178b1806 NA |
284 | } else if (!matches(*argv, "mcast_startup_query_interval")) { |
285 | __u64 mcast_startup_query_intvl; | |
286 | ||
287 | NEXT_ARG(); | |
288 | if (get_u64(&mcast_startup_query_intvl, *argv, 0)) { | |
289 | invarg("invalid mcast_startup_query_interval", | |
290 | *argv); | |
291 | return -1; | |
292 | } | |
293 | addattr64(n, 1024, IFLA_BR_MCAST_STARTUP_QUERY_INTVL, | |
294 | mcast_startup_query_intvl); | |
28d84b42 JP |
295 | } else if (matches(*argv, "help") == 0) { |
296 | explain(); | |
297 | return -1; | |
298 | } else { | |
299 | fprintf(stderr, "bridge: unknown command \"%s\"?\n", *argv); | |
300 | explain(); | |
301 | return -1; | |
302 | } | |
303 | argc--, argv++; | |
304 | } | |
305 | ||
306 | return 0; | |
307 | } | |
308 | ||
309 | static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) | |
310 | { | |
311 | if (!tb) | |
312 | return; | |
313 | ||
314 | if (tb[IFLA_BR_FORWARD_DELAY]) | |
315 | fprintf(f, "forward_delay %u ", | |
316 | rta_getattr_u32(tb[IFLA_BR_FORWARD_DELAY])); | |
317 | ||
318 | if (tb[IFLA_BR_HELLO_TIME]) | |
319 | fprintf(f, "hello_time %u ", | |
320 | rta_getattr_u32(tb[IFLA_BR_HELLO_TIME])); | |
321 | ||
322 | if (tb[IFLA_BR_MAX_AGE]) | |
323 | fprintf(f, "max_age %u ", | |
324 | rta_getattr_u32(tb[IFLA_BR_MAX_AGE])); | |
fdba0515 NA |
325 | |
326 | if (tb[IFLA_BR_AGEING_TIME]) | |
327 | fprintf(f, "ageing_time %u ", | |
328 | rta_getattr_u32(tb[IFLA_BR_AGEING_TIME])); | |
329 | ||
330 | if (tb[IFLA_BR_STP_STATE]) | |
331 | fprintf(f, "stp_state %u ", | |
332 | rta_getattr_u32(tb[IFLA_BR_STP_STATE])); | |
333 | ||
334 | if (tb[IFLA_BR_PRIORITY]) | |
335 | fprintf(f, "priority %u ", | |
336 | rta_getattr_u16(tb[IFLA_BR_PRIORITY])); | |
e4d456f0 NA |
337 | |
338 | if (tb[IFLA_BR_VLAN_FILTERING]) | |
339 | fprintf(f, "vlan_filtering %u ", | |
340 | rta_getattr_u8(tb[IFLA_BR_VLAN_FILTERING])); | |
1eea5c46 TM |
341 | |
342 | if (tb[IFLA_BR_VLAN_PROTOCOL]) { | |
343 | SPRINT_BUF(b1); | |
344 | ||
345 | fprintf(f, "vlan_protocol %s ", | |
346 | ll_proto_n2a(rta_getattr_u16(tb[IFLA_BR_VLAN_PROTOCOL]), | |
347 | b1, sizeof(b1))); | |
348 | } | |
70dfb0b8 NA |
349 | |
350 | if (tb[IFLA_BR_BRIDGE_ID]) { | |
351 | char bridge_id[32]; | |
352 | ||
353 | br_dump_bridge_id(RTA_DATA(tb[IFLA_BR_BRIDGE_ID]), bridge_id, | |
354 | sizeof(bridge_id)); | |
355 | fprintf(f, "bridge_id %s ", bridge_id); | |
356 | } | |
357 | ||
358 | if (tb[IFLA_BR_ROOT_ID]) { | |
359 | char root_id[32]; | |
360 | ||
361 | br_dump_bridge_id(RTA_DATA(tb[IFLA_BR_BRIDGE_ID]), root_id, | |
362 | sizeof(root_id)); | |
363 | fprintf(f, "designated_root %s ", root_id); | |
364 | } | |
4e3bbc66 NA |
365 | |
366 | if (tb[IFLA_BR_ROOT_PORT]) | |
367 | fprintf(f, "root_port %u ", | |
368 | rta_getattr_u16(tb[IFLA_BR_ROOT_PORT])); | |
369 | ||
370 | if (tb[IFLA_BR_ROOT_PATH_COST]) | |
371 | fprintf(f, "root_path_cost %u ", | |
372 | rta_getattr_u32(tb[IFLA_BR_ROOT_PATH_COST])); | |
373 | ||
374 | if (tb[IFLA_BR_TOPOLOGY_CHANGE]) | |
375 | fprintf(f, "topology_change %u ", | |
376 | rta_getattr_u8(tb[IFLA_BR_TOPOLOGY_CHANGE])); | |
377 | ||
378 | if (tb[IFLA_BR_TOPOLOGY_CHANGE_DETECTED]) | |
379 | fprintf(f, "topology_change_detected %u ", | |
380 | rta_getattr_u8(tb[IFLA_BR_TOPOLOGY_CHANGE_DETECTED])); | |
8c0f7a16 NA |
381 | |
382 | if (tb[IFLA_BR_HELLO_TIMER]) { | |
383 | struct timeval tv; | |
384 | ||
385 | __jiffies_to_tv(&tv, rta_getattr_u64(tb[IFLA_BR_HELLO_TIMER])); | |
386 | fprintf(f, "hello_timer %4i.%.2i ", (int)tv.tv_sec, | |
387 | (int)tv.tv_usec/10000); | |
388 | } | |
389 | ||
390 | if (tb[IFLA_BR_TCN_TIMER]) { | |
391 | struct timeval tv; | |
392 | ||
393 | __jiffies_to_tv(&tv, rta_getattr_u64(tb[IFLA_BR_TCN_TIMER])); | |
394 | fprintf(f, "tcn_timer %4i.%.2i ", (int)tv.tv_sec, | |
395 | (int)tv.tv_usec/10000); | |
396 | } | |
397 | ||
398 | if (tb[IFLA_BR_TOPOLOGY_CHANGE_TIMER]) { | |
399 | unsigned long jiffies; | |
400 | struct timeval tv; | |
401 | ||
402 | jiffies = rta_getattr_u64(tb[IFLA_BR_TOPOLOGY_CHANGE_TIMER]); | |
403 | __jiffies_to_tv(&tv, jiffies); | |
404 | fprintf(f, "topology_change_timer %4i.%.2i ", (int)tv.tv_sec, | |
405 | (int)tv.tv_usec/10000); | |
406 | } | |
407 | ||
408 | if (tb[IFLA_BR_GC_TIMER]) { | |
409 | struct timeval tv; | |
410 | ||
411 | __jiffies_to_tv(&tv, rta_getattr_u64(tb[IFLA_BR_GC_TIMER])); | |
412 | fprintf(f, "gc_timer %4i.%.2i ", (int)tv.tv_sec, | |
413 | (int)tv.tv_usec/10000); | |
414 | } | |
8caaf33b | 415 | |
719832af NA |
416 | if (tb[IFLA_BR_VLAN_DEFAULT_PVID]) |
417 | fprintf(f, "vlan_default_pvid %u ", | |
418 | rta_getattr_u16(tb[IFLA_BR_VLAN_DEFAULT_PVID])); | |
419 | ||
8caaf33b NA |
420 | if (tb[IFLA_BR_GROUP_FWD_MASK]) |
421 | fprintf(f, "group_fwd_mask %#x ", | |
422 | rta_getattr_u16(tb[IFLA_BR_GROUP_FWD_MASK])); | |
0a61aa39 NA |
423 | |
424 | if (tb[IFLA_BR_GROUP_ADDR]) { | |
425 | SPRINT_BUF(mac); | |
426 | ||
427 | fprintf(f, "group_address %s ", | |
428 | ll_addr_n2a(RTA_DATA(tb[IFLA_BR_GROUP_ADDR]), | |
429 | RTA_PAYLOAD(tb[IFLA_BR_GROUP_ADDR]), | |
430 | 1 /*ARPHDR_ETHER*/, mac, sizeof(mac))); | |
431 | } | |
963d137c | 432 | |
7ddd2d94 NA |
433 | if (tb[IFLA_BR_MCAST_SNOOPING]) |
434 | fprintf(f, "mcast_snooping %u ", | |
435 | rta_getattr_u8(tb[IFLA_BR_MCAST_SNOOPING])); | |
436 | ||
963d137c NA |
437 | if (tb[IFLA_BR_MCAST_ROUTER]) |
438 | fprintf(f, "mcast_router %u ", | |
439 | rta_getattr_u8(tb[IFLA_BR_MCAST_ROUTER])); | |
449843d1 NA |
440 | |
441 | if (tb[IFLA_BR_MCAST_QUERY_USE_IFADDR]) | |
442 | fprintf(f, "mcast_query_use_ifaddr %u ", | |
443 | rta_getattr_u8(tb[IFLA_BR_MCAST_QUERY_USE_IFADDR])); | |
0778b741 NA |
444 | |
445 | if (tb[IFLA_BR_MCAST_QUERIER]) | |
446 | fprintf(f, "mcast_querier %u ", | |
447 | rta_getattr_u8(tb[IFLA_BR_MCAST_QUERIER])); | |
92c0ef70 NA |
448 | |
449 | if (tb[IFLA_BR_MCAST_HASH_ELASTICITY]) | |
450 | fprintf(f, "mcast_hash_elasticity %u ", | |
451 | rta_getattr_u32(tb[IFLA_BR_MCAST_HASH_ELASTICITY])); | |
8b9eb7cd NA |
452 | |
453 | if (tb[IFLA_BR_MCAST_HASH_MAX]) | |
454 | fprintf(f, "mcast_hash_max %u ", | |
455 | rta_getattr_u32(tb[IFLA_BR_MCAST_HASH_MAX])); | |
fb44cadb NA |
456 | |
457 | if (tb[IFLA_BR_MCAST_LAST_MEMBER_CNT]) | |
458 | fprintf(f, "mcast_last_member_count %u ", | |
459 | rta_getattr_u32(tb[IFLA_BR_MCAST_LAST_MEMBER_CNT])); | |
ceb64866 NA |
460 | |
461 | if (tb[IFLA_BR_MCAST_STARTUP_QUERY_CNT]) | |
462 | fprintf(f, "mcast_startup_query_count %u ", | |
463 | rta_getattr_u32(tb[IFLA_BR_MCAST_STARTUP_QUERY_CNT])); | |
10082a25 NA |
464 | |
465 | if (tb[IFLA_BR_MCAST_LAST_MEMBER_INTVL]) | |
466 | fprintf(f, "mcast_last_member_interval %llu ", | |
467 | rta_getattr_u64(tb[IFLA_BR_MCAST_LAST_MEMBER_INTVL])); | |
7f3d5592 NA |
468 | |
469 | if (tb[IFLA_BR_MCAST_MEMBERSHIP_INTVL]) | |
470 | fprintf(f, "mcast_membership_interval %llu ", | |
471 | rta_getattr_u64(tb[IFLA_BR_MCAST_MEMBERSHIP_INTVL])); | |
1f2244b8 NA |
472 | |
473 | if (tb[IFLA_BR_MCAST_QUERIER_INTVL]) | |
474 | fprintf(f, "mcast_querier_interval %llu ", | |
475 | rta_getattr_u64(tb[IFLA_BR_MCAST_QUERIER_INTVL])); | |
5a32388f NA |
476 | |
477 | if (tb[IFLA_BR_MCAST_QUERY_INTVL]) | |
478 | fprintf(f, "mcast_query_interval %llu ", | |
479 | rta_getattr_u64(tb[IFLA_BR_MCAST_QUERY_INTVL])); | |
483df11c NA |
480 | |
481 | if (tb[IFLA_BR_MCAST_QUERY_RESPONSE_INTVL]) | |
482 | fprintf(f, "mcast_query_response_interval %llu ", | |
483 | rta_getattr_u64(tb[IFLA_BR_MCAST_QUERY_RESPONSE_INTVL])); | |
178b1806 NA |
484 | |
485 | if (tb[IFLA_BR_MCAST_STARTUP_QUERY_INTVL]) | |
486 | fprintf(f, "mcast_startup_query_interval %llu ", | |
487 | rta_getattr_u64(tb[IFLA_BR_MCAST_STARTUP_QUERY_INTVL])); | |
28d84b42 JP |
488 | } |
489 | ||
43367ef7 ZS |
490 | static void bridge_print_help(struct link_util *lu, int argc, char **argv, |
491 | FILE *f) | |
492 | { | |
493 | print_explain(f); | |
494 | } | |
495 | ||
28d84b42 JP |
496 | struct link_util bridge_link_util = { |
497 | .id = "bridge", | |
498 | .maxattr = IFLA_BR_MAX, | |
499 | .parse_opt = bridge_parse_opt, | |
500 | .print_opt = bridge_print_opt, | |
43367ef7 | 501 | .print_help = bridge_print_help, |
28d84b42 | 502 | }; |