From owner-freebsd-bugs@FreeBSD.ORG Thu Oct 1 00:00:08 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4D31106568D for ; Thu, 1 Oct 2009 00:00:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 797AF8FC15 for ; Thu, 1 Oct 2009 00:00:08 +0000 (UTC) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n91008oY008285 for ; Thu, 1 Oct 2009 00:00:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n91008uF008280; Thu, 1 Oct 2009 00:00:08 GMT (envelope-from gnats) Resent-Date: Thu, 1 Oct 2009 00:00:08 GMT Resent-Message-Id: <200910010000.n91008uF008280@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, P Kern Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3050C106568B for ; Wed, 30 Sep 2009 23:51:50 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 1E4608FC1B for ; Wed, 30 Sep 2009 23:51:50 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n8UNpnxW096463 for ; Wed, 30 Sep 2009 23:51:49 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n8UNpncW096462; Wed, 30 Sep 2009 23:51:49 GMT (envelope-from nobody) Message-Id: <200909302351.n8UNpncW096462@www.freebsd.org> Date: Wed, 30 Sep 2009 23:51:49 GMT From: P Kern To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/139268: patch to allow if_bridge to forward just VLAN-tagged (or untagged) packets X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2009 00:00:08 -0000 >Number: 139268 >Category: kern >Synopsis: patch to allow if_bridge to forward just VLAN-tagged (or untagged) packets >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Oct 01 00:00:08 UTC 2009 >Closed-Date: >Last-Modified: >Originator: P Kern >Release: 7.2-RELEASE >Organization: University of Toronto CNS >Environment: FreeBSD utcs 7.2-RELEASE FreeBSD 7.2-RELEASE #4: Thu Sep 24 03:59:57 UTC 2009 pak@utcs:/usr/src/sys/i386/compile/BUG i386 >Description: This patch to if_bridge(4) allows the use of the 'link0' or 'link1' interface options to control whether the bridge forwards all packets or just packets with VLAN tags or just packets without VLAN tags (vlan 0?). Use 'ifconfig bridge0 link0' to make a bridge forward only untagged packets, leaving the tagged packets to be forwarded or processed separately, by other bridges or cloned interfaces. >How-To-Repeat: >Fix: Patch attached with submission follows: --- sys/net/if_bridge.c 2009/09/29 17:20:13 1.1 +++ sys/net/if_bridge.c 2009/09/29 17:45:14 @@ -2109,6 +2109,16 @@ return (m); bifp = sc->sc_ifp; + + if (m->m_flags & M_VLANTAG) { /* packet has a valid VLAN tag */ + if (bifp->if_flags & IFF_LINK0) + /* LINK0 == only bridge untagged packets. skip VLANs. */ + return (m); + } + else if (bifp->if_flags & IFF_LINK1) { + /* LINK1 == only bridge VLAN-tagged packets. skip untagged. */ + return (m); + } vlan = VLANTAGOF(m); /* --- share/man/man4/if_bridge.4 2009/09/30 23:02:12 1.1 +++ share/man/man4/if_bridge.4 2009/09/30 23:24:25 @@ -126,6 +126,23 @@ stream. This is useful for reconstructing the traffic for network taps that transmit the RX/TX signals out through two separate interfaces. +.Pp +The +.Nm +driver also supports two special link options: +.Bl -tag -width link0 +.It Cm link0 +Forward only those packets that do +.Cm not +contain valid VLAN tags (ie. packets in vlan 0). +This allows VLAN-tagged packets to be bridged or processed separately. +.El +.Bl -tag -width link1 +.It Cm link1 +Forward only those packets that do contain valid VLAN tags. +This is the complement of +.Cm link0. +.El .Sh SPANNING TREE The .Nm >Release-Note: >Audit-Trail: >Unformatted: