Re: libnfnetlink list of interfaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Le samedi 03 octobre 2009 à 10:08 +0400, Kuzin Andrey a écrit :
> I use nlif_index2name() to get interfaces list in my programm.
> After uptime 44 days and many reconnections by vtund i can't
> get tun/tap interfaces numbers.
> 
> For example output of iftest (example in nfnetlink library):

As mentionned in its name, iftest is for testing. It is not supposed to
do the complete job.

> 
> root@banana:/tmp/tgz/libnfnetlink-1.0.0/utils# ./iftest
> index (1) is lo (RUNNING)
> index (2) is eth0 (RUNNING)
> index (3) is eth1 (RUNNING)
....
> In iftest.c we have:
>       for (i=0; i<64; i++) {
>             char name[IFNAMSIZ];
>             unsigned int flags;
> 
>             if (nlif_index2name(h, i, name) == -1)
>                   continue;
>             if (nlif_get_ifflags(h, i, &flags) == -1)
>                   continue;
>             printf("index (%d) is %s (%s)\n", i, name,
>                   flags & IFF_RUNNING ? "RUNNING" : "NOT RUNNING");
>       }
> 
> Only 64 interfaces numbers checked. It mean that tun ifaces have
> number greater than 64.

Yes, see previous remark.

> 
> I think libnfnetlink need better way to get list of interfaces,
> better than stupid checking random number by nlif_index2name.

What do you mean here ?

BR,
-- 
Eric Leblond <eleblond@xxxxxx>
INL: http://www.inl.fr/
NuFW: http://www.nufw.org/
EdenWall: http://www.edenwall.com/

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux