svn commit: r349520 - in head: sbin/etherswitchcfg sys/dev/etherswitch

Luiz Otavio O Souza loos at FreeBSD.org
Fri Jun 28 22:12:45 UTC 2019


Author: loos
Date: Fri Jun 28 22:12:43 2019
New Revision: 349520
URL: https://svnweb.freebsd.org/changeset/base/349520

Log:
  Add the 'drop tagged' flag support for ethernet switch ports.
  
  This is intended to drop all 802.1q tagged packets on a port.
  
  Sponsored by:	 Rubicon Communications, LLC (Netgate)

Modified:
  head/sbin/etherswitchcfg/etherswitchcfg.8
  head/sbin/etherswitchcfg/etherswitchcfg.c
  head/sys/dev/etherswitch/etherswitch.h

Modified: head/sbin/etherswitchcfg/etherswitchcfg.8
==============================================================================
--- head/sbin/etherswitchcfg/etherswitchcfg.8	Fri Jun 28 20:40:54 2019	(r349519)
+++ head/sbin/etherswitchcfg/etherswitchcfg.8	Fri Jun 28 22:12:43 2019	(r349520)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 2, 2016
+.Dd June 28, 2019
 .Dt ETHERSWITCHCFG 8
 .Os
 .Sh NAME
@@ -147,6 +147,10 @@ MAC addresses.
 Disable the first lock option.
 Note that sometimes you need to reset the
 switch to really disable this option.
+.It Cm droptagged
+Drop packets with a VLAN tag.
+.It Fl droptagged
+Disable the drop tagged packets option.
 .It Cm dropuntagged
 Drop packets without a VLAN tag.
 .It Fl dropuntagged

Modified: head/sbin/etherswitchcfg/etherswitchcfg.c
==============================================================================
--- head/sbin/etherswitchcfg/etherswitchcfg.c	Fri Jun 28 20:40:54 2019	(r349519)
+++ head/sbin/etherswitchcfg/etherswitchcfg.c	Fri Jun 28 22:12:43 2019	(r349520)
@@ -215,6 +215,8 @@ set_port_flag(struct cfg *cfg, int argc, char *argv[])
 			f = ETHERSWITCH_PORT_ADDTAG;
 		else if (strcasecmp(flag, "firstlock") == 0)
 			f = ETHERSWITCH_PORT_FIRSTLOCK;
+		else if (strcasecmp(flag, "droptagged") == 0)
+			f = ETHERSWITCH_PORT_DROPTAGGED;
 		else if (strcasecmp(flag, "dropuntagged") == 0)
 			f = ETHERSWITCH_PORT_DROPUNTAGGED;
 		else if (strcasecmp(flag, "doubletag") == 0)
@@ -871,6 +873,8 @@ static struct cmds cmds[] = {
 	{ MODE_PORT, "-doubletag", 0, set_port_flag },
 	{ MODE_PORT, "firstlock", 0, set_port_flag },
 	{ MODE_PORT, "-firstlock", 0, set_port_flag },
+	{ MODE_PORT, "droptagged", 0, set_port_flag },
+	{ MODE_PORT, "-droptagged", 0, set_port_flag },
 	{ MODE_PORT, "dropuntagged", 0, set_port_flag },
 	{ MODE_PORT, "-dropuntagged", 0, set_port_flag },
 	{ MODE_CONFIG, "vlan_mode", 1, set_vlan_mode },

Modified: head/sys/dev/etherswitch/etherswitch.h
==============================================================================
--- head/sys/dev/etherswitch/etherswitch.h	Fri Jun 28 20:40:54 2019	(r349519)
+++ head/sys/dev/etherswitch/etherswitch.h	Fri Jun 28 22:12:43 2019	(r349520)
@@ -64,8 +64,10 @@ typedef struct etherswitch_conf etherswitch_conf_t;
 #define	ETHERSWITCH_PORT_DROPUNTAGGED	(1 << 4)
 #define	ETHERSWITCH_PORT_DOUBLE_TAG	(1 << 5)
 #define	ETHERSWITCH_PORT_INGRESS	(1 << 6)
+#define	ETHERSWITCH_PORT_DROPTAGGED     (1 << 7)
 #define	ETHERSWITCH_PORT_FLAGS_BITS	\
-"\020\1CPUPORT\2STRIPTAG\3ADDTAG\4FIRSTLOCK\5DROPUNTAGGED\6QinQ\7INGRESS"
+"\020\1CPUPORT\2STRIPTAG\3ADDTAG\4FIRSTLOCK\5DROPUNTAGGED\6QinQ\7INGRESS" \
+"\10DROPTAGGED"
 
 #define ETHERSWITCH_PORT_MAX_LEDS 3
 


More information about the svn-src-head mailing list