From nobody@FreeBSD.org  Wed May 30 18:38:38 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 07CBC16A41F
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 30 May 2007 18:38:38 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id E5D7313C448
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 30 May 2007 18:38:37 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l4UIcbl2024341
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 30 May 2007 18:38:37 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l4UIcbRx024340;
	Wed, 30 May 2007 18:38:37 GMT
	(envelope-from nobody)
Message-Id: <200705301838.l4UIcbRx024340@www.freebsd.org>
Date: Wed, 30 May 2007 18:38:37 GMT
From: Christos Dionissopoulos<chdio@debug.gr>
To: freebsd-gnats-submit@FreeBSD.org
Subject: if_bridge span produces kernel panic
X-Send-Pr-Version: www-3.0

>Number:         113170
>Category:       kern
>Synopsis:       if_bridge: span produces kernel panic
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    thompsa
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 30 18:40:04 GMT 2007
>Closed-Date:    Wed Jun 13 10:43:03 GMT 2007
>Last-Modified:  Wed Jun 13 10:43:03 GMT 2007
>Originator:     Christos Dionissopoulos
>Release:        Current-7
>Organization:
>Environment:
FreeBSD mail.debug.gr 7.0-CURRENT FreeBSD 7.0-CURRENT #2: Tue May 7 11:53:05 EEST 2007     root@mail.debug.gr:/usr/obj/usr/src/sys/DEV7  i386

>Description:
Trying to make clean-layer2 traffic (STP/CDP) to flow from one switch to another (unidirectional), I figure out that if_bridge(4) filters pure-layer2 frames (non-IP), unless you use a span port on a single-port "bridge".
  
But, when I create a if_bridge(4) interface with 2 ethernet ports configured as follows:

- NIC1, as a normal attached bridging port, and
- NIC2, as a span port 

this results a kernel panic.
 
If I run a kernel with debuging options enabled, I see a KASSERT that describes the "panic" as shown in /usr/src/sys/net/if_bridge.c line:2757

        /* we may return with the IP fields swapped, ensure its not shared */
        KASSERT(M_WRITABLE(*mp), ("%s: modifying a shared mbuf", __func__));

any ideas/patch are welcome.
>How-To-Repeat:
ifconfig bridge0 create
ifconfig bridge0 addm em0 span em1
ifconfig em0 up
ifconfig em1 up
ifconfig bridge0 up

just wait for some traffic (layer2-only included, like STP/CDP) to flow thru interfaces and KASSERT error message appears with kernel panic.


 
>Fix:



>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->thompsa 
Responsible-Changed-By: remko 
Responsible-Changed-When: Wed May 30 18:43:09 UTC 2007 
Responsible-Changed-Why:  
Reassign to Andrew, also reclassify since this is not I386 material 
but kernel material. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=113170 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/113170: commit references a PR
Date: Wed, 30 May 2007 19:40:02 +0000 (UTC)

 thompsa     2007-05-30 19:39:55 UTC
 
   FreeBSD src repository
 
   Modified files:
     sys/net              if_bridge.c 
   Log:
   Remove a KASSERT intended to help the developer, the condition is no longer
   valid since the span code was added.
   
   PR:             kern/113170
   MFC after:      1 week
   
   Revision  Changes    Path
   1.99      +2 -0      src/sys/net/if_bridge.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: Andrew Thompson <thompsa@FreeBSD.org>
To: bug-followup@FreeBSD.org, chdio@debug.gr
Cc:  
Subject: Re: kern/113170: if_bridge: span produces kernel panic
Date: Thu, 31 May 2007 07:43:50 +1200

 Hi Christos,
 
 
 Can you please verify that everything is ok now that the KASSERT has
 been removed, as you found out the test it was performing is no longer
 correct. Thanks for the bug report.
 
 
 regards,
 Andrew

From: Christos Dionissopoulos <chdio@debug.gr>
To: Andrew Thompson <thompsa@FreeBSD.org>
Cc: Bug followup <bug-followup@FreeBSD.org>
Subject:  Re: kern/113170: =?UTF-8?Q?if=5Fbridge=3A=20span=20produces=20kernel=20pa?=
 =?UTF-8?Q?nic?=
Date: Thu, 31 May 2007 10:10:59 +0300

 Andrew,
 
 Bridge seems to works stable with if_bridge.c version 1.99.
 
 Many thanks for your instant help!!!
 
 regards,
 Christos.
 
 On Thu, 31 May 2007 07:43:50 +1200, Andrew Thompson <thompsa@FreeBSD.org>
 wrote:
 > Hi Christos,
 > 
 > 
 > Can you please verify that everything is ok now that the KASSERT has
 > been removed, as you found out the test it was performing is no longer
 > correct. Thanks for the bug report.
 > 
 > 
 > regards,
 > Andrew
 
State-Changed-From-To: open->closed 
State-Changed-By: thompsa 
State-Changed-When: Wed Jun 13 10:42:16 UTC 2007 
State-Changed-Why:  
Submitter reports its all working now, thanks for the PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=113170 
>Unformatted:
