Background:
I\'m writing a daemon that makes outgoing TCP/IP connections. It will be running on machines with multiple (non-loopback) IP addresses.
You can get the interface info required a couple of ways including calling ioctl() with the SIOCGIFCONF option and looping through the returned structures to get the interface address info.
Given a list of all IP addresses, how would I filter out loopback addresses?
See ifreq struct in caskey's answer. You can determine the loopback (properly) with:
if (ifru_flags & IFF_LOOPBACK)
Constants are in if.h