Getting interface IP addresses with proc filesystem

From: Burton Samograd (kruhft@kruhft.dyndns.org)
Date: Tue Jan 07 2003 - 21:06:14 EST


Hi all,

I'm curious how one goes about getting the current IP addresses held by a
machine. I saw some rather convoluted code in qmail that shows how to do it but
it seems like a rather difficult (and future bug ridden if the interface
changes) piece of code and was thinking that a /proc/net interface would be the
easiest solution, at least on the end user side.

My thinking goes along the lines of adding a file in /proc/net called interfaces
(or something more appropriate) which gives the following type of listing:

eth0 12.35.23.58
eth0:0 192.168.0.1
lo 127.0.0.1
ppp0 45.3.3.89

etc

for each of the registered interfaces on the machine. Nice, simple and
shouldn't be too hard to implement, correct? Is this type of information
already present through some other mechanism that I haven't found yet?

Thanks in advance.

-- 
burton samograd
kruhft@kruhft.dyndns.org
http://kruhftwerk.dyndns.org


- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Jan 07 2003 - 22:00:37 EST