From mboxrd@z Thu Jan 1 00:00:00 1970
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fa528,90282802d46c4a0e,start
X-Google-Attributes: gidfa528,public
X-Google-ArrivalTime: 2001-09-07 05:54:03 PST
Path: archiver1.google.com!postnews1.google.com!not-for-mail
From: banny52@yahoo.com (Ginny E. Kim)
Newsgroups: comp.unix.tru64
Subject: ioctl(SIOCGIFCONF)
Date: 7 Sep 2001 05:54:03 -0700
Organization: http://groups.google.com/
Message-ID: <2f6bec0a.0109070454.50e7327f@posting.google.com>
NNTP-Posting-Host: 211.117.39.57
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 999867243 20349 127.0.0.1 (7 Sep 2001 12:54:03 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 7 Sep 2001 12:54:03 GMT
Xref: archiver1.google.com comp.unix.tru64:4721
My system is Tru64UNIX V5.1 and, it has 2 network interface cards
This is the program to gain Interface's information of system.
"ioctl(fd, SIOCGIFCONF, (char *)&ifc" can do it.
In this case, I have the problem. After calling "ioctl(fd,
SIOCGIFCONF, (char *)&ifc", if I see the information of "ifc", it has
9 interface card names including "lo0", "sl0". The actual interface
card, tu0, tu1 has 3 name each...
I think it is concerned with the result of "netstat -in".. The result
of "netstat -in" show me 9 interface cards...
Do you know how to get the name of only two hardware interface card,
tu0, tu1 in "ioctl(SIOCGIFCONF)" or, how to decide which one is a real
interface card?
x()
{
register int fd;
register struct sockaddr_in *sin;
register struct ifreq *ifrp, *ifend, *ifnext;
struct ifconf ifc;
struct ifreq ibuf[16], ifr;
memset(ifr.ifr_name, 0, sizeof(ifr.ifr_name));
fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) {
return FALSE;
}
ifc.ifc_len = sizeof ibuf;
ifc.ifc_buf = (caddr_t)ibuf;
if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0 ||
ifc.ifc_len < sizeof(struct ifreq)) {
close(fd);
return FALSE;
}
ifrp = ibuf;
ifend = (struct ifreq *)((char *)ibuf + ifc.ifc_len);
for (; ifrp < ifend; ifrp = ifnext) {
.........................
}
#netstat -in
Name Mtu Network Address Ipkts Ierrs Opkts
Oerrs Coll
lo0 4096 Link#4 46752 0 46752
0 0
lo0 4096 127/8 127.0.0.1 46752 0 46752
0 0
sl0* 296 Link#3 0 0 0
0 0
tu0 1500 8:0:2b:8:8:4 71993 0 19226
0 691
tu0 1500 DLI none 71993 0 19226
0 691
tu0 1500 10.0.1.3/24 10.0.1.3 71993 0 19226
0 691
tu1 1500 8:0a:b:8:7e:b 76624 0 4594
0 22
tu1 1500 DLI none 76624 0 4594
0 22
tu1 1500 10.0.1.4/24 10.0.1.4 76624 0 4594
0 22