From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,4c95c0b353d1aade,start X-Google-Attributes: gidfee84,public From: "Herman Vloedgraven" Subject: How to get all network info via ioctl call (SIOGIFCONF) Date: 1998/12/18 Message-ID: <01be2a9c$e4cdcd30$0c32cc9b@caltrop>#1/1 X-Deja-AN: 423656931 Organization: Holland Institute of Traffic Technology B.V. Newsgroups: comp.unix.osf.osf1 I have the following problem on getting the network interface information of my machine. There is an ioctl call (strops.h) by which you can request all network interface information (SIOGIFCONF). //see man netintro This ioctl call returnes the ifconf struct which contains an array of the struct ifreq for every interface. This is more or less the same information as returned with the operator call /sbin/ifconfig -a The struct ifreq contains the network name and a union. So far so good, but now my problem: I'm interested in the inet address of every network interface installed in a system. It looks like that the the information in ifreq array is not always the same. for each network interface it contains different data. How can I get the inet address from ifreq array. Machine A: ifreq array : name = tu0 data = 6.3.6.0 //WHAT IS THIS? name = tu0 data = 10.15.2.4 //inet of tu0 name = fta0 data = 15.4.6.0 //WHAT IS THIS? name = fta0 data = 10.15.1.4 //inet of fta0 name = sl0 data = 28.3.0.0 // WHAT IS THIS? name = lo0 data = 24.3.0.0 // WHAT IS THIS? Machine A:Output of /sbin/ifconf-g -a tu0: flags=c63 inet 10.15.2.4 netmask ffffff00 broadcast 10.15.2.255 ipmtu 1500 fta0: flags=8c63 inet 10.15.1.4 netmask ffffff00 broadcast 10.15.1.255 ipmtu 4352 sl0: flags=10 lo0: flags=100c89 inet 127.0.0.1 netmask ff000000 ipmtu 4096 Machine B: ifreq array name = tu0 data = 6.3.6.0 //WHAT IS THIS? name = tu0 data = 0.0.0.0 //WHAT IS THIS? name = tu0 data = 155.204.201.212 //inet tu0 name = sl0 data = 28.3.0.0 //WHAT IS THIS? name = lo0 data = 24.3.0.0 //WHAT IS THIS? name = lo0 data = 127.0.0.1 //inet lo0 Machine B: Output of /sbin/ifconf-g -a tu0: flags=c63 inet 155.204.201.212 netmask ffff0000 broadcast 155.204.255.255 ipmtu 1500 sl0: flags=10 lo0: flags=100c89 inet 127.0.0.1 netmask ff000000 ipmtu 4096 ppp0: flags=10