How to get network interface info only with its name

From: Jaekwon Oh (jaekwon@comet.columbia.edu)
Date: Wed Mar 01 2000 - 06:52:05 EST


Hi,

Now, I'm trying to get the network device's MAC address and IP address
only with its interface name.

In BSD, I can do this by using 'sysctl' with the type of info,
'NET_RT_IFLIST' and then matching the interface name with the
sockaddr_dl's data.

How can I do like this in LINUX?

I tried to use LINUX's sysctl.
But, I cannot find the name structure similar with BSD's 'NET_RT_IFLIST'.
Moreover, the documentation about sysctl is too incomplete to know how to
use LINUX's 'sysctl': e.g, it was very hard to find out the naming
structure that 'sysctl' will search, and the data structure that 'sysctl'
will return.

So, I tried, in other way, to use 'routing socket' to do this.
But, it was also hard to do that: getting the network device's MAC address
and IP address only with its interface name.

Could anyone who has similar experience help me?

I'd very appreciate your help.
Thanks a lot.

Regards,

Jaek

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.rutgers.edu



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:26 EST