[H-GEN] Re: getting eth0 information
Benjamin Robert Carlyle
benc at foxboro.com.au
Tue Dec 5 22:50:25 EST 2000
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Please observe the list's charter. ]
[ Worthwhile understanding: http://www.humbug.org.au/netiquette.html ]
Joel Pobar wrote:
[moved to general in the interest of re-introducing technical
discussion to the list ;]
> Hey all,
>
> I was wondering if there was a way in C or Perl to grab information from
> ethX devices. I basically just need the current IP address, and perhaps RX
> and TX errors.
>
> Anyone know any cute functions I could use to achive this?
There is no direct, standard way. I know of systems that
directly inspect /dev/kmem. I know of systems that examine
files in /proc. Martin's ifconfig idea is cute, and I have
vauge recollections that ifconfig it's self reads from /proc.
Each of these mechanisms are highly dependant on the operating
system and operating system revision (less so for the latter
methods). The closest thing I think you'll find to a standard
mechanism is to examine the kernel using SNMP, the Simple
Network Management Protocol. It's ugly and heavy, but you may
be able to find libraries to make life easier. You'll have to
research yourself as to which paths contain the appropriate
information, or even if that information is available, but
this is probably the most portable method.
Benjamin.
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.
More information about the General
mailing list