title: Get local network interface addresses using only proc?
body: <p><strong>How can I obtain the (IPv4) addresses for all network interfaces using only <a href="http://linux.die.net/man/5/proc">proc</a>?</strong> After some extensive investigation I've discovered the following:</p>
  
  <ol>
  <li><code>ifconfig</code> makes use of <code>SIOCGIFADDR</code>, which requires open sockets and advance knowledge of all the interface names. It also isn't documented in any manual pages on Linux.</li>
  <li><code>proc</code> contains <code>/proc/net/dev</code>, but this is a list of interface statistics.</li>
  <li><code>proc</code> contains <code>/proc/net/if_inet6</code>, which is exactly what I need but for IPv6.</li>
  <li>Generally interfaces are easy to find in <code>proc</code>, but actual addresses are very rarely used except where explicitly part of some connection.</li>
  <li>There's a system call called <a href="http://www.manpagez.com/man/3/getifaddrs/"><code>getifaddrs</code></a>, which is very much a "magical" function you'd expect to see in Windows. It's also implemented on BSD. However it's not very text-oriented, which makes it difficult to use from non-C languages.</li>
  </ol>