Date: Tue, 05 Jan 2010 14:36:20 +0000 From: Bruce Simpson <bms@incunabulum.net> To: freebsd-net@freebsd.org Subject: Re: What's the proper way to traverse a getifaddrs() interface list? Message-ID: <4B434E64.5070708@incunabulum.net> In-Reply-To: <7B9397B189EB6E46A5EE7B4C8A4BB7CB36CA401D@MBX03.exg5.exghost.com> References: <7B9397B189EB6E46A5EE7B4C8A4BB7CB36CA401D@MBX03.exg5.exghost.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B434E64.5070708>