Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jun 2010 09:39:18 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        freebsd-ipfw@freebsd.org
Subject:   Re: cdpd/ladvd panic after r205511 MFC
Message-ID:  <20100610143917.GH85961@dan.emsphone.com>
In-Reply-To: <20100423163926.GD14572@dan.emsphone.com>
References:  <20100423163926.GD14572@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Apr 23), Dan Nelson said:
> I recently upgraded my 8-stable i386 kernel, and ladvd caused a panic
> during bootup.  ladvd is a deamon that sends out switch discovery frames
> via /dev/bpf .  Switching to cdpd (another program like ladvd) results in
> the same panic.
> 
> I traced it down to the ipfw MFC on 2010-03-23 (rev r205511). 
> Unfortunately, all my crash dumps give garbage stack traces so the only
> info I have is the trap log and a DDB backtrace.  I can generate more
> crashdumps if they are needed for debugging.

I found the cause of the panic and have a band-aid patch, but don't know
enough about ipfw or bpf to really fix it.  The underlying cause is the
ipfw0 pseudo ethernet device that the MFC added isn't fully initialized, and
when a process tries to inject packets via bpf to it, the bpf code panics
when checking to see if the packet is a broadcast packet.  I don't know if
the fix is to better initialize the current ipfw0 device, somehow mark it as
read-only, or to set it up as some other interface that looks less like
Ethernet, but this patch at least fixes bpf to not panic:

Index: net/bpf.c
===================================================================
--- net/bpf.c	(revision 208966)
+++ net/bpf.c	(working copy)
@@ -515,7 +515,9 @@
 	case DLT_EN10MB:
 		eh = mtod(m, struct ether_header *);
 		if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
-			if (bcmp(ifp->if_broadcastaddr, eh->ether_dhost,
+			/* not all interfaces have broadcast addresses */
+			if (ifp->if_broadcastaddr && 
+			    bcmp(ifp->if_broadcastaddr, eh->ether_dhost,
 			    ETHER_ADDR_LEN) == 0)
 				m->m_flags |= M_BCAST;
 			else



-- 
	Dan Nelson
	dnelson@allantgroup.com



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