On Tue, 2005-10-18 at 03:24 +0900, Detlef Reichl wrote:
> Am Dienstag, den 18.10.2005, 03:01 +0900 schrieb Joe Van Dyk:
> > Hi,
> > 
> > Other than parsing the output of `sudo /sbin/ifconfig`, anyone know of
> > a way to get the current IP address of a NIC?  (say, eth0).
> > 
> 
> on linux systems its in /sys/class/net/eth0/address

That looks like the Mac address, not the IP address.

> If some day someone provides bindings to the hardware abstraction layer
> (libhal) you could query it from there :-)


I actually have some code wrapping rtnetlink socket, which can get you
lots of routing information (man 7 rtnetlink). Although I use this code
to query the bandwidth manager on live machines, the code has a memory
leak, is alpha quality and fairly incomplete. I think rtnetlink is
pretty much Linux specific too.

If there is enough interest to pump up my motivation, I'll try to finish
it.

Guillaume.

> Cheers
> detlef
> 
> > Thanks!
> > Joe
> > 
> 
>