Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Aug 2001 19:58:00 +0400
From:      Yar Tikhiy <yar@FreeBSD.ORG>
To:        Archie Cobbs <archie@dellroad.org>
Cc:        Mike Tancsa <mike@sentex.net>, stable@FreeBSD.ORG, net@FreeBSD.ORG
Subject:   Re: kernel panic when bringing up a VLAN interface (netgraph?)
Message-ID:  <20010830195759.A21176@comp.chem.msu.su>
In-Reply-To: <200108292247.f7TMl6i40209@arch20m.dellroad.org>; from archie@dellroad.org on Wed, Aug 29, 2001 at 03:47:06PM -0700
References:  <20010829214910.A204@comp.chem.msu.su> <200108292247.f7TMl6i40209@arch20m.dellroad.org>

next in thread | previous in thread | raw e-mail | index | archive | help
[adding -net to the Cc: list]

On Wed, Aug 29, 2001 at 03:47:06PM -0700, Archie Cobbs wrote:
> Yar Tikhiy writes:
> > Why does gdb report the values of "ifp" and "mp" inconsistently?
> > The kernel crashed at the first line of ng_ether_output(), so
> > the arguments couldn't be modified... I'm confused.
> 
> Optimization.. it's probably reusing the same variable/register for
> both 'ifp' and 'node'. So 'node' is NULL, which indicates that
> ether_ifattach() was probably never called on this interface.

Yes it was.  As I've just traced, it's ng_ether_mod_event() that
is responsible for the panic.  When ng_ether is being loaded as a
module, or just initialized as a part of a kernel, it attaches all
existing ethernet interfaces to netgraph using ng_ether_attach().
However, the vlan interface has a different type, IFT_L2VLAN, so
it won't get attached to netgraph properly. On the other hand, vlan
can't attach to netgraph by itself because its init function is
usually called earlier that that of ng_ether.

Peter Block on -net reported that he had avoided the panic by fiddling
with initialization order.  However, that was a hack, not a solution.

I'd suggest the following fix.  Not sure if it should be pushed
into the upcoming 4.4-RELEASE...

Index: ng_ether.c
===================================================================
RCS file: /home/ncvs/src/sys/netgraph/ng_ether.c,v
retrieving revision 1.18
diff -u -r1.18 ng_ether.c
--- ng_ether.c	2001/01/30 20:51:52	1.18
+++ ng_ether.c	2001/08/30 15:33:24
@@ -798,7 +798,8 @@
 
 		/* Create nodes for any already-existing Ethernet interfaces */
 		TAILQ_FOREACH(ifp, &ifnet, if_link) {
-			if (ifp->if_type == IFT_ETHER)
+			if (ifp->if_type == IFT_ETHER ||
+			    ifp->if_type == IFT_L2VLAN)
 				ng_ether_attach(ifp);
 		}
 		break;

-- 
Yar

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010830195759.A21176>