Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jan 2006 16:59:46 -0800
From:      Jon Simola <jon@abccomm.com>
To:        Gregory Nou <gregorynou@altern.org>
Cc:        freebsd-net@freebsd.org
Subject:   Re: Question on VLAN
Message-ID:  <8eea04080601231659o2a26d71dkc3287195b032934e@mail.gmail.com>
In-Reply-To: <43D557B0.2080306@altern.org>
References:  <43D557B0.2080306@altern.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 1/23/06, Gregory Nou <gregorynou@altern.org> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8eea04080601231659o2a26d71dkc3287195b032934e>