Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: "Herman Vloedgraven" <hvloed@hitt.nl>
Subject: How to get all network info via ioctl call (SIOGIFCONF)
Date: 1998/12/18	[thread overview]
Message-ID: <01be2a9c$e4cdcd30$0c32cc9b@caltrop> (raw)


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<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>
     inet 10.15.2.4 netmask ffffff00 broadcast 10.15.2.255 ipmtu 1500 

fta0: flags=8c63<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>
     inet 10.15.1.4 netmask ffffff00 broadcast 10.15.1.255 ipmtu 4352 

sl0: flags=10<POINTOPOINT>

lo0: flags=100c89<UP,LOOPBACK,NOARP,MULTICAST,SIMPLEX,NOCHECKSUM>
     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<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST,SIMPLEX>
     inet 155.204.201.212 netmask ffff0000 broadcast 155.204.255.255 ipmtu
1500

sl0: flags=10<POINTOPOINT>

lo0: flags=100c89<UP,LOOPBACK,NOARP,MULTICAST,SIMPLEX,NOCHECKSUM>
     inet 127.0.0.1 netmask ff000000  ipmtu 4096

ppp0: flags=10<POINTOPOINT>






                 reply	other threads:[~1998-12-18  5:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox