Module Name:    src
Committed By:   ozaki-r
Date:           Tue Sep  3 08:00:30 UTC 2024

Modified Files:
        src/sbin/brconfig: brconfig.8 brconfig.c

Log Message:
brconfig: add protect/-protect commands

It marks/clears a specified interface "protected".


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sbin/brconfig/brconfig.8
cvs rdiff -u -r1.17 -r1.18 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.8
diff -u src/sbin/brconfig/brconfig.8:1.20 src/sbin/brconfig/brconfig.8:1.21
--- src/sbin/brconfig/brconfig.8:1.20	Sun Jul 19 14:43:35 2020
+++ src/sbin/brconfig/brconfig.8	Tue Sep  3 08:00:30 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: brconfig.8,v 1.20 2020/07/19 14:43:35 wiz Exp $
+.\"	$NetBSD: brconfig.8,v 1.21 2024/09/03 08:00:30 ozaki-r 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 July 19, 2020
+.Dd August 29, 2024
 .Dt BRCONFIG 8
 .Os
 .Sh NAME
@@ -165,6 +165,19 @@ This is the default for all interfaces a
 Clear the
 .Dq learning
 attribute on a member interface.
+.It Cm protect Ar interface
+Mark an interface as a
+.Dq protected
+interface.
+When a packet arrives on a
+.Dq protected
+interface and is being forwarded to another
+.Dq protected
+interface, the packet will be discarded.
+.It Cm -protect Ar interface
+Clear the
+.Dq protected
+attribute on a member interface.
 .It Cm static Ar interface address
 Add a static entry into the address cache pointing to
 .Ar interface .

Index: src/sbin/brconfig/brconfig.c
diff -u src/sbin/brconfig/brconfig.c:1.17 src/sbin/brconfig/brconfig.c:1.18
--- src/sbin/brconfig/brconfig.c:1.17	Mon Jun  1 06:15:18 2015
+++ src/sbin/brconfig/brconfig.c	Tue Sep  3 08:00:30 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: brconfig.c,v 1.17 2015/06/01 06:15:18 matt Exp $	*/
+/*	$NetBSD: brconfig.c,v 1.18 2024/09/03 08:00:30 ozaki-r Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -43,7 +43,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: brconfig.c,v 1.17 2015/06/01 06:15:18 matt Exp $");
+__RCSID("$NetBSD: brconfig.c,v 1.18 2024/09/03 08:00:30 ozaki-r Exp $");
 #endif
 
 
@@ -95,6 +95,7 @@ static void	cmd_ifpathcost(const struct 
 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 **);
+static void	cmd_protect(const struct command *, int, const char *, char **);
 
 static const struct command command_table[] = {
 	{ "add",		1,	0,		cmd_add },
@@ -131,6 +132,9 @@ static const struct command command_tabl
         { "ipf",                0,      0,              cmd_ipf },
         { "-ipf",               0,      CMD_INVERT,     cmd_ipf },
 
+	{ "protect",		1,	0,		cmd_protect },
+	{ "-protect",		1,	CMD_INVERT,	cmd_protect },
+
 	{ NULL,			0,	0,		NULL },
 };
 
@@ -625,6 +629,15 @@ cmd_stp(const struct command *cmd, int s
 }
 
 static void
+cmd_protect(const struct command *cmd, int sock, const char *bridge,
+    char **argv)
+{
+
+	do_bridgeflag(sock, bridge, argv[0], IFBIF_PROTECTED,
+	    (cmd->cmd_flags & CMD_INVERT) ? 0 : 1);
+}
+
+static void
 cmd_flush(const struct command *cmd, int sock, const char *bridge,
     char **argv)
 {

Reply via email to