From owner-freebsd-hackers Thu Dec 29 16:26:27 1994 Return-Path: hackers-owner Received: (from root@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id QAA08833 for hackers-outgoing; Thu, 29 Dec 1994 16:26:27 -0800 Received: from skynet.ctr.columbia.edu (skynet.ctr.columbia.edu [128.59.64.70]) by freefall.cdrom.com (8.6.9/8.6.6) with ESMTP id QAA08827 for ; Thu, 29 Dec 1994 16:26:22 -0800 Received: (from wpaul@localhost) by skynet.ctr.columbia.edu (8.6.8/8.6.6) id TAA03220 for freebsd-hackers@freebsd.org; Thu, 29 Dec 1994 19:24:20 -0500 From: Wankle Rotary Engine Message-Id: <199412300024.TAA03220@skynet.ctr.columbia.edu> Subject: Re: ifconfig -a To: freebsd-hackers@freebsd.org Date: Thu, 29 Dec 1994 19:24:16 -0500 (EST) X-Mailer: ELM [version 2.4 PL23] Content-Type: text Content-Length: 3301 Sender: hackers-owner@freebsd.org Precedence: bulk >>> A friend just pointed out Sun's useful -a flag to ifconfig. Anyone >>> game to add this to FreeBSD? Any objections? >> >>No objections, i am missing it also a long time now :-). Only >>interesting question, how close to which ifconfig version from >>SUN should it be ? :-). Some give you back the ethernet adress >>on the interface and some don't. I have not looked how easy it >> >> ATS ( ats@first.gmd.de or ats@cs.tu-berlin.de ) > Doesn't the SunOS version only show the ethernet address if run by >root? > Terry Lee > terry@uivlsi.csl.uiuc.edu You got it. Not sure why that's so, but it is. The same will be true of FreeBSD's ifconfig once I get done smacking it around too, since the only way I've found to read the hardware address for an interface involves kvm_read() and friends (at this very moment I'm furiously cribbing away from netstat ;). I already have the -a option working though: [/usr/include/net]:marple{14}% ifconfig -a ed1: flags=8863 mtu 1500 inet 128.59.64.56 netmask 0xffffff00 broadcast 128.59.64.255 lp0: flags=810 mtu 1500 lo0: flags=8009 mtu 65532 inet 127.0.0.1 netmask 0xff000000 ppp0: flags=10 mtu 1500 ppp1: flags=10 mtu 1500 sl0: flags=c010 mtu 552 sl1: flags=c010 mtu 552 [/usr/include/net]:marple{15}% As soon as I get the ethernet address stuff done I'll be sending along a complete set of patches to this list. Well, make that an almost complete set: I don't do man pages. :) There's one strange thing I discovered while implimenting the -a option: I used SIOCGIFCONF to figure out what interfaces are present in the system, but for some reason the active interfaces turn up twice. That is, without a little bit of extra fiddling, ed0 and lo0 (from the output above) would occur twice. With SIOCGIFCONF you get back an array with a member for each configured interface, but there seem to be two members for ed0 and lo0. If, for example, I assign a dummy address to sl0, then sl0 pops up twice as well. I found a quick though inelegant test to jump over the extra entries, but I'm confused as to why SIOCGIFCONF behaves this way. Oh, I have a question for those who might know: the data returned by ioctl(sock,SIOCGIFCONF,&ifconf) needs to be placed in a buffer, and you have to allocate enough space to hold the data for all interfaces. I arbitrarily assumed that there wouldn't be more than 20 interfaces, thus the buffer space allocated is (20 * struct ifreq). That's a silly thing to assume though... anybody know what the official maximum number of interfaces is? Is there a MAXINTERFACES defined somewhere? -Bill -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Bill Paul System Manager wpaul@ctr.columbia.edu Center for Telecommunications Research (212) 854-6020 Columbia University, New York City ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The Møøse Illuminati: ignore it and be confused, or join it and be confusing! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~