]>
git.saurik.com Git - apple/network_cmds.git/blob - ifconfig.tproj/ifbridge.c
2 * Copyright 2001 Wasabi Systems, Inc.
5 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed for the NetBSD Project by
18 * Wasabi Systems, Inc.
19 * 4. The name of Wasabi Systems, Inc. may not be used to endorse
20 * or promote products derived from this software without specific prior
23 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
27 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
37 static const char rcsid
[] =
38 "$FreeBSD: src/sbin/ifconfig/ifbridge.c,v 1.11.2.1.2.1 2008/11/25 02:59:29 kensmith Exp $";
41 #include <sys/param.h>
42 #include <sys/ioctl.h>
43 #include <sys/socket.h>
44 #include <sys/sockio.h>
49 #include <net/ethernet.h>
51 #include <net/if_bridgevar.h>
52 #include <net/route.h>
64 #define PV2ID(pv, epri, eaddr) do { \
66 eaddr[0] = pv >> 40; \
67 eaddr[1] = pv >> 32; \
68 eaddr[2] = pv >> 24; \
69 eaddr[3] = pv >> 16; \
74 static const char *stpstates
[] = {
83 static const char *stpproto
[] = {
88 static const char *stproles
[] = {
98 get_val(const char *cp
, u_long
*valp
)
104 val
= strtoul(cp
, &endptr
, 0);
105 if (cp
[0] == '\0' || endptr
[0] != '\0' || errno
== ERANGE
)
113 do_cmd(int sock
, u_long op
, void *arg
, size_t argsize
, int set
)
117 memset(&ifd
, 0, sizeof(ifd
));
119 strlcpy(ifd
.ifd_name
, ifr
.ifr_name
, sizeof(ifd
.ifd_name
));
121 ifd
.ifd_len
= argsize
;
124 return (ioctl(sock
, set
? SIOCSDRVSPEC
: SIOCGDRVSPEC
, &ifd
));
128 do_bridgeflag(int sock
, const char *ifs
, int flag
, int set
)
132 strlcpy(req
.ifbr_ifsname
, ifs
, sizeof(req
.ifbr_ifsname
));
134 if (do_cmd(sock
, BRDGGIFFLGS
, &req
, sizeof(req
), 0) < 0)
135 err(1, "unable to get bridge flags");
138 req
.ifbr_ifsflags
|= flag
;
140 req
.ifbr_ifsflags
&= ~flag
;
142 if (do_cmd(sock
, BRDGSIFFLGS
, &req
, sizeof(req
), 1) < 0)
143 err(1, "unable to set bridge flags");
147 bridge_interfaces(int s
, const char *prefix
)
149 struct ifbifconf bifc
;
151 char *inbuf
= NULL
, *ninbuf
;
155 pad
= strdup(prefix
);
158 /* replace the prefix with whitespace */
159 for (p
= pad
; *p
!= '\0'; p
++) {
165 ninbuf
= realloc(inbuf
, len
);
167 err(1, "unable to allocate interface buffer");
168 bifc
.ifbic_len
= len
;
169 bifc
.ifbic_buf
= inbuf
= ninbuf
;
170 if (do_cmd(s
, BRDGGIFS
, &bifc
, sizeof(bifc
), 0) < 0)
171 err(1, "unable to get interface list");
172 if ((bifc
.ifbic_len
+ sizeof(*req
)) < len
)
177 for (i
= 0; i
< bifc
.ifbic_len
/ sizeof(*req
); i
++) {
178 req
= bifc
.ifbic_req
+ i
;
179 printf("%s%s ", prefix
, req
->ifbr_ifsname
);
180 printb("flags", req
->ifbr_ifsflags
, IFBIFBITS
);
185 printf("ifmaxaddr %u", req
->ifbr_addrmax
);
187 printf(" port %u priority %u", req
->ifbr_portno
,
189 printf(" path cost %u", req
->ifbr_path_cost
);
191 if (req
->ifbr_ifsflags
& IFBIF_STP
) {
193 if (req
->ifbr_proto
<
194 sizeof(stpproto
) / sizeof(stpproto
[0]))
195 printf(" proto %s", stpproto
[req
->ifbr_proto
]);
197 printf(" <unknown proto %d>",
202 sizeof(stproles
) / sizeof(stproles
[0]))
203 printf("role %s", stproles
[req
->ifbr_role
]);
205 printf("<unknown role %d>",
208 if (req
->ifbr_state
<
209 sizeof(stpstates
) / sizeof(stpstates
[0]))
210 printf(" state %s", stpstates
[req
->ifbr_state
]);
212 printf(" <unknown state %d>",
222 bridge_addresses(int s
, const char *prefix
)
224 struct ifbaconf ifbac
;
225 struct ifbareq
*ifba
;
226 char *inbuf
= NULL
, *ninbuf
;
228 struct ether_addr ea
;
231 ninbuf
= realloc(inbuf
, len
);
233 err(1, "unable to allocate address buffer");
234 ifbac
.ifbac_len
= len
;
235 ifbac
.ifbac_buf
= inbuf
= ninbuf
;
236 if (do_cmd(s
, BRDGRTS
, &ifbac
, sizeof(ifbac
), 0) < 0)
237 err(1, "unable to get address cache");
238 if ((ifbac
.ifbac_len
+ sizeof(*ifba
)) < len
)
243 for (i
= 0; i
< ifbac
.ifbac_len
/ sizeof(*ifba
); i
++) {
244 ifba
= ifbac
.ifbac_req
+ i
;
245 memcpy(ea
.octet
, ifba
->ifba_dst
,
248 printf("%s%s Vlan%d %s %lu ", prefix
, ether_ntoa(&ea
),
249 ifba
->ifba_vlan
, ifba
->ifba_ifsname
, ifba
->ifba_expire
);
251 printf("%s%s %s %lu ", prefix
, ether_ntoa(&ea
),
252 ifba
->ifba_ifsname
, ifba
->ifba_expire
);
254 printb("flags", ifba
->ifba_flags
, IFBAFBITS
);
262 show_config(int sock
, const char *prefix
)
264 struct ifbrparam param
;
269 if (do_cmd(sock
, BRDGGPRI
, ¶m
, sizeof(param
), 0) < 0)
270 err(1, "unable to get bridge priority");
271 pri
= param
.ifbrp_prio
;
273 if (do_cmd(sock
, BRDGGHT
, ¶m
, sizeof(param
), 0) < 0)
274 err(1, "unable to get hellotime");
275 ht
= param
.ifbrp_hellotime
;
277 if (do_cmd(sock
, BRDGGFD
, ¶m
, sizeof(param
), 0) < 0)
278 err(1, "unable to get forward delay");
279 fd
= param
.ifbrp_fwddelay
;
281 if (do_cmd(sock
, BRDGGMA
, ¶m
, sizeof(param
), 0) < 0)
282 err(1, "unable to get max age");
283 ma
= param
.ifbrp_maxage
;
285 printf("%spriority %u hellotime %u fwddelay %u maxage %u\n",
286 prefix
, pri
, ht
, fd
, ma
);
288 if (do_cmd(sock
, BRDGGFILT
, ¶m
, sizeof(param
), 0) < 0) {
289 /* err(1, "unable to get ipfilter status"); */
290 param
.ifbrp_filter
= 0;
293 ipfflags
= param
.ifbrp_filter
;
294 printf("%sipfilter %s flags 0x%x\n", prefix
,
295 (ipfflags
& IFBF_FILT_USEIPF
) ? "enabled" : "disabled",
303 struct ifbropreq ifbp
;
305 struct ifbrparam param
;
308 u_int8_t ht
, fd
, ma
, hc
, pro
;
309 u_int8_t lladdr
[ETHER_ADDR_LEN
];
312 u_int32_t csize
, ctime
;
314 if (do_cmd(s
, BRDGGCACHE
, ¶m
, sizeof(param
), 0) < 0)
316 csize
= param
.ifbrp_csize
;
317 if (do_cmd(s
, BRDGGTO
, ¶m
, sizeof(param
), 0) < 0)
319 ctime
= param
.ifbrp_ctime
;
321 if (do_cmd(s
, BRDGPARAM
, &ifbp
, sizeof(ifbp
), 0) < 0)
323 pri
= ifbp
.ifbop_priority
;
324 pro
= ifbp
.ifbop_protocol
;
325 ht
= ifbp
.ifbop_hellotime
;
326 fd
= ifbp
.ifbop_fwddelay
;
327 hc
= ifbp
.ifbop_holdcount
;
328 ma
= ifbp
.ifbop_maxage
;
330 PV2ID(ifbp
.ifbop_bridgeid
, bprio
, lladdr
);
331 printf("\tid %s priority %u hellotime %u fwddelay %u\n",
332 ether_ntoa((struct ether_addr
*)lladdr
), pri
, ht
, fd
);
333 printf("\tmaxage %u holdcnt %u proto %s maxaddr %u timeout %u\n",
334 ma
, hc
, stpproto
[pro
], csize
, ctime
);
336 PV2ID(ifbp
.ifbop_designated_root
, bprio
, lladdr
);
337 printf("\troot id %s priority %d ifcost %u port %u\n",
338 ether_ntoa((struct ether_addr
*)lladdr
), bprio
,
339 ifbp
.ifbop_root_path_cost
, ifbp
.ifbop_root_port
& 0xfff);
341 printf("\tConfiguration:\n");
342 show_config(s
, "\t\t");
345 bridge_interfaces(s
, "\tmember: ");
347 if (!all
|| verbose
) {
348 printf("\tAddress cache (max cache: %u, timeout: %u):\n",
350 bridge_addresses(s
, "\t\t");
357 setbridge_add(const char *val
, int d
, int s
, const struct afswtch
*afp
)
361 memset(&req
, 0, sizeof(req
));
362 strlcpy(req
.ifbr_ifsname
, val
, sizeof(req
.ifbr_ifsname
));
363 if (do_cmd(s
, BRDGADD
, &req
, sizeof(req
), 1) < 0)
364 err(1, "BRDGADD %s", val
);
368 setbridge_delete(const char *val
, int d
, int s
, const struct afswtch
*afp
)
372 memset(&req
, 0, sizeof(req
));
373 strlcpy(req
.ifbr_ifsname
, val
, sizeof(req
.ifbr_ifsname
));
374 if (do_cmd(s
, BRDGDEL
, &req
, sizeof(req
), 1) < 0)
375 err(1, "BRDGDEL %s", val
);
379 setbridge_discover(const char *val
, int d
, int s
, const struct afswtch
*afp
)
382 do_bridgeflag(s
, val
, IFBIF_DISCOVER
, 1);
386 unsetbridge_discover(const char *val
, int d
, int s
, const struct afswtch
*afp
)
389 do_bridgeflag(s
, val
, IFBIF_DISCOVER
, 0);
393 setbridge_learn(const char *val
, int d
, int s
, const struct afswtch
*afp
)
396 do_bridgeflag(s
, val
, IFBIF_LEARNING
, 1);
400 unsetbridge_learn(const char *val
, int d
, int s
, const struct afswtch
*afp
)
403 do_bridgeflag(s
, val
, IFBIF_LEARNING
, 0);
408 setbridge_sticky(const char *val
, int d
, int s
, const struct afswtch
*afp
)
411 do_bridgeflag(s
, val
, IFBIF_STICKY
, 1);
415 unsetbridge_sticky(const char *val
, int d
, int s
, const struct afswtch
*afp
)
418 do_bridgeflag(s
, val
, IFBIF_STICKY
, 0);
422 setbridge_span(const char *val
, int d
, int s
, const struct afswtch
*afp
)
426 memset(&req
, 0, sizeof(req
));
427 strlcpy(req
.ifbr_ifsname
, val
, sizeof(req
.ifbr_ifsname
));
428 if (do_cmd(s
, BRDGADDS
, &req
, sizeof(req
), 1) < 0)
429 err(1, "BRDGADDS %s", val
);
433 unsetbridge_span(const char *val
, int d
, int s
, const struct afswtch
*afp
)
437 memset(&req
, 0, sizeof(req
));
438 strlcpy(req
.ifbr_ifsname
, val
, sizeof(req
.ifbr_ifsname
));
439 if (do_cmd(s
, BRDGDELS
, &req
, sizeof(req
), 1) < 0)
440 err(1, "BRDGDELS %s", val
);
445 setbridge_stp(const char *val
, int d
, int s
, const struct afswtch
*afp
)
448 do_bridgeflag(s
, val
, IFBIF_STP
, 1);
452 unsetbridge_stp(const char *val
, int d
, int s
, const struct afswtch
*afp
)
455 do_bridgeflag(s
, val
, IFBIF_STP
, 0);
460 setbridge_edge(const char *val
, int d
, int s
, const struct afswtch
*afp
)
462 do_bridgeflag(s
, val
, IFBIF_BSTP_EDGE
, 1);
466 unsetbridge_edge(const char *val
, int d
, int s
, const struct afswtch
*afp
)
468 do_bridgeflag(s
, val
, IFBIF_BSTP_EDGE
, 0);
472 setbridge_autoedge(const char *val
, int d
, int s
, const struct afswtch
*afp
)
474 do_bridgeflag(s
, val
, IFBIF_BSTP_AUTOEDGE
, 1);
478 unsetbridge_autoedge(const char *val
, int d
, int s
, const struct afswtch
*afp
)
480 do_bridgeflag(s
, val
, IFBIF_BSTP_AUTOEDGE
, 0);
484 setbridge_ptp(const char *val
, int d
, int s
, const struct afswtch
*afp
)
486 do_bridgeflag(s
, val
, IFBIF_BSTP_PTP
, 1);
490 unsetbridge_ptp(const char *val
, int d
, int s
, const struct afswtch
*afp
)
492 do_bridgeflag(s
, val
, IFBIF_BSTP_PTP
, 0);
496 setbridge_autoptp(const char *val
, int d
, int s
, const struct afswtch
*afp
)
498 do_bridgeflag(s
, val
, IFBIF_BSTP_AUTOPTP
, 1);
502 unsetbridge_autoptp(const char *val
, int d
, int s
, const struct afswtch
*afp
)
504 do_bridgeflag(s
, val
, IFBIF_BSTP_AUTOPTP
, 0);
509 setbridge_flush(const char *val
, int d
, int s
, const struct afswtch
*afp
)
513 memset(&req
, 0, sizeof(req
));
514 req
.ifbr_ifsflags
= IFBF_FLUSHDYN
;
515 if (do_cmd(s
, BRDGFLUSH
, &req
, sizeof(req
), 1) < 0)
520 setbridge_flushall(const char *val
, int d
, int s
, const struct afswtch
*afp
)
524 memset(&req
, 0, sizeof(req
));
525 req
.ifbr_ifsflags
= IFBF_FLUSHALL
;
526 if (do_cmd(s
, BRDGFLUSH
, &req
, sizeof(req
), 1) < 0)
531 setbridge_static(const char *val
, const char *mac
, int s
,
532 const struct afswtch
*afp
)
535 struct ether_addr
*ea
;
537 memset(&req
, 0, sizeof(req
));
538 strlcpy(req
.ifba_ifsname
, val
, sizeof(req
.ifba_ifsname
));
540 ea
= ether_aton(mac
);
542 errx(1, "%s: invalid address: %s", val
, mac
);
544 memcpy(req
.ifba_dst
, ea
->octet
, sizeof(req
.ifba_dst
));
545 req
.ifba_flags
= IFBAF_STATIC
;
547 req
.ifba_vlan
= 1; /* XXX allow user to specify */
550 if (do_cmd(s
, BRDGSADDR
, &req
, sizeof(req
), 1) < 0)
551 err(1, "BRDGSADDR %s", val
);
555 setbridge_deladdr(const char *val
, int d
, int s
, const struct afswtch
*afp
)
558 struct ether_addr
*ea
;
560 memset(&req
, 0, sizeof(req
));
562 ea
= ether_aton(val
);
564 errx(1, "invalid address: %s", val
);
566 memcpy(req
.ifba_dst
, ea
->octet
, sizeof(req
.ifba_dst
));
568 if (do_cmd(s
, BRDGDADDR
, &req
, sizeof(req
), 1) < 0)
569 err(1, "BRDGDADDR %s", val
);
573 setbridge_addr(const char *val
, int d
, int s
, const struct afswtch
*afp
)
576 bridge_addresses(s
, "");
580 setbridge_maxaddr(const char *arg
, int d
, int s
, const struct afswtch
*afp
)
582 struct ifbrparam param
;
585 if (get_val(arg
, &val
) < 0 || (val
& ~0xffffffff) != 0)
586 errx(1, "invalid value: %s", arg
);
588 param
.ifbrp_csize
= val
& 0xffffffff;
590 if (do_cmd(s
, BRDGSCACHE
, ¶m
, sizeof(param
), 1) < 0)
591 err(1, "BRDGSCACHE %s", arg
);
595 setbridge_hellotime(const char *arg
, int d
, int s
, const struct afswtch
*afp
)
597 struct ifbrparam param
;
600 if (get_val(arg
, &val
) < 0 || (val
& ~0xff) != 0)
601 errx(1, "invalid value: %s", arg
);
603 param
.ifbrp_hellotime
= val
& 0xff;
605 if (do_cmd(s
, BRDGSHT
, ¶m
, sizeof(param
), 1) < 0)
606 err(1, "BRDGSHT %s", arg
);
610 setbridge_fwddelay(const char *arg
, int d
, int s
, const struct afswtch
*afp
)
612 struct ifbrparam param
;
615 if (get_val(arg
, &val
) < 0 || (val
& ~0xff) != 0)
616 errx(1, "invalid value: %s", arg
);
618 param
.ifbrp_fwddelay
= val
& 0xff;
620 if (do_cmd(s
, BRDGSFD
, ¶m
, sizeof(param
), 1) < 0)
621 err(1, "BRDGSFD %s", arg
);
625 setbridge_maxage(const char *arg
, int d
, int s
, const struct afswtch
*afp
)
627 struct ifbrparam param
;
630 if (get_val(arg
, &val
) < 0 || (val
& ~0xff) != 0)
631 errx(1, "invalid value: %s", arg
);
633 param
.ifbrp_maxage
= val
& 0xff;
635 if (do_cmd(s
, BRDGSMA
, ¶m
, sizeof(param
), 1) < 0)
636 err(1, "BRDGSMA %s", arg
);
640 setbridge_priority(const char *arg
, int d
, int s
, const struct afswtch
*afp
)
642 struct ifbrparam param
;
645 if (get_val(arg
, &val
) < 0 || (val
& ~0xffff) != 0)
646 errx(1, "invalid value: %s", arg
);
648 param
.ifbrp_prio
= val
& 0xffff;
650 if (do_cmd(s
, BRDGSPRI
, ¶m
, sizeof(param
), 1) < 0)
651 err(1, "BRDGSPRI %s", arg
);
656 setbridge_protocol(const char *arg
, int d
, int s
, const struct afswtch
*afp
)
658 struct ifbrparam param
;
660 if (strcasecmp(arg
, "stp") == 0) {
661 param
.ifbrp_proto
= 0;
662 } else if (strcasecmp(arg
, "rstp") == 0) {
663 param
.ifbrp_proto
= 2;
665 errx(1, "unknown stp protocol");
668 if (do_cmd(s
, BRDGSPROTO
, ¶m
, sizeof(param
), 1) < 0)
669 err(1, "BRDGSPROTO %s", arg
);
672 setbridge_holdcount(const char *arg
, int d
, int s
, const struct afswtch
*afp
)
674 struct ifbrparam param
;
677 if (get_val(arg
, &val
) < 0 || (val
& ~0xff) != 0)
678 errx(1, "invalid value: %s", arg
);
680 param
.ifbrp_txhc
= val
& 0xff;
682 if (do_cmd(s
, BRDGSTXHC
, ¶m
, sizeof(param
), 1) < 0)
683 err(1, "BRDGSTXHC %s", arg
);
688 setbridge_ifpriority(const char *ifn
, const char *pri
, int s
,
689 const struct afswtch
*afp
)
694 memset(&req
, 0, sizeof(req
));
696 if (get_val(pri
, &val
) < 0 || (val
& ~0xff) != 0)
697 errx(1, "invalid value: %s", pri
);
699 strlcpy(req
.ifbr_ifsname
, ifn
, sizeof(req
.ifbr_ifsname
));
700 req
.ifbr_priority
= val
& 0xff;
702 if (do_cmd(s
, BRDGSIFPRIO
, &req
, sizeof(req
), 1) < 0)
703 err(1, "BRDGSIFPRIO %s", pri
);
707 setbridge_ifpathcost(const char *ifn
, const char *cost
, int s
,
708 const struct afswtch
*afp
)
713 memset(&req
, 0, sizeof(req
));
715 if (get_val(cost
, &val
) < 0)
716 errx(1, "invalid value: %s", cost
);
718 strlcpy(req
.ifbr_ifsname
, ifn
, sizeof(req
.ifbr_ifsname
));
719 req
.ifbr_path_cost
= val
;
721 if (do_cmd(s
, BRDGSIFCOST
, &req
, sizeof(req
), 1) < 0)
722 err(1, "BRDGSIFCOST %s", cost
);
727 setbridge_ifmaxaddr(const char *ifn
, const char *arg
, int s
,
728 const struct afswtch
*afp
)
733 memset(&req
, 0, sizeof(req
));
735 if (get_val(arg
, &val
) < 0 || (val
& ~0xffffffff) != 0)
736 errx(1, "invalid value: %s", arg
);
738 strlcpy(req
.ifbr_ifsname
, ifn
, sizeof(req
.ifbr_ifsname
));
739 req
.ifbr_addrmax
= val
& 0xffffffff;
741 if (do_cmd(s
, BRDGSIFAMAX
, &req
, sizeof(req
), 1) < 0)
742 err(1, "BRDGSIFAMAX %s", arg
);
747 setbridge_timeout(const char *arg
, int d
, int s
, const struct afswtch
*afp
)
749 struct ifbrparam param
;
752 if (get_val(arg
, &val
) < 0 || (val
& ~0xffffffff) != 0)
753 errx(1, "invalid value: %s", arg
);
755 param
.ifbrp_ctime
= val
& 0xffffffff;
757 if (do_cmd(s
, BRDGSTO
, ¶m
, sizeof(param
), 1) < 0)
758 err(1, "BRDGSTO %s", arg
);
763 setbridge_private(const char *val
, int d
, int s
, const struct afswtch
*afp
)
766 do_bridgeflag(s
, val
, IFBIF_PRIVATE
, 1);
770 unsetbridge_private(const char *val
, int d
, int s
, const struct afswtch
*afp
)
773 do_bridgeflag(s
, val
, IFBIF_PRIVATE
, 0);
777 static struct cmd bridge_cmds
[] = {
778 DEF_CMD_ARG("addm", setbridge_add
),
779 DEF_CMD_ARG("deletem", setbridge_delete
),
780 DEF_CMD_ARG("discover", setbridge_discover
),
781 DEF_CMD_ARG("-discover", unsetbridge_discover
),
782 DEF_CMD_ARG("learn", setbridge_learn
),
783 DEF_CMD_ARG("-learn", unsetbridge_learn
),
784 //DEF_CMD_ARG("sticky", setbridge_sticky),
785 //DEF_CMD_ARG("-sticky", unsetbridge_sticky),
786 //DEF_CMD_ARG("span", setbridge_span),
787 //DEF_CMD_ARG("-span", unsetbridge_span),
788 DEF_CMD_ARG("stp", setbridge_stp
),
789 DEF_CMD_ARG("-stp", unsetbridge_stp
),
790 //DEF_CMD_ARG("edge", setbridge_edge),
791 //DEF_CMD_ARG("-edge", unsetbridge_edge),
792 //DEF_CMD_ARG("autoedge", setbridge_autoedge),
793 //DEF_CMD_ARG("-autoedge", unsetbridge_autoedge),
794 //DEF_CMD_ARG("ptp", setbridge_ptp),
795 //DEF_CMD_ARG("-ptp", unsetbridge_ptp),
796 //DEF_CMD_ARG("autoptp", setbridge_autoptp),
797 //DEF_CMD_ARG("-autoptp", unsetbridge_autoptp),
798 DEF_CMD("flush", 0, setbridge_flush
),
799 DEF_CMD("flushall", 0, setbridge_flushall
),
800 DEF_CMD_ARG2("static", setbridge_static
),
801 DEF_CMD_ARG("deladdr", setbridge_deladdr
),
802 DEF_CMD("addr", 1, setbridge_addr
),
803 DEF_CMD_ARG("maxaddr", setbridge_maxaddr
),
804 DEF_CMD_ARG("hellotime", setbridge_hellotime
),
805 DEF_CMD_ARG("fwddelay", setbridge_fwddelay
),
806 DEF_CMD_ARG("maxage", setbridge_maxage
),
807 DEF_CMD_ARG("priority", setbridge_priority
),
808 //DEF_CMD_ARG("proto", setbridge_protocol),
809 //DEF_CMD_ARG("holdcnt", setbridge_holdcount),
810 DEF_CMD_ARG2("ifpriority", setbridge_ifpriority
),
811 DEF_CMD_ARG2("ifpathcost", setbridge_ifpathcost
),
812 //DEF_CMD_ARG2("ifmaxaddr", setbridge_ifmaxaddr),
813 DEF_CMD_ARG("timeout", setbridge_timeout
),
814 //DEF_CMD_ARG("private", setbridge_private),
815 //DEF_CMD_ARG("-private", unsetbridge_private),
817 static struct afswtch af_bridge
= {
818 .af_name
= "af_bridge",
820 .af_other_status
= bridge_status
,
823 static __constructor
void
826 #define N(a) (sizeof(a) / sizeof(a[0]))
829 for (i
= 0; i
< N(bridge_cmds
); i
++)
830 cmd_register(&bridge_cmds
[i
]);
831 af_register(&af_bridge
);