From owner-freebsd-hackers Tue Jan 9 7:21:47 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from citadel.cequrux.com (citadel.cequrux.com [192.96.22.18]) by hub.freebsd.org (Postfix) with ESMTP id CD6D237B401 for ; Tue, 9 Jan 2001 07:21:11 -0800 (PST) Received: (from nobody@localhost) by citadel.cequrux.com (8.8.8/8.6.9) id RAA17015; Tue, 9 Jan 2001 17:19:55 +0200 (SAST) Received: by citadel.cequrux.com via recvmail id 16924; Tue Jan 9 17:18:42 2001 Message-ID: <3A5B1390.A5453C78@cequrux.com> Date: Tue, 09 Jan 2001 15:35:12 +0200 From: Graham Wheeler Organization: Cequrux Technologies X-Mailer: Mozilla 4.75 [en] (X11; U; FreeBSD 3.4-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: David Malone Cc: hackers@freebsd.org, markster@marko.net Subject: Re: Size of struct ifreq/returned buffer of SIOCGIFCONF References: <3A5AE617.E8644889@cequrux.com> <20010109140752.A52761@walton.maths.tcd.ie> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG David Malone wrote: > > On Tue, Jan 09, 2001 at 12:21:11PM +0200, Graham Wheeler wrote: > > > I am attempting to port the cheops network mapping/diagnostic program > > from Linux to FreeBSD (see www.marko.net/cheops). One of the first snags > > I have hit comes in using SIOCGIFCONF to queries the network interface > > names and addresses. > > Could you use getifaddrs() for this? It would probably provide the > info you need in a easier to digest form. If not, the code below > might be useful. It gets a list of interface properties using > sysctl(), but I believe the info is packed in the same way as it > is for SIOCGIFCONF. I have code similar to yours I wrote myself used in our firewall product, but I would ideally like to have code that compiles and works on both Linux and FreeBSD, to reduce the work required to maintain the cheops port once it is done, and ease porting to other Unices as well - accessing kernel mibs or using other non-standard API calls will be my means of last resort. Marko - does Linux have getifaddrs()? I somehow doubt it... gr. -- Dr Graham Wheeler E-mail: gram@cequrux.com Director, Research and Development WWW: http://www.cequrux.com CEQURUX Technologies Phone: +27(21)423-6065 Firewalls/VPN Specialists Fax: +27(21)424-3656 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message