On 10/21/20 11:28 PM, Alexander V. Chernikov wrote:
Author: melifaro
Date: Wed Oct 21 21:28:20 2020
New Revision: 366917
URL: https://svnweb.freebsd.org/changeset/base/366917

Log:
   Add support for stacked VLANs (IEEE 802.1ad, AKA Q-in-Q).
802.1ad interfaces are created with ifconfig using the "vlanproto" parameter.
   Eg., the following creates a 802.1Q VLAN (id #42) over a 802.1ad S-VLAN
   (id #5) over a physical Ethernet interface (em0).
ifconfig vlan5 create vlandev em0 vlan 5 vlanproto 802.1ad up
   ifconfig vlan42 create vlandev vlan5 vlan 42 inet 10.5.42.1/24
VLAN_MTU, VLAN_HWCSUM and VLAN_TSO capabilities should be properly
   supported. VLAN_HWTAGGING is only partially supported, as there is
   currently no IFCAP_VLAN_* denoting the possibility to set the VLAN
   EtherType to anything else than 0x8100 (802.1ad uses 0x88A8).
Submitted by: Olivier Piras
   Sponsored by:        RG Nets
   Differential Revision:       https://reviews.freebsd.org/D26436


Hi Alexander,

Any vlan ending in .<N> is now treated the same regardless of network device:

Try this sequence of commands starting in any order
ifconfig vlan<N> create
ifconfig igb0.<N> create
ifconfig igb1.<N> create

You'll quickly see that only the first command you pick succeeds. The subsequent ones will fail. <N> must be the same number, for example 5.

I'm not sure exactly where the problem is yet, but investigation shows that ifc_name2unit would return EINVAL on igb0.<N> . Now it returns 0 (success) and puts <N> into the *unit argument.

diff --git a/sys/net/if_clone.c b/sys/net/if_clone.c
index a55ce9c3005..7f96757e12c 100644
--- a/sys/net/if_clone.c
+++ b/sys/net/if_clone.c
@@ -582,9 +582,8 @@ ifc_name2unit(const char *name, int *unit)
        int             cutoff = INT_MAX / 10;
        int             cutlim = INT_MAX % 10;
- if ((cp = strrchr(name, '.')) == NULL)
-               cp = name;
-       for (; *cp != '\0' && (*cp < '0' || *cp > '9'); cp++);
+       for (cp = name; *cp != '\0' && (*cp < '0' || *cp > '9'); cp++)
+               ;
        if (*cp == '\0') {
                *unit = -1;
        } else if (cp[0] == '0' && cp[1] != '\0') {

The chunk above is not a fix. Can you have a look at this. Should be easy to reproduce!

Rolling back the kernel only to r366916 gives me:

ifconfig igb1.11 create
ifconfig: SIOCIFCREATE2: Invalid argument

Rolling back ifconfig to r366916 aswell, gives me the expected result again:

/usr/obj/usr/img/freebsd/amd64.amd64/sbin/ifconfig/ifconfig igb1.11 create
/usr/obj/usr/img/freebsd/amd64.amd64/sbin/ifconfig/ifconfig vlan11 create

--HPS
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to