Re: Question on VLAN



On 1/23/06, Gregory Nou <gregorynou@xxxxxxxxxx> 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
_______________________________________________
freebsd-net@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Developing New Socket Option on 4.10
    ... I am writing for help on my freebsd kernel hacking. ... and intend to introduct a new socket option ... When sending out a packet, if this option is set, the ... socket layer will produce a 20-byte tag, and finally this tag will be ...
    (freebsd-net)
  • Re: Kernel panic due to NF_IP_LOCAL_OUT handler calling itself again
    ... When you receive the icmp dest unreach message, do you drop it or inform the ... > option, I am using kernel 2.6.5, without smp and preemption support. ... describing the source route and the route error. ... Also every src routed packet carries with it ...
    (comp.os.linux.networking)
  • ng_netflow and router performance question
    ... and 25K different flows the router looses most of the packets. ... When packet do not pass ng_netgraph router handles 60K pkt/s just fine. ... what kernel and set of ip stack optimization options were used. ...
    (freebsd-net)
  • Re: C++, kernel mode, NDIS
    ... Actually, this does not work, since the compiler will call delete without ... So you always new with the tag and the tag says you must ... other things that should never live in the kernel. ... The C++ side effects could be taken care of by a kernel C++ subset/library, endorsed and thoroughly tested by an entity setting standards in Windows driver development... ...
    (microsoft.public.development.device.drivers)
  • [PATCH 2.6.15.4 1/1][RFC] ipt_owner: inode match supporting both incoming and outgoing packets
    ... I am not familiar with kernel internals, so please correct me where I am ... filter packets by the program who is going to receive the packet ... when multiple programs share a socket, ... struct vfsmount **mnt) ...
    (Linux-Kernel)