[LiSA-Devel] Virtual VLAN interface

Radu Rendec radu.rendec at mindbit.ro
Wed May 22 12:51:35 EEST 2013


Hi,

You should not make any assumptions about interface naming conventions.
Therefore, you should return the vlan id explicitly if the interface is
a VIF.

This is consistent with the SWCFG_GETIFTYPE kernel module call, which
returns the vlan id in arg.vlan when the interface is a VIF.

Radu

On Wed, 2013-05-22 at 12:10 +0300, Andreea-Cristina Hodea wrote:
> Hi,
> 
> When obtaining the type of an interface based on index, if the
> interface was a vlan interface, I would also need the vlan id.
> Supposing vlan interfaces are always named "vlan$vlanid", I see two
> solutions to obtaining the vlan id:
> 
> 1. sscanf on the interface name
> 2. when returning the type, also return the vlan id if the interface
> is of type SW_IF_VIF.
> 
> Now I was wondering, which one is more accurate? Can I count on naming
> "vlan$id"?
> 
> The context of the question is given by cmd_no_int_any and
> cmd_int_any, for example, when replacing ioctl calls with
> sw_ops->if_get_type.
> 
> Thanks,
> Andreea




More information about the LiSA-Devel mailing list