[prev in list] [next in list] [prev in thread] [next in thread]
List: freebsd-hackers
Subject: Re: ifconfig -a
From: Wankle Rotary Engine <wpaul () skynet ! ctr ! columbia ! edu>
Date: 1994-12-30 18:19:24
[Download RAW message or body]
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!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic