kern/83833: vx(4) driver can not be (really) put into promiscous mode

Eygene A.Ryabinkin rea at rea.mbslab.kiae.ru
Thu Jul 21 07:50:22 GMT 2005


>Number:         83833
>Category:       kern
>Synopsis:       vx(4) driver can not be (really) put into promiscous mode
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 21 07:50:16 GMT 2005
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:


More information about the freebsd-bugs mailing list