diff --git a/sbin/etherswitchcfg/etherswitchcfg.8 b/sbin/etherswitchcfg/etherswitchcfg.8 --- a/sbin/etherswitchcfg/etherswitchcfg.8 +++ b/sbin/etherswitchcfg/etherswitchcfg.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 28, 2019 +.Dd June 23, 2021 .Dt ETHERSWITCHCFG 8 .Os .Sh NAME @@ -139,6 +139,10 @@ Strip the VLAN tags from the packets sent by the port. .It Fl striptag Disable the strip VLAN tag option. +.It Cm striptagingress +Strip the VLAN tags from the packets received by the port. +.It Fl striptagingress +Disable the strip VLAN tag on ingress option. .It Cm firstlock This options makes the switch port lock on the first MAC address it sees. After that, usually you need to reset the switch to learn different diff --git a/sbin/etherswitchcfg/etherswitchcfg.c b/sbin/etherswitchcfg/etherswitchcfg.c --- a/sbin/etherswitchcfg/etherswitchcfg.c +++ b/sbin/etherswitchcfg/etherswitchcfg.c @@ -223,6 +223,8 @@ f = ETHERSWITCH_PORT_DOUBLE_TAG; else if (strcasecmp(flag, "ingress") == 0) f = ETHERSWITCH_PORT_INGRESS; + else if (strcasecmp(flag, "striptagingress") == 0) + f = ETHERSWITCH_PORT_STRIPTAGINGRESS; } bzero(&p, sizeof(p)); p.es_port = cfg->unit; @@ -869,6 +871,8 @@ { MODE_PORT, "-ingress", 0, set_port_flag }, { MODE_PORT, "striptag", 0, set_port_flag }, { MODE_PORT, "-striptag", 0, set_port_flag }, + { MODE_PORT, "striptagingress", 0, set_port_flag }, + { MODE_PORT, "-striptagingress", 0, set_port_flag }, { MODE_PORT, "doubletag", 0, set_port_flag }, { MODE_PORT, "-doubletag", 0, set_port_flag }, { MODE_PORT, "firstlock", 0, set_port_flag }, diff --git a/sys/dev/etherswitch/etherswitch.h b/sys/dev/etherswitch/etherswitch.h --- a/sys/dev/etherswitch/etherswitch.h +++ b/sys/dev/etherswitch/etherswitch.h @@ -57,17 +57,18 @@ }; typedef struct etherswitch_conf etherswitch_conf_t; -#define ETHERSWITCH_PORT_CPU (1 << 0) -#define ETHERSWITCH_PORT_STRIPTAG (1 << 1) -#define ETHERSWITCH_PORT_ADDTAG (1 << 2) -#define ETHERSWITCH_PORT_FIRSTLOCK (1 << 3) -#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_CPU (1 << 0) +#define ETHERSWITCH_PORT_STRIPTAG (1 << 1) +#define ETHERSWITCH_PORT_ADDTAG (1 << 2) +#define ETHERSWITCH_PORT_FIRSTLOCK (1 << 3) +#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_STRIPTAGINGRESS (1 << 8) #define ETHERSWITCH_PORT_FLAGS_BITS \ "\020\1CPUPORT\2STRIPTAG\3ADDTAG\4FIRSTLOCK\5DROPUNTAGGED\6QinQ\7INGRESS" \ -"\10DROPTAGGED" +"\10DROPTAGGED\11STRIPTAGINGRESS" #define ETHERSWITCH_PORT_MAX_LEDS 3