Question on VLAN
Jon Simola
jon at abccomm.com
Mon Jan 23 16:59:48 PST 2006
On 1/23/06, Gregory Nou <gregorynou at altern.org> wrote:
> Hi,
>
> What is the difference between
> if (m->m_flags & M_VLANTAG)
> and
> if (ether_type == 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-717]
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
More information about the freebsd-net
mailing list