From leres@ee.lbl.gov  Mon Jun 26 22:24:19 2006
Return-Path: <leres@ee.lbl.gov>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2802116A404
	for <freebsd-gnats-submit@freebsd.org>; Mon, 26 Jun 2006 22:24:19 +0000 (UTC)
	(envelope-from leres@ee.lbl.gov)
Received: from fun.ee.lbl.gov (fun.ee.lbl.gov [131.243.1.81])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 89DD844810
	for <freebsd-gnats-submit@freebsd.org>; Mon, 26 Jun 2006 22:24:11 +0000 (GMT)
	(envelope-from leres@ee.lbl.gov)
Received: from fun.ee.lbl.gov (localhost [127.0.0.1])
	by fun.ee.lbl.gov (8.13.7/8.13.7) with ESMTP id k5QMOBos015436
	for <freebsd-gnats-submit@freebsd.org>; Mon, 26 Jun 2006 15:24:11 -0700 (PDT)
Received: from fun.ee.lbl.gov (leres@localhost)
	by fun.ee.lbl.gov (8.13.7/8.13.7/Submit) with ESMTP id k5QMOBgT015433
	for <freebsd-gnats-submit@freebsd.org>; Mon, 26 Jun 2006 15:24:11 -0700 (PDT)
Message-Id: <200606262224.k5QMOBgT015433@fun.ee.lbl.gov>
Date: Mon, 26 Jun 2006 15:24:11 -0700
From: Craig Leres <leres@ee.lbl.gov>
To: To: ;
Subject: [netgraph] [patch] netgraph doesn't honor the monitor interface flag
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         99500
>Category:       kern
>Synopsis:       [netgraph] [patch] netgraph doesn't honor the monitor interface flag
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    glebius
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 26 22:30:26 GMT 2006
>Closed-Date:    Sat Jan 10 00:04:42 UTC 2009
>Last-Modified:  Sat Jan 10 00:04:42 UTC 2009
>Originator:     Craig Leres
>Release:        FreeBSD 6.1-RELEASE i386
>Organization:
Lawrence Berkeley National Laboratory
>Environment:
	fox 128 % uname -a
	FreeBSD fox.ee.lbl.gov 6.1-RELEASE FreeBSD 6.1-RELEASE #3: Tue Jun 20 11:50:33 PDT 2006     leres@fox.ee.lbl.gov:/usr/src/6.1-RELEASE/sys/i386/compile/LBLSMP  i386

>Description:
	When using netgraph to "bond" two syskonnect gige interfaces
	together for a packet capture application, we see output
	errors on the pseudo interface that is the sum of the number
	of packets input on the two syskonnect NICs. Examination
	of the code reveals that this is because the packets cannot
	be transmitted out the pseudo interface.

>How-To-Repeat:
	This is our setup:

	    kldload ng_ether

	    ifconfig sk0 promisc -arp up
	    ifconfig sk1 promisc -arp up

	    ngctl mkpeer . eiface hook ether
	    ngctl mkpeer ngeth0: one2many lower one
	    ngctl connect sk0: ngeth0:lower lower many0
	    ngctl connect sk1: ngeth0:lower lower many1

	    ifconfig ngeth0 -arp monitor up

>Fix:
	The appended patch causes netgraph to check the monitor bit
	and discard the packet if it's set; it also increments the
	input packet counter (which perhaps it should always do?)

	I suspect there are other places in netgraph where this
	should be done.

===================================================================
RCS file: netgraph/RCS/ng_eiface.c,v
retrieving revision 1.1
diff -c -r1.1 netgraph/ng_eiface.c
*** netgraph/ng_eiface.c	2006/06/26 21:56:36	1.1
--- netgraph/ng_eiface.c	2006/06/26 22:14:40
***************
*** 25,31 ****
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   *
!  * $FreeBSD: src/sys/netgraph/ng_eiface.c,v 1.32.2.4 2006/02/14 06:21:47 ru Exp $
   */
  
  #include <sys/param.h>
--- 25,31 ----
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   *
!  * $FreeBSD: src/sys/netgraph/ng_eiface.c,v 1.32.2.4+ 2006/02/14 06:21:47 ru Exp $
   */
  
  #include <sys/param.h>
***************
*** 233,238 ****
--- 233,244 ----
  		 * XXX is this safe? locking?
  		 */
  		BPF_MTAP(ifp, m);
+ 
+ 		if (ifp->if_flags & IFF_MONITOR) {
+ 			ifp->if_ipackets++;
+ 			m_freem(m);
+ 			continue;
+ 		}
  
  		/*
  		 * Send packet; if hook is not connected, mbuf will get
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->glebius 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Fri Aug 11 13:28:35 UTC 2006 
Responsible-Changed-Why:  
I'll handle this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=99500 
State-Changed-From-To: open->patched 
State-Changed-By: glebius 
State-Changed-When: Thu Jul 26 10:53:37 UTC 2007 
State-Changed-Why:  
Committed, thanks. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/99500: commit references a PR
Date: Thu, 26 Jul 2007 10:54:43 +0000 (UTC)

 glebius     2007-07-26 10:54:34 UTC
 
   FreeBSD src repository
 
   Modified files:
     sys/netgraph         ng_eiface.c 
   Log:
   Honor the IFF_MONITOR flag.
   
   PR:             kern/99500
   Submitted by:   Craig Leres <leres ee.lbl.gov>
   Approved by:    re (kensmith)
   
   Revision  Changes    Path
   1.39      +6 -0      src/sys/netgraph/ng_eiface.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"
 
State-Changed-From-To: patched->closed 
State-Changed-By: mav 
State-Changed-When: Sat Jan 10 00:03:29 UTC 2009 
State-Changed-Why:  
Patch was committed long ago, so I think we can close PR. 

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