What's the proper way to traverse a getifaddrs() interface list?

Bruce Simpson bms at incunabulum.net
Tue Jan 5 14:36:24 UTC 2010


On 05/01/2010 02:05, Peter Steele wrote:
> I have an application where I want to collect information on the network interfaces. I've researched this and the function getifaddrs(struct ifaddrs *ifap) appears to be the way to go, but I'm having some trouble understanding exactly how to process the information returned by this call.

http://svn.freebsd.org/viewvc/base/head/usr.sbin/mtest/mtest.c?annotate=191651

function: __ifindex_to_primary_ip(const uint32_t ifindex, struct in_addr 
*pina)

...
> duplicate entries. Can someone explain the proper way to traverse this linked list?
>    


there's an entry in that list for every protocol family attached to each 
ifnet; they are not duplicates.

cheers,
BMS



More information about the freebsd-net mailing list