From owner-freebsd-ipfw@FreeBSD.ORG Thu Jun 10 14:39:23 2010 Return-Path: Delivered-To: freebsd-ipfw@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B91E1065675 for ; Thu, 10 Jun 2010 14:39:23 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by mx1.freebsd.org (Postfix) with ESMTP id 08BF48FC1E for ; Thu, 10 Jun 2010 14:39:22 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id o5AEdI8O041403 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 10 Jun 2010 09:39:19 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.4/8.14.4) with ESMTP id o5AEdI7b008856 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 10 Jun 2010 09:39:18 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.4/8.14.3/Submit) id o5AEdIeu008855 for freebsd-ipfw@freebsd.org; Thu, 10 Jun 2010 09:39:18 -0500 (CDT) (envelope-from dan) Date: Thu, 10 Jun 2010 09:39:18 -0500 From: Dan Nelson To: freebsd-ipfw@freebsd.org Message-ID: <20100610143917.GH85961@dan.emsphone.com> References: <20100423163926.GD14572@dan.emsphone.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100423163926.GD14572@dan.emsphone.com> X-OS: FreeBSD 8.0-STABLE User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: clamav-milter 0.96 at email1.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Thu, 10 Jun 2010 09:39:19 -0500 (CDT) X-Scanned-By: MIMEDefang 2.45 Subject: Re: cdpd/ladvd panic after r205511 MFC X-BeenThere: freebsd-ipfw@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: IPFW Technical Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jun 2010 14:39:23 -0000 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