From owner-cvs-src@FreeBSD.ORG Mon Jul 7 16:45:11 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 618) id 3B0FB37B401; Mon, 7 Jul 2003 16:45:11 -0700 (PDT) In-Reply-To: <200307071845.h67Ij1N1016542@khavrinen.lcs.mit.edu> from Garrett Wollman at "Jul 7, 2003 02:45:01 pm" To: wollman@lcs.mit.edu (Garrett Wollman) Date: Mon, 7 Jul 2003 16:45:11 -0700 (PDT) X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20030707234511.3B0FB37B401@hub.freebsd.org> From: wpaul@FreeBSD.ORG (Bill Paul) cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/net if_vlan.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 23:45:11 -0000 > < said: > > > I'm not quite sure what the right thing is to do here. Neither the > > vlan(4) nor ifconfig(8) man pages suggest which way to go. For now, > > I've removed this use of EVL_VLANOFTAG() so that the tag will match > > correctly in all cases. I will not get upset if somebody makes a > > compelling argument for using EVL_VLANOFTAG() everywhere instead, > > as long as the use is consistent. > > VLAN tags have only 12 bits. Anything else is part of the 802.1p > encapsulation header (either the priority or the ``this packet was > translated from Token Ring'' bit). > > -GAWollman > Ok, based on this (and what others have said), it looks like the correct behavior is to mask off all but the VLAN ID bits in all cases in vlan_input(). This is easy enough to do. The only issue then is what to do about the fact that the user is currently allowed to set the non-VLAN ID bits with ifconfig(8). We can do one of two things: 1) Change vlan_input() to apply EVL_VLANOFTAG() to all incoming tags (in both hardware and non-hardware tagging cases) and change the vlan_ioctl() function to only accept vlan tags from 0 to 4095 and return EINVAL if the caller tries to set any of the other bits. (Prevent user from shooting self in foot.) 2) Let the user set any bits, but always mask off the non-VLAN ID bits in vlan_input(), i.e.: --- if_vlan.c.orig Sat Jul 5 19:53:51 2003 +++ if_vlan.c Mon Jul 7 10:44:07 2003 @@ -429,7 +429,8 @@ for (ifv = LIST_FIRST(&ifv_list); ifv != NULL; ifv = LIST_NEXT(ifv, ifv_list)) - if (ifp == ifv->ifv_p && tag == ifv->ifv_tag) + if (ifp == ifv->ifv_p && EVL_VLANOFTAG(tag) == + EVL_VLANOFTAG(ifv->ifv_tag)) break; if (ifv == NULL || (ifv->ifv_if.if_flags & IFF_UP) == 0) { I am leaning towards option 1). Am I sane or not? Er... you know what I mean. -Bill -- ============================================================================= -Bill Paul (510) 749-2329 | Senior Engineer, Master of Unix-Fu wpaul@windriver.com | Wind River Systems ============================================================================= "If stupidity were a handicap, you'd have the best parking spot." =============================================================================