kern/177873: [etherswitchcfg] [patch] Change the per port vlangroup option to pvid
Luiz Otavio O Souza
loos.br at gmail.com
Mon Apr 15 15:10:00 UTC 2013
>Number: 177873
>Category: kern
>Synopsis: [etherswitchcfg] [patch] Change the per port vlangroup option to pvid
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Apr 15 15:10:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Luiz Otavio O Souza
>Release: -HEAD r248943
>Organization:
>Environment:
FreeBSD rb433 10.0-CURRENT FreeBSD 10.0-CURRENT #88 r248943M: Sat Apr 13 10:04:43 BRT 2013 root at devel:/data/rb/rb433/obj/mips.mips/data/rb/rb433/src/sys/RB433U mips
>Description:
etherswitchcfg(8) uses vlangroup to set the per port default VID. Change it to pvid which is widely adopted among many vendors. Discussed with adrian@ and ray at .
This breaks the rtl8366 switch driver which will be fixed in a subsequent PR.
Today etherswitchcfg(8) usage goes like:
root at rb433:~ # etherswitchcfg vlangroup2 vlan 10 members 1,2
vlangroup2:
vlan: 10
members 1,2
root at rb433:~ # ./etherswitchcfg port2 vlangroup 2
port2:
vlangroup: 2
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
The attached patch change it to:
root at rb433:~ # etherswitchcfg vlangroup2 vlan 10 members 1,2
vlangroup2:
vlan: 10
members 1,2
root at rb433:~ # etherswitchcfg port2 pvid 10
port2:
pvid: 10
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
>How-To-Repeat:
>Fix:
Apply the attached patch.
Patch attached with submission follows:
Index: sbin/etherswitchcfg/etherswitchcfg.8
===================================================================
--- sbin/etherswitchcfg/etherswitchcfg.8 (revision 248943)
+++ sbin/etherswitchcfg/etherswitchcfg.8 (working copy)
@@ -62,9 +62,9 @@
.Ss port
The port command selects one of the ports of the switch.
It supports the following commands:
-.Bl -tag -width ".Ar vlangroup number" -compact
-.It Ar vlangroup number
-Sets the VLAN group number that is used to process incoming frames that are not tagged.
+.Bl -tag -width ".Ar pvid number" -compact
+.It Ar pvid number
+Sets the default port VID that is used to process incoming frames that are not tagged.
.It Ar media mediaspec
Specifies the physical media configuration to be configured for a port.
.It Ar mediaopt mediaoption
@@ -104,7 +104,7 @@
while excluding all other ports.
Port 5 will send and receive tagged frames, while port 0 will be untagged.
Incoming untagged frames on port 0 are assigned to vlangroup1.
-.Dl # etherswitchcfg vlangroup1 vlan 2 members 0,5t port0 vlangroup 1
+.Dl # etherswitchcfg vlangroup1 vlan 2 members 0,5t port0 pvid 2
.Sh SEE ALSO
.Xr etherswitch 4
.Sh HISTORY
Index: sbin/etherswitchcfg/etherswitchcfg.c
===================================================================
--- sbin/etherswitchcfg/etherswitchcfg.c (revision 248943)
+++ sbin/etherswitchcfg/etherswitchcfg.c (working copy)
@@ -131,18 +131,19 @@
}
static void
-set_port_vlangroup(struct cfg *cfg, char *argv[])
+set_port_vid(struct cfg *cfg, char *argv[])
{
int v;
etherswitch_port_t p;
v = strtol(argv[1], NULL, 0);
- if (v < 0 || v >= cfg->info.es_nvlangroups)
- errx(EX_USAGE, "vlangroup must be between 0 and %d", cfg->info.es_nvlangroups-1);
+ if (v < 0 || v > IEEE802DOT1Q_VID_MAX)
+ errx(EX_USAGE, "pvid must be between 0 and %d",
+ IEEE802DOT1Q_VID_MAX);
p.es_port = cfg->unit;
if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0)
err(EX_OSERR, "ioctl(IOETHERSWITCHGETPORT)");
- p.es_vlangroup = v;
+ p.es_pvid = v;
if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, &p) != 0)
err(EX_OSERR, "ioctl(IOETHERSWITCHSETPORT)");
}
@@ -301,7 +302,7 @@
if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0)
err(EX_OSERR, "ioctl(IOETHERSWITCHGETPORT)");
printf("port%d:\n", port);
- printf("\tvlangroup: %d\n", p.es_vlangroup);
+ printf("\tpvid: %d\n", p.es_pvid);
printf("\tmedia: ");
print_media_word(p.es_ifmr.ifm_current, 1);
if (p.es_ifmr.ifm_active != p.es_ifmr.ifm_current) {
@@ -502,7 +503,7 @@
}
static struct cmds cmds[] = {
- { MODE_PORT, "vlangroup", 1, set_port_vlangroup },
+ { MODE_PORT, "pvid", 1, set_port_vid },
{ MODE_PORT, "media", 1, set_port_media },
{ MODE_PORT, "mediaopt", 1, set_port_mediaopt },
{ MODE_VLANGROUP, "vlan", 1, set_vlangroup_vid },
Index: sys/dev/etherswitch/etherswitch.h
===================================================================
--- sys/dev/etherswitch/etherswitch.h (revision 248943)
+++ sys/dev/etherswitch/etherswitch.h (working copy)
@@ -36,7 +36,7 @@
struct etherswitch_port {
int es_port;
- int es_vlangroup;
+ int es_pvid;
union {
struct ifreq es_uifr;
struct ifmediareq es_uifmr;
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list