From owner-freebsd-bugs Fri Dec 20 9:50: 6 2002 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 65D0937B401 for ; Fri, 20 Dec 2002 09:50:03 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 393D643EDE for ; Fri, 20 Dec 2002 09:50:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gBKHo2NS057321 for ; Fri, 20 Dec 2002 09:50:02 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gBKHo2cA057320; Fri, 20 Dec 2002 09:50:02 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8B02A37B401 for ; Fri, 20 Dec 2002 09:48:53 -0800 (PST) Received: from smtp.kolej.mff.cuni.cz (smtp.kolej.mff.cuni.cz [195.113.25.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id C012943EF7 for ; Fri, 20 Dec 2002 09:48:51 -0800 (PST) (envelope-from dan@obluda.cz) Received: from dan.kolej.mff.cuni.cz (dan.kolej.mff.cuni.cz [195.113.21.110]) by smtp.kolej.mff.cuni.cz (8.11.6/8.11.6) with ESMTP id gBKHmrr20646 for ; Fri, 20 Dec 2002 18:48:54 +0100 (CET) (envelope-from dan@obluda.cz) Received: from obluda.cz (localhost [127.0.0.1]) by dan.kolej.mff.cuni.cz (8.12.6/8.12.6) with ESMTP id gBKHmnUD006510 for ; Fri, 20 Dec 2002 18:48:49 +0100 (CET) (envelope-from dan@obluda.cz) Received: (from dan@localhost) by obluda.cz (8.12.6/8.12.6/Submit) id gBKHmn9s006509; Fri, 20 Dec 2002 18:48:49 +0100 (CET) Message-Id: <200212201748.gBKHmn9s006509@obluda.cz> Date: Fri, 20 Dec 2002 18:48:49 +0100 (CET) From: Dan Lukes Reply-To: Dan Lukes To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/46405: [PATCH] Bad VLAN handling on NIC's with VLAN hardware support Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 46405 >Category: kern >Synopsis: [PATCH] Bad VLAN handling on NIC's with VLAN hardware support >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Dec 20 09:50:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Dan Lukes >Release: FreeBSD 4.7-STABLE i386 and FreeBSD 5.0-CURRENT >Organization: Obludarium >Environment: System: FreeBSD 4.7-STABLE System: FreeBSD 5.0-CURRENT On 4: src/sys/net/if_vlan.c,v 1.15.2.12 2002/04/04 05:51:55 luigi Exp On 5: src/sys/net/if_vlan.c,v 1.44 2002/11/14 23:43:16 sam Exp An NIC with hardware support for VLANs (using vlan_input_tag routine on 4 or MTAG_VLAN_TAG on 5) >Description: The TAG_CONTROL_INFO word on front of VLAN packet contain not only the 12 bites of VLAN tag, but also 3 bites of priority and 1 bite CFI. The driver pass unmodified TAG to vlan driver (either thru vlan_input_tag call or via mbuf's MTAG_VLAN_TAG). VLAN driver doesn't strip the CFI and priority bits from tag, so it fail to match correponding vlan unless all priority bits and CFI are zero. The packet with non-zero priority is dropped. >How-To-Repeat: See hardware configuration above. Then send a vlan packet with non-zero priority bit to FreeBSD's NIC (for example from CISCO 2950 sends some) We also should think about special VLAN ID "zero" - the FreeBSD can't correctly process them for now. It problem is not covered by patches presented bellow. >Fix: Extract the VLAN ID only bits from tag on vlan_input(_tag) routine. On STABLE: *** if_vlan.c.ORIG Tue Apr 9 10:46:12 2002 --- if_vlan.c Fri Dec 20 18:17:28 2002 *************** *** 420,425 **** --- 420,426 ---- { struct ifvlan *ifv; + t = EVL_VLANOFTAG(t); /* * Fake up a header and send the packet to the physical interface's * bpf tap if active. On CURRENT: *** if_vlan.c.ORIG Mon Nov 18 11:39:41 2002 --- if_vlan.c Fri Dec 20 18:15:56 2002 *************** *** 394,400 **** * Packet is tagged, m contains a normal * Ethernet frame; the tag is stored out-of-band. */ ! tag = *(u_int*)(mtag+1); m_tag_delete(m, mtag); } else { switch (ifp->if_type) { --- 394,400 ---- * Packet is tagged, m contains a normal * Ethernet frame; the tag is stored out-of-band. */ ! tag = EVL_VLANOFTAG(*(u_int*)(mtag+1)); m_tag_delete(m, mtag); } else { switch (ifp->if_type) { >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message