Hello, I am trying to write a programme that will allow me to get all the
interfaces on a machine and all the IP addresses associated with an
interface (I believe methods IP aliasing allows for more than one IP
address per interface). So far I have been able to to get interfaces and
*one* IP address associated with that interface through use of socket
(AF_INET, SOCK_DGRAM, 0) and of ioctl SIOCGIFCONF and SIOCGIFADDR. However
these use ifc and ifreq structures, the later referring to only one
IP address. Looking through sockio.h, it seems that I need access to
the ifnet structure which contains the ifaddr *if_addrlist variable which
is a pointer to a list of IP addresses.
I would appreciate it if someone can tell me how to do the aforementioned,
especially under Solaris. Also if anyone can give me tips on how a utility
like ifconfig or netstat under Solaris works (I am not sure how portable
the technique I am using, is) would also help.