From owner-cvs-src@FreeBSD.ORG Tue Jul 8 08:15:57 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 72FA137B401; Tue, 8 Jul 2003 08:15:57 -0700 (PDT) Received: from ebb.errno.com (ebb.errno.com [66.127.85.87]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8060B43F75; Tue, 8 Jul 2003 08:15:56 -0700 (PDT) (envelope-from sam@errno.com) Received: from melange.errno.com (melange.errno.com [66.127.85.82]) (authenticated bits=0) by ebb.errno.com (8.12.9/8.12.9) with ESMTP id h68FFr7N066975 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Tue, 8 Jul 2003 08:15:55 -0700 (PDT) (envelope-from sam@errno.com) Date: Tue, 08 Jul 2003 08:15:53 -0700 From: Sam Leffler To: Bill Paul , Garrett Wollman Message-ID: <690626358.1057652153@melange.errno.com> In-Reply-To: <20030707234511.3B0FB37B401@hub.freebsd.org> References: <20030707234511.3B0FB37B401@hub.freebsd.org> X-Mailer: Mulberry/3.0.3 (Win32) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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: Tue, 08 Jul 2003 15:15:57 -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? Go with 1). I agree that users should be dealing only with the 12-bit id, not the priority bits. But this still leaves the issue of honoring the priority bits on reception. Sam