From owner-freebsd-bugs@FreeBSD.ORG Thu Jul 21 07:50:22 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 47A8016A41F for ; Thu, 21 Jul 2005 07:50:22 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B391943D49 for ; Thu, 21 Jul 2005 07:50:20 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j6L7oGdF063690 for ; Thu, 21 Jul 2005 07:50:16 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j6L7oGxk063689; Thu, 21 Jul 2005 07:50:16 GMT (envelope-from gnats) Resent-Date: Thu, 21 Jul 2005 07:50:16 GMT Resent-Message-Id: <200507210750.j6L7oGxk063689@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Eygene A.Ryabinkin" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 16E4916A41F for ; 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 ; 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" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: kern/83833: vx(4) driver can not be (really) put into promiscous mode X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "Eygene A.Ryabinkin" List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jul 2005 07:50:22 -0000 >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@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: