Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Apr 2023 20:11:12 +0000
From:      bugzilla-noreply@freebsd.org
To:        net@FreeBSD.org
Subject:   [Bug 270559] if_bridge: does not forward packets properly for vlan 1
Message-ID:  <bug-270559-7501-4YqljOo5qV@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-270559-7501@https.bugs.freebsd.org/bugzilla/>
References:  <bug-270559-7501@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D270559

Kristof Provost <kp@freebsd.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |philip@FreeBSD.org

--- Comment #6 from Kristof Provost <kp@freebsd.org> ---
Yes, I believe your analysis is correct, as is your proposed approach for
fixing it.
With a bit of poking I got my test case to fail as you described, and with =
the
following patch it works again:

diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 60a1683c74ae..5144da190a4f 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -389,7 +389,7 @@ static void bridge_linkcheck(struct bridge_softc *sc);

 /* The default bridge vlan is 1 (IEEE 802.1Q-2003 Table 9-2) */
 #define        VLANTAGOF(_m)   \
-    (_m->m_flags & M_VLANTAG) ? EVL_VLANOFTAG(_m->m_pkthdr.ether_vtag) : 1
+    (_m->m_flags & M_VLANTAG) ? EVL_VLANOFTAG(_m->m_pkthdr.ether_vtag) : 0

 static struct bstp_cb_ops bridge_ops =3D {
        .bcb_state =3D bridge_state_change,
@@ -2783,10 +2783,6 @@ bridge_rtupdate(struct bridge_softc *sc, const uint8=
_t
*dst, uint16_t vlan,
             dst[3] =3D=3D 0 && dst[4] =3D=3D 0 && dst[5] =3D=3D 0) !=3D 0)
                return (EINVAL);

-       /* 802.1p frames map to vlan 1 */
-       if (vlan =3D=3D 0)
-               vlan =3D 1;
-
        /*
         * A route for this destination might already exist.  If so,
         * update it, otherwise create a new one.
@@ -3118,7 +3114,7 @@ bridge_rtnode_lookup(struct bridge_softc *sc, const
uint8_t *addr, uint16_t vlan
        hash =3D bridge_rthash(sc, addr);
        CK_LIST_FOREACH(brt, &sc->sc_rthash[hash], brt_hash) {
                dir =3D bridge_rtnode_addr_cmp(addr, brt->brt_addr);
-               if (dir =3D=3D 0 && (brt->brt_vlan =3D=3D vlan || vlan =3D=
=3D 0))
+               if (dir =3D=3D 0 && (brt->brt_vlan =3D=3D vlan))
                        return (brt);
                if (dir > 0)
                        return (NULL);

I assume you've got something similar? Do you want to post a review or shou=
ld I
post this one? Either way, we should copy philip@, because I remember him
working on enhancing the bridge's support for vlans, so he may have useful
things to say.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-270559-7501-4YqljOo5qV>