kern/99500: [netgraph] [patch] netgraph doesn't honor the monitor
interface flag
Craig Leres
leres at ee.lbl.gov
Mon Jun 26 22:32:53 UTC 2006
>Number: 99500
>Category: kern
>Synopsis: [netgraph] [patch] netgraph doesn't honor the monitor interface flag
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Jun 26 22:30:26 GMT 2006
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:
More information about the freebsd-bugs
mailing list