CVS commit: src/sbin/brconfig
Module Name:src Committed By: wiz Date: Sun Jul 19 14:43:35 UTC 2020 Modified Files: src/sbin/brconfig: brconfig.8 Log Message: Remove unused Pp. Sort SEE ALSO. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sbin/brconfig/brconfig.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/brconfig/brconfig.8 diff -u src/sbin/brconfig/brconfig.8:1.19 src/sbin/brconfig/brconfig.8:1.20 --- src/sbin/brconfig/brconfig.8:1.19 Sun Jul 19 14:39:42 2020 +++ src/sbin/brconfig/brconfig.8 Sun Jul 19 14:43:35 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: brconfig.8,v 1.19 2020/07/19 14:39:42 maxv Exp $ +.\" $NetBSD: brconfig.8,v 1.20 2020/07/19 14:43:35 wiz Exp $ .\" .\" Copyright 2001 Wasabi Systems, Inc. .\" All rights reserved. @@ -84,7 +84,6 @@ All other operations require that a brid If a bridge is specified with no sub-commands, the status of that bridge is displayed. The following sub-commands are available: -.Pp .Bl -tag -width indent .It Cm up Start forwarding packets on the bridge. @@ -256,8 +255,8 @@ create .Xr bridge 4 , .Xr pf 4 , .Xr ifconfig.if 5 , -.Xr ifconfig 8 , .Xr npf 7 , +.Xr ifconfig 8 , .Xr pfil 9 .Sh HISTORY The
CVS commit: src/sbin/brconfig
Module Name:src Committed By: maxv Date: Sun Jul 19 14:39:42 UTC 2020 Modified Files: src/sbin/brconfig: brconfig.8 Log Message: sync with reality To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sbin/brconfig/brconfig.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/brconfig/brconfig.8 diff -u src/sbin/brconfig/brconfig.8:1.18 src/sbin/brconfig/brconfig.8:1.19 --- src/sbin/brconfig/brconfig.8:1.18 Mon Jan 5 00:36:23 2015 +++ src/sbin/brconfig/brconfig.8 Sun Jul 19 14:39:42 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: brconfig.8,v 1.18 2015/01/05 00:36:23 msaitoh Exp $ +.\" $NetBSD: brconfig.8,v 1.19 2020/07/19 14:39:42 maxv Exp $ .\" .\" Copyright 2001 Wasabi Systems, Inc. .\" All rights reserved. @@ -33,7 +33,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 5, 2015 +.Dd July 19, 2020 .Dt BRCONFIG 8 .Os .Sh NAME @@ -152,9 +152,7 @@ The current implementation passes all ARP and RARP packets through the bridge while filtering IP and IPv6 packets through the configured packet filter, such as -.Xr ipf 4 -or -.Xr pf 4 . +.Xr npf 7 . Other packet types are blocked. .It Cm learn Ar interface Mark an interface as a @@ -259,7 +257,7 @@ create .Xr pf 4 , .Xr ifconfig.if 5 , .Xr ifconfig 8 , -.Xr ipf 8 , +.Xr npf 7 , .Xr pfil 9 .Sh HISTORY The
CVS commit: src/sbin/brconfig
Module Name:src Committed By: matt Date: Mon Jun 1 06:15:18 UTC 2015 Modified Files: src/sbin/brconfig: brconfig.c Log Message: Use the new BRDGGIFS and BRDGRTS cmds which just use ifdrv directly. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sbin/brconfig/brconfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/brconfig/brconfig.c diff -u src/sbin/brconfig/brconfig.c:1.16 src/sbin/brconfig/brconfig.c:1.17 --- src/sbin/brconfig/brconfig.c:1.16 Thu May 28 20:14:00 2015 +++ src/sbin/brconfig/brconfig.c Mon Jun 1 06:15:18 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: brconfig.c,v 1.16 2015/05/28 20:14:00 joerg Exp $ */ +/* $NetBSD: brconfig.c,v 1.17 2015/06/01 06:15:18 matt Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -43,7 +43,7 @@ #include #ifndef lint -__RCSID("$NetBSD: brconfig.c,v 1.16 2015/05/28 20:14:00 joerg Exp $"); +__RCSID("$NetBSD: brconfig.c,v 1.17 2015/06/01 06:15:18 matt Exp $"); #endif @@ -141,7 +141,8 @@ static void show_config(int, const char static void show_interfaces(int, const char *, const char *); static void show_addresses(int, const char *, const char *); static int get_val(const char *, u_long *); -static int do_cmd(int, const char *, u_long, void *, size_t, int); +#define do_cmd(a,b,c,d,e,f) do_cmd2((a),(b),(c),(d),(e),NULL,(f)) +static int do_cmd2(int, const char *, u_long, void *, size_t, size_t *, int); static void do_ifflag(int, const char *, int, int); static void do_bridgeflag(int, const char *, const char *, int, int); @@ -418,26 +419,22 @@ show_interfaces(int sock, const char *br "forwarding", "blocking", }; - struct ifbifconf bifc; struct ifbreq *req; char *inbuf = NULL, *ninbuf; - uint32_t i, len = 8192; + size_t len = 8192, nlen; - for (;;) { - ninbuf = realloc(inbuf, len); + do { + nlen = len; + ninbuf = realloc(inbuf, nlen); if (ninbuf == NULL) err(1, "unable to allocate interface buffer"); - bifc.ifbic_len = len; - bifc.ifbic_buf = inbuf = ninbuf; - if (do_cmd(sock, bridge, BRDGGIFS, &bifc, sizeof(bifc), 0) < 0) + inbuf = ninbuf; + if (do_cmd2(sock, bridge, BRDGGIFS, inbuf, nlen, &len, 0) < 0) err(1, "unable to get interface list"); - if ((bifc.ifbic_len + sizeof(*req)) < len) - break; - len *= 2; - } + } while (len > nlen); - for (i = 0; i < bifc.ifbic_len / sizeof(*req); i++) { - req = bifc.ifbic_req + i; + for (size_t i = 0; i < len / sizeof(*req); i++) { + req = (struct ifbreq *)inbuf + i; printf("%s%s ", prefix, req->ifbr_ifsname); printb("flags", req->ifbr_ifsflags, IFBIFBITS); printf("\n"); @@ -462,31 +459,27 @@ show_interfaces(int sock, const char *br static void show_addresses(int sock, const char *bridge, const char *prefix) { - struct ifbaconf ifbac; struct ifbareq *ifba; char *inbuf = NULL, *ninbuf; - uint32_t i, len = 8192; struct ether_addr ea; + size_t len = 8192, nlen; - for (;;) { - ninbuf = realloc(inbuf, len); + do { + nlen = len; + ninbuf = realloc(inbuf, nlen); if (ninbuf == NULL) err(1, "unable to allocate address buffer"); - ifbac.ifbac_len = len; - ifbac.ifbac_buf = inbuf = ninbuf; - if (do_cmd(sock, bridge, BRDGRTS, &ifbac, sizeof(ifbac), 0) < 0) + inbuf = ninbuf; + if (do_cmd2(sock, bridge, BRDGRTS, inbuf, nlen, &len, 0) < 0) err(1, "unable to get address cache"); - if ((ifbac.ifbac_len + sizeof(*ifba)) < len) - break; - len *= 2; - } + } while (len > nlen); - for (i = 0; i < ifbac.ifbac_len / sizeof(*ifba); i++) { - ifba = ifbac.ifbac_req + i; + for (size_t i = 0; i < len / sizeof(*ifba); i++) { + ifba = (struct ifbareq *)inbuf + i; memcpy(ea.ether_addr_octet, ifba->ifba_dst, sizeof(ea.ether_addr_octet)); - printf("%s%s %s %ld ", prefix, ether_ntoa(&ea), - ifba->ifba_ifsname, ifba->ifba_expire); + printf("%s%s %s %jd ", prefix, ether_ntoa(&ea), + ifba->ifba_ifsname, (uintmax_t)ifba->ifba_expire); printb("flags", ifba->ifba_flags, IFBAFBITS); printf("\n"); } @@ -510,10 +503,11 @@ get_val(const char *cp, u_long *valp) } static int -do_cmd(int sock, const char *bridge, u_long op, void *arg, size_t argsize, -int set) +do_cmd2(int sock, const char *bridge, u_long op, void *arg, size_t argsize, +size_t *outsizep, int set) { struct ifdrv ifd; + int error; memset(&ifd, 0, sizeof(ifd)); @@ -522,7 +516,12 @@ do_cmd(int sock, const char *bridge, u_l ifd.ifd_len = argsize; ifd.ifd_data = arg; - return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); + error = ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd); + + if (outsizep) + *outsizep = ifd.ifd_len; + + return error; } static void
CVS commit: src/sbin/brconfig
Module Name:src Committed By: joerg Date: Thu May 28 20:14:00 UTC 2015 Modified Files: src/sbin/brconfig: brconfig.c Log Message: constness doesn't increase by applying more const. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sbin/brconfig/brconfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/brconfig/brconfig.c diff -u src/sbin/brconfig/brconfig.c:1.15 src/sbin/brconfig/brconfig.c:1.16 --- src/sbin/brconfig/brconfig.c:1.15 Thu May 28 01:35:31 2015 +++ src/sbin/brconfig/brconfig.c Thu May 28 20:14:00 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: brconfig.c,v 1.15 2015/05/28 01:35:31 matt Exp $ */ +/* $NetBSD: brconfig.c,v 1.16 2015/05/28 20:14:00 joerg Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -43,7 +43,7 @@ #include #ifndef lint -__RCSID("$NetBSD: brconfig.c,v 1.15 2015/05/28 01:35:31 matt Exp $"); +__RCSID("$NetBSD: brconfig.c,v 1.16 2015/05/28 20:14:00 joerg Exp $"); #endif @@ -411,7 +411,7 @@ show_config(int sock, const char *bridge static void show_interfaces(int sock, const char *bridge, const char *prefix) { - static const char const stpstates[][11] = { + static const char stpstates[][11] = { "disabled", "listening", "learning",
CVS commit: src/sbin/brconfig
Module Name:src Committed By: matt Date: Thu May 28 01:35:32 UTC 2015 Modified Files: src/sbin/brconfig: brconfig.c Log Message: Constify an array of strings. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sbin/brconfig/brconfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/brconfig/brconfig.c diff -u src/sbin/brconfig/brconfig.c:1.14 src/sbin/brconfig/brconfig.c:1.15 --- src/sbin/brconfig/brconfig.c:1.14 Thu Aug 23 12:06:32 2012 +++ src/sbin/brconfig/brconfig.c Thu May 28 01:35:31 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: brconfig.c,v 1.14 2012/08/23 12:06:32 drochner Exp $ */ +/* $NetBSD: brconfig.c,v 1.15 2015/05/28 01:35:31 matt Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -43,7 +43,7 @@ #include #ifndef lint -__RCSID("$NetBSD: brconfig.c,v 1.14 2012/08/23 12:06:32 drochner Exp $"); +__RCSID("$NetBSD: brconfig.c,v 1.15 2015/05/28 01:35:31 matt Exp $"); #endif @@ -411,7 +411,7 @@ show_config(int sock, const char *bridge static void show_interfaces(int sock, const char *bridge, const char *prefix) { - static const char *stpstates[] = { + static const char const stpstates[][11] = { "disabled", "listening", "learning",
CVS commit: src/sbin/brconfig
Module Name:src Committed By: msaitoh Date: Mon Jan 5 00:36:23 UTC 2015 Modified Files: src/sbin/brconfig: brconfig.8 Log Message: Add missing "addr" and "static" commands. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sbin/brconfig/brconfig.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/brconfig/brconfig.8 diff -u src/sbin/brconfig/brconfig.8:1.17 src/sbin/brconfig/brconfig.8:1.18 --- src/sbin/brconfig/brconfig.8:1.17 Mon Jan 8 07:22:12 2007 +++ src/sbin/brconfig/brconfig.8 Mon Jan 5 00:36:23 2015 @@ -1,4 +1,4 @@ -.\" $NetBSD: brconfig.8,v 1.17 2007/01/08 07:22:12 wiz Exp $ +.\" $NetBSD: brconfig.8,v 1.18 2015/01/05 00:36:23 msaitoh Exp $ .\" .\" Copyright 2001 Wasabi Systems, Inc. .\" All rights reserved. @@ -33,7 +33,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 7, 2007 +.Dd January 5, 2015 .Dt BRCONFIG 8 .Os .Sh NAME @@ -102,6 +102,8 @@ Remove the interface named by from the bridge. Promiscuous mode is disabled on the interface when it is removed from the bridge. +.It Cm addr +Display the addresses that have been learned by the bridge. .It Cm maxaddr Ar size Set the size of the bridge address cache to .Ar size . @@ -166,6 +168,11 @@ This is the default for all interfaces a Clear the .Dq learning attribute on a member interface. +.It Cm static Ar interface address +Add a static entry into the address cache pointing to +.Ar interface . +Static entries are never aged out of the cache or replaced, even if the address +is seen on a different interface. .It Cm stp Ar interface Enable Spanning Tree protocol on .Ar interface .
CVS commit: src/sbin/brconfig
Module Name:src Committed By: joerg Date: Mon Aug 29 14:29:21 UTC 2011 Modified Files: src/sbin/brconfig: brconfig.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sbin/brconfig/brconfig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/brconfig/brconfig.c diff -u src/sbin/brconfig/brconfig.c:1.12 src/sbin/brconfig/brconfig.c:1.13 --- src/sbin/brconfig/brconfig.c:1.12 Mon Mar 16 12:56:19 2009 +++ src/sbin/brconfig/brconfig.c Mon Aug 29 14:29:21 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: brconfig.c,v 1.12 2009/03/16 12:56:19 lukem Exp $ */ +/* $NetBSD: brconfig.c,v 1.13 2011/08/29 14:29:21 joerg Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -43,7 +43,7 @@ #include #ifndef lint -__RCSID("$NetBSD: brconfig.c,v 1.12 2009/03/16 12:56:19 lukem Exp $"); +__RCSID("$NetBSD: brconfig.c,v 1.13 2011/08/29 14:29:21 joerg Exp $"); #endif @@ -74,29 +74,29 @@ #define CMD_INVERT 0x01 /* "invert" the sense of the command */ -void cmd_add(const struct command *, int, const char *, char **); -void cmd_delete(const struct command *, int, const char *, char **); -void cmd_up(const struct command *, int, const char *, char **); -void cmd_down(const struct command *, int, const char *, char **); -void cmd_discover(const struct command *, int, const char *, char **); -void cmd_learn(const struct command *, int, const char *, char **); -void cmd_flush(const struct command *, int, const char *, char **); -void cmd_flushall(const struct command *, int, const char *, char **); -void cmd_static(const struct command *, int, const char *, char **); -void cmd_deladdr(const struct command *, int, const char *, char **); -void cmd_addr(const struct command *, int, const char *, char **); -void cmd_maxaddr(const struct command *, int, const char *, char **); -void cmd_hellotime(const struct command *, int, const char *, char **); -void cmd_fwddelay(const struct command *, int, const char *, char **); -void cmd_maxage(const struct command *, int, const char *, char **); -void cmd_priority(const struct command *, int, const char *, char **); -void cmd_ifpriority(const struct command *, int, const char *, char **); -void cmd_ifpathcost(const struct command *, int, const char *, char **); -void cmd_timeout(const struct command *, int, const char *, char **); -void cmd_stp(const struct command *, int, const char *, char **); -void cmd_ipf(const struct command *, int, const char *, char **); +static void cmd_add(const struct command *, int, const char *, char **); +static void cmd_delete(const struct command *, int, const char *, char **); +static void cmd_up(const struct command *, int, const char *, char **); +static void cmd_down(const struct command *, int, const char *, char **); +static void cmd_discover(const struct command *, int, const char *, char **); +static void cmd_learn(const struct command *, int, const char *, char **); +static void cmd_flush(const struct command *, int, const char *, char **); +static void cmd_flushall(const struct command *, int, const char *, char **); +static void cmd_static(const struct command *, int, const char *, char **); +static void cmd_deladdr(const struct command *, int, const char *, char **); +static void cmd_addr(const struct command *, int, const char *, char **); +static void cmd_maxaddr(const struct command *, int, const char *, char **); +static void cmd_hellotime(const struct command *, int, const char *, char **); +static void cmd_fwddelay(const struct command *, int, const char *, char **); +static void cmd_maxage(const struct command *, int, const char *, char **); +static void cmd_priority(const struct command *, int, const char *, char **); +static void cmd_ifpriority(const struct command *, int, const char *, char **); +static void cmd_ifpathcost(const struct command *, int, const char *, char **); +static void cmd_timeout(const struct command *, int, const char *, char **); +static void cmd_stp(const struct command *, int, const char *, char **); +static void cmd_ipf(const struct command *, int, const char *, char **); -const struct command command_table[] = { +static const struct command command_table[] = { { "add", 1, 0, cmd_add }, { "delete", 1, 0, cmd_delete }, @@ -134,25 +134,25 @@ { NULL, 0, 0, NULL }, }; -void printall(int); -void status(int, const char *); -int is_bridge(const char *); -void show_config(int, const char *, const char *); -void show_interfaces(int, const char *, const char *); -void show_addresses(int, const char *, const char *); -int get_val(const char *, u_long *); -int do_cmd(int, const char *, u_long, void *, size_t, int); -void do_ifflag(int, const char *, int, int); -void do_bridgeflag(int, const char *, const char *, int, int); +static void printall(int); +static void status(int, const char *); +static int is_bridge(const char *); +static void show