Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Dec 1994 13:19:24 -0500 (EST)
From:      Wankle Rotary Engine <wpaul@skynet.ctr.columbia.edu>
To:        wollman@halloran-eldar.lcs.mit.edu (Garrett Wollman)
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: ifconfig -a
Message-ID:  <199412301819.NAA00645@skynet.ctr.columbia.edu>
In-Reply-To: <9412301553.AA05515@halloran-eldar.lcs.mit.edu> from "Garrett Wollman" at Dec 30, 94 10:53:43 am

next in thread | previous in thread | raw e-mail | index | archive | help
They say this Garrett Wollman person was kidding when he wrote:
> 
> <<On Thu, 29 Dec 1994 19:24:16 -0500 (EST), Wankle Rotary Engine <wpaul@skynet.ctr.columbia.edu> said:
> 
> > 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:
> 
> Do it the same way netstat does; no KVM stuff involved.

Er, I don't understand what you're telling me here. Looking at the
sources to netstat, the if.c module, which is what is used when you 
invoke netstat -i, quite clearly calls kvm_read(). (It's wrapped inside
a function called kread(), but it's the same thing.) And main.c
calles kvm_open() and kvm_nlist(). The kvm_nlist() is used to look up
several symbols, including "_ifnet", which is used by if.c to track
down the per-interface data. That's how I did it for ifconfig.

Are you saying somebody rewrote netstat to not use KVM when I wasn't 
looking? I only supped my kernel source tree two days ago. I think
I'm confused.

> 
> That's right.  There's one for each address, INCLUDING THE LINK-LAYER
> ADDRESS.

So I've discovered. :)

> 
> The ifc_len field should be filled in with the total amount of space
> required.  I believe that you can do an initial SIOCGIFCONF with
> ifc_len set to zero, and then allocate ifc_len space for the buffer
> and do it again.

Ah... that sounds sensible. Then if no one objects I'll make a new
patch that works this way.

> 
> -GAWollman

-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!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199412301819.NAA00645>