From owner-freebsd-net@FreeBSD.ORG Tue Jan 24 00:59:48 2006 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BE22B16A44F for ; Tue, 24 Jan 2006 00:59:48 +0000 (GMT) (envelope-from jsimola@gmail.com) Received: from uproxy.gmail.com (uproxy.gmail.com [66.249.92.195]) by mx1.FreeBSD.org (Postfix) with ESMTP id D3E8B43D48 for ; Tue, 24 Jan 2006 00:59:47 +0000 (GMT) (envelope-from jsimola@gmail.com) Received: by uproxy.gmail.com with SMTP id o2so130912uge for ; Mon, 23 Jan 2006 16:59:46 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=TSA0zgDJsgKQav9sxXWv08kQbJZNUvYUUyP9dinIDZXQimtv6WGaej5GP32jIQm30bAfIpNkDLe1ItTUYfBBkCRa6XoRiNtOF8W2pszfhd8N86ppvx/fZiTJsYxb5TYayLm1djvwHM18C7YlLLUJ0iZ+rrGe+2ottXCQaAuDN5A= Received: by 10.66.252.18 with SMTP id z18mr323087ugh; Mon, 23 Jan 2006 16:59:46 -0800 (PST) Received: by 10.66.223.13 with HTTP; Mon, 23 Jan 2006 16:59:46 -0800 (PST) Message-ID: <8eea04080601231659o2a26d71dkc3287195b032934e@mail.gmail.com> Date: Mon, 23 Jan 2006 16:59:46 -0800 From: Jon Simola Sender: jsimola@gmail.com To: Gregory Nou In-Reply-To: <43D557B0.2080306@altern.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <43D557B0.2080306@altern.org> Cc: freebsd-net@freebsd.org Subject: Re: Question on VLAN X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2006 00:59:48 -0000 On 1/23/06, Gregory Nou wrote: > Hi, > > What is the difference between > if (m->m_flags & M_VLANTAG) > and > if (ether_type =3D=3D ETHERTYPE_VLAN) ? > > I suppose that m->m_flags are set using ether_type at one point. Still, > I was not able to find a location in the source where it would happen. You're right, the M_VLANTAG is a tag on an mbuf to show it's an 802.1q packet, and looks like it gets turned on in vlan_start() in if_vlan.c ETHERTYPE_VLAN is 0x8100 and is a constant in 802.1q packets as they appear on the wire (just after the src/dst MAC addresses, offset 0x18 IIRC). > The fact is, I do not understand the difference between these two > things, nor do I understand why we need the code in if_ethersubr.c[691-71= 7] If the interface does de/tagging at the hardware level the kernel gets the vlan bits already seperated, otherwise it has to figure it out by looking in the header for the presence of the ETHERTYPE_VLAN tag. Hope that helps you out. -- Jon Simola Systems Administrator ABC Communications