From nobody@FreeBSD.org  Wed May 23 01:58:24 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 4B10537B424
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 23 May 2001 01:58:24 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.1/8.11.1) id f4N8wOQ48107;
	Wed, 23 May 2001 01:58:24 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200105230858.f4N8wOQ48107@freefall.freebsd.org>
Date: Wed, 23 May 2001 01:58:24 -0700 (PDT)
From: hino@ccm.cl.nec.co.jp
To: freebsd-gnats-submit@FreeBSD.org
Subject: pci/if_ti.c has a problem regarding to VLAN
X-Send-Pr-Version: www-1.0

>Number:         27567
>Category:       kern
>Synopsis:       pci/if_ti.c has a problem regarding to VLAN
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 23 02:00:00 PDT 2001
>Closed-Date:    Wed May 23 12:25:20 PDT 2001
>Last-Modified:  Wed May 23 12:25:32 PDT 2001
>Originator:     Koji HINO
>Release:        FreeBSD 4.3-RELEASE
>Organization:
NEC
>Environment:
FreeBSD dove.ccm.cl.nec.co.jp 4.3-RELEASE FreeBSD 4.3-RELEASE #4: Wed May 23 11:54:58 JST 2001 hino@dove.ccm.cl.nec.co.jp:/usr/src/sys/compile/DOVE  i386

>Description:
On VLANs configured on ti0 (Netgear GA620), specific packets are lost to receive. In my case, Cabletron/Enterasys SSR8000 L3 Switch's ARP request and ARP reply to the FreeBSD box can not be received always, as long as tcpdump said.
I checked if_ti.c and if_vlan.c, inserting debug messages, and found that, when receiving these problematic packets, VLAN tag is > 4095. As IEEE 802.1Q said, VLAN tag field is 12bit wide, so this is not good.
Lower 12 bit of the VLAN tag is correct, so I patched to mask. Works great!

I don't know why upper 4 bits of the VLAN tag are set, because I can't find source code of Tigon firmware, but suppose that priority field of 802.1Q VLAN packet may cause this problem.
>How-To-Repeat:
Said above.
>Fix:
Patch bellow will fix the problem. I don't know if sending side need masking or not.

--- pci/if_ti.c.dist    Thu Aug 24 09:07:58 2000
+++ pci/if_ti.c Wed May 23 11:54:47 2001
@@ -1846,7 +1846,7 @@
 #if NVLAN > 0
                if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) {
                        have_tag = 1;
-                       vlan_tag = cur_rx->ti_vlan_tag;
+                       vlan_tag = cur_rx->ti_vlan_tag & 0xfff;
                }
 #endif

@@ -2106,7 +2106,7 @@
 #if NVLAN > 0
                        if (ifv != NULL) {
                                f->ti_flags |= TI_BDFLAG_VLAN_TAG;
-                               f->ti_vlan_tag = ifv->ifv_tag;
+                               f->ti_vlan_tag = ifv->ifv_tag & 0xfff;
                        } else {
                                f->ti_vlan_tag = 0;
                        }

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: phk 
State-Changed-When: Wed May 23 12:25:20 PDT 2001 
State-Changed-Why:  
Committed, thanks! 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27567 
>Unformatted:
