Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 May 2024 08:34:19 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 279195] kernel panic while re-configuring if_vlan(4) vlan id
Message-ID:  <bug-279195-227-ikbl3Lfx4E@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-279195-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-279195-227@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=3D279195

Kristof Provost <kp@freebsd.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kp@freebsd.org

--- Comment #2 from Kristof Provost <kp@freebsd.org> ---
Yeah, that seems to need this:

diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index b69d8107e30d..b936d4673404 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1715,10 +1715,17 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p,
uint16_t vid,
                ifv->ifv_proto =3D proto;

                if (ifv->ifv_vid !=3D vid) {
+                       int oldvid =3D ifv->ifv_vid;
+
                        /* Re-hash */
                        vlan_remhash(trunk, ifv);
                        ifv->ifv_vid =3D vid;
                        error =3D vlan_inshash(trunk, ifv);
+                       if (error) {
+                               ifv->ifv_vid =3D oldvid;
+                               /* Re-insert back where we found it. */
+                               vlan_inshash(trunk, ifv);
+                       }
                }
                /* Will unlock */
                goto done;

After # ifconfig vlan0 vlan 110 you'll see that vlan0 thinks it's on 111, so
when it tries to vlan_remhash() it's not where it expects to find it.

There may be a similar problem in the case where we don't yet have a vlande=
v.

--=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-279195-227-ikbl3Lfx4E>