question about vlan driver

Bjørn Mork bjorn at mork.no
Mon May 6 14:26:58 EDT 2013


Kevin Wilson <wkevils at gmail.com> writes:

> Hello,
> I have a short question about vlan driver;
>
> I see in the vlan driver the following code when creating a new vlan interface:
>
>
>
> vlan_newlink() {
> ...
> if (data[IFLA_VLAN_PROTOCOL])
> proto = nla_get_be16(data[IFLA_VLAN_PROTOCOL]);
> else
> proto = htons(ETH_P_8021Q);
> ...
> }
>
> see:
> http://lxr.free-electrons.com/source/net/8021q/vlan_netlink.c#L105
>
> I understand that in the common case, proto is ETH_P_8021Q.
> How can it be set to a different value when creating a vlan interface ?
> And to which other values can it be set ?
>
> I did not find anything by "vconfig --help",  and also by probing into
> the userspace code of the vconfig tool.


That code is pretty new, so you won't find many examples on how to use
it.   But the commit message includes an example:

  https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/net/8021q/vlan_netlink.c?id=8ad227ff89a7e6f05d07cd0acfd95ed3a24450ca

You'll naturally need a pretty recent version of iproute2 as well.
Actually, the matching userspace code doesn't seem to be in
http://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git just
yet.  So you'd need a not-yet-there version of iproute2 :)

The iproute2 patch was submitted at the same time as the kernel patch:
http://www.spinics.net/lists/netdev/msg233587.html



Bjørn



More information about the Kernelnewbies mailing list