From rea@rea.mbslab.kiae.ru  Thu Jul 21 07:49:28 2005
Return-Path: <rea@rea.mbslab.kiae.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 16E4916A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 21 Jul 2005 07:49:28 +0000 (GMT)
	(envelope-from rea@rea.mbslab.kiae.ru)
Received: from rea.mbslab.kiae.ru (rea.mbslab.kiae.ru [144.206.177.25])
	by mx1.FreeBSD.org (Postfix) with ESMTP id A5C6743D4C
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 21 Jul 2005 07:49:27 +0000 (GMT)
	(envelope-from rea@rea.mbslab.kiae.ru)
Received: by rea.mbslab.kiae.ru (Postfix, from userid 1000)
	id 76B63BC70; Thu, 21 Jul 2005 11:49:26 +0400 (MSD)
Message-Id: <20050721074926.76B63BC70@rea.mbslab.kiae.ru>
Date: Thu, 21 Jul 2005 11:49:26 +0400 (MSD)
From: Eygene A.Ryabinkin <rea@rea.mbslab.kiae.ru>
Reply-To: Eygene A.Ryabinkin <rea@rea.mbslab.kiae.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: vx(4) driver can not be (really) put into promiscous mode
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         83833
>Category:       kern
>Synopsis:       vx(4) driver can not be (really) put into promiscous mode
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    ru
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 21 07:50:16 GMT 2005
>Closed-Date:    Wed Sep 28 16:54:54 GMT 2005
>Last-Modified:  Wed Sep 28 16:54:54 GMT 2005
>Originator:     Eygene A. Ryabinkin
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
Code Labs
>Environment:
System: FreeBSD rea.mbslab.kiae.ru 5.4-STABLE FreeBSD 5.4-STABLE #: Tue Jul 12 20:52:50 MSD 2005 root@rea.mbslab.kiae.ru:/usr/src/sys/i386/compile/REA i386
>Description:
 vx(4) driver does not have the "real" promiscous mode. It checks wheither
the packed is destined to this card (or is broadcast, or multicast) and rejects
all other packets no matter what. Driver source tells us that there are some
cards that are "living" in promiscous mode, so that hack was made. But if we
do want promiscous mode, we will not have it at all on any vx-driven card.
>How-To-Repeat:
 Obtain some 3COM Vortex PCI card, plug it into the PCI slot and try to sniff
the packets from the network in the promiscous mode.
>Fix:
 Check IFF_PROMISC flag and do not discard packets not destined to us when the
flag is set. This will fix the behaviour of both broken and good cards in both
(normal and promiscous) modes.
 Patch follows:

--- /sys/dev/vx/if_vx.c.orig	Wed Feb 13 03:43:10 2002
+++ /sys/dev/vx/if_vx.c	Wed Jul 20 12:59:31 2005
@@ -738,10 +738,13 @@
      * XXX: Some cards seem to be in promiscous mode all the time.
      * we need to make sure we only get our own stuff always.
      * bleah!
+     * XXX: some cards are put into promiscous mode intentionally,
+     * we must not break them.
      */
 
-    if ((eh->ether_dhost[0] & 1) == 0		/* !mcast and !bcast */
-      && bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN) != 0) {
+    if ((ifp->if_flags & IFF_PROMISC) == 0 &&
+      ((eh->ether_dhost[0] & 1) == 0		/* !mcast and !bcast */
+      && bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN) != 0)) {
 	m_freem(m);
 	return;
     }
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: ru 
State-Changed-When: Fri Jul 22 11:26:59 GMT 2005 
State-Changed-Why:  
Fixed in 7.0-CURRENT (src/sys/dev/vx/if_vx.c,v 1.57). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=83833 
Responsible-Changed-From-To: freebsd-bugs->ru 
Responsible-Changed-By: ru 
Responsible-Changed-When: Fri Jul 22 11:27:54 GMT 2005 
Responsible-Changed-Why:  

http://www.freebsd.org/cgi/query-pr.cgi?pr=83833 
State-Changed-From-To: patched->closed 
State-Changed-By: ru 
State-Changed-When: Wed Sep 28 16:52:29 GMT 2005 
State-Changed-Why:  
Fix merged into RELENG_6 and RELENG_5. 

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