Subject: kern/34276: inconsistent code in ether_input()
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <bad@bsd.de>
List: netbsd-bugs
Date: 08/24/2006 19:00:01
>Number:         34276
>Category:       kern
>Synopsis:       ether_input() refernces ec_nvlans inconsitently
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 24 19:00:01 +0000 2006
>Originator:     Christoph Badura
>Release:        NetBSD 3.0_STABLE
>Organization:
	
>Environment:
	
	
System: NetBSD limiting-factor 3.0_STABLE NetBSD 3.0_STABLE (GENERIC_LAPTOP) #1: Fri Aug 11 00:20:07 MEST 2006 root@limiting-factor:/u/2/obj/u/1/src/sys/arch/i386/compile/GENERIC_LAPTOP i386
Architecture: i386
Machine: i386
>Description:
	
sys/net/if_ethersubr.c contains the following lines in ether_input():

if (ec->ec_nvlans && m_tag_find(m, PACKET_TAG_VLAN, NULL) != NULL) {

and right after that:

if (((struct ethercom *)ifp)->ec_nvlans != 0)

Only one of these lines can be correct because ifp may have been modified
after assigning ec by the bridge code.

I haven't looked at other parts of the code for similar errors.

>How-To-Repeat:
	
code inspection
>Fix:
	
not sure. maybe recompute "ec" in the bridge case.

>Unformatted: