From owner-freebsd-net@FreeBSD.ORG Tue Jan 5 14:36:24 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA9A61065692 for ; Tue, 5 Jan 2010 14:36:24 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id 98B3A8FC16 for ; Tue, 5 Jan 2010 14:36:24 +0000 (UTC) Received: from compute1.internal (compute1.internal [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id 02F64C984B for ; Tue, 5 Jan 2010 09:36:24 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Tue, 05 Jan 2010 09:36:24 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:date:from:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; s=smtpout; bh=nURNXdroI4dKX72ajSddmDHFd4o=; b=Zm7i41qwoKo3tFJn/01yqqNTi20h6fxj7uZRAI0S2z0BKQolq1bepNa1dNFCRFZ8QM19y54nJQJUJyE8FH6LC1EgOWdQV9BnE3LLS8K0n4RZxESIw4n1vwey64eVbp36GjugxjJzAWz/OO/Cq3FOox/zxC/uK+vQWDgJqQWcI3E= X-Sasl-enc: CSEBWqXXC90ElnIIWPBw5O4GduitP7ZXRwxSu+DldyBf 1262702183 Received: from [192.168.123.18] (cpc2-dals7-0-0-cust253.hari.cable.virginmedia.com [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id 6B92E4C28E2 for ; Tue, 5 Jan 2010 09:36:23 -0500 (EST) Message-ID: <4B434E64.5070708@incunabulum.net> Date: Tue, 05 Jan 2010 14:36:20 +0000 From: Bruce Simpson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-GB; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 MIME-Version: 1.0 To: freebsd-net@freebsd.org References: <7B9397B189EB6E46A5EE7B4C8A4BB7CB36CA401D@MBX03.exg5.exghost.com> In-Reply-To: <7B9397B189EB6E46A5EE7B4C8A4BB7CB36CA401D@MBX03.exg5.exghost.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: What's the proper way to traverse a getifaddrs() interface list? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2010 14:36:24 -0000 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