[LiSA-Devel] [CLI&SW_API] get_if_list

Andreea-Cristina Hodea andreea.cristina.hodea at gmail.com
Tue Apr 16 18:57:02 EEST 2013


On Tue, Apr 16, 2013 at 5:51 PM, Radu Rendec <radu.rendec at mindbit.ro> wrote:
> On Tue, 2013-04-16 at 17:01 +0300, Andreea-Cristina Hodea wrote:
>> On Tue, Apr 16, 2013 at 4:55 PM, Claudiu Ghioc <claudiughioc at gmail.com> wrote:
>> >> Is it ok if get_if_list returns a list of net_switch_dev structures instead of ifindexes?
>> ...
>> > have a generic structure which describes a switch device. I guess we
>> > can return the array of struct net_switch_device in get_if_list; the
>> > cli can use either the interface index or the name whichever suits
>> > better.
>>
>> Ok, I was thinking at something similar, but I wanted to make sure I
>> didn't miss anything. Thanks, Claudiu.
>
> If I recall correctly, we discussed this during the meeting on April 8th
> and we decided that in user space we would use a structure that is very
> similar to net_switch_dev, but also contains a list_head.
>
> Then get_if_list() would receive a list_head as argument and enchain
> these structures to that list_head.

Well, we did discuss about structures chained together but for get_mac
and get_mrouters. For get_vbd, get_vlan_interfaces and get_if_list we
decided to return a bitmap or a array of "int ifindex" ([1])
respectively as at that point we did not discuss the difference
between interface names and interface descriptions and thought there
isn't a general need to obtain indexes and names all at once.

> To answer your original question (how you can get the name by the index)
> you can take a look at cli/command/config_if.c around line 373. Or use
> "man 7 netdevice" (as suggested in the comment in the same file).

Thank you for the information, I'll keep that in mind.

Andreea

[1] https://github.com/lisa-project/lisa-user/commit/6b37c80792817d3e42b3b55846f3162c7a236d8d


More information about the LiSA-Devel mailing list