[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 [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to