From owner-freebsd-bugs@FreeBSD.ORG Thu Mar 25 08:20:23 2004 Return-Path: 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 EDC0E16A4CE for ; Thu, 25 Mar 2004 08:20:22 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id CD04543D48 for ; Thu, 25 Mar 2004 08:20:22 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i2PGKMbv052082 for ; Thu, 25 Mar 2004 08:20:22 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i2PGKMji052081; Thu, 25 Mar 2004 08:20:22 -0800 (PST) (envelope-from gnats) Resent-Date: Thu, 25 Mar 2004 08:20:22 -0800 (PST) Resent-Message-Id: <200403251620.i2PGKMji052081@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, Ed Maste Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E840C16A4D0 for ; Thu, 25 Mar 2004 08:13:31 -0800 (PST) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id E1E2243D49 for ; Thu, 25 Mar 2004 08:13:31 -0800 (PST) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.10/8.12.10) with ESMTP id i2PGDV72090256 for ; Thu, 25 Mar 2004 08:13:31 -0800 (PST) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.10/8.12.10/Submit) id i2PGDVHB090255; Thu, 25 Mar 2004 08:13:31 -0800 (PST) (envelope-from nobody) Message-Id: <200403251613.i2PGDVHB090255@www.freebsd.org> Date: Thu, 25 Mar 2004 08:13:31 -0800 (PST) From: Ed Maste To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Subject: kern/64718: [patch] Bridged packets still seen by BPF listener after BIOCSEESENT ioctl. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Mar 2004 16:20:23 -0000 >Number: 64718 >Category: kern >Synopsis: [patch] Bridged packets still seen by BPF listener after BIOCSEESENT ioctl. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Mar 25 08:20:22 PST 2004 >Closed-Date: >Last-Modified: >Originator: Ed Maste >Release: 4.7 >Organization: Sandvine Inc. >Environment: FreeBSD 4.7 >Description: The BIOCSSEESENT ioctl sets a flag that controls whether received packets only, or both transmitted and received packets, are captured by BPF. This flag does not have any effect for packets transmitted by an interface as a result of bridging. These packets are always seen by the BPF listener. >How-To-Repeat: sysctl net.link.ether.bridge=1 sysctl net.link.ether.bridge_cfg="em0 em1" Open a bpf listener on em0 and set the BIOCSEESENT flag to zero. Observe that both packets received on em0, and packets bridged from em1 to em0, are caught by BPF. It seems that bpf_mtap uses m->m_pkthdr.rcvif == NULL as an indication that the packet is was transmitted, and that bridged packets still have the rcvif set. >Fix: This is one way to get around the problem: --- bridge.c.orig 2003-12-29 14:07:02.000000000 -0500 +++ bridge.c 2004-03-22 16:52:27.000000000 -0500 @@ -1080,6 +1080,11 @@ return m0; bcopy(&save_eh, mtod(m, struct ether_header *), ETHER_HDR_LEN); } + /* + * Clear rcvif so that a bpf listener on the output interface + * won't see this packet if it has SEESENT off. + */ + m->m_pkthdr.rcvif = 0; if (!IF_HANDOFF(&last->if_snd, m, last)) { #if 0 BDG_MUTE(last); /* should I also mute ? */ >Release-Note: >Audit-Trail: >Unformatted: