From: banny52@yahoo.com (Ginny E. Kim)
Subject: ioctl(SIOCGIFCONF)
Date: 7 Sep 2001 05:54:03 -0700 [thread overview]
Message-ID: <2f6bec0a.0109070454.50e7327f@posting.google.com> (raw)
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> Link#4 46752 0 46752
0 0
lo0 4096 127/8 127.0.0.1 46752 0 46752
0 0
sl0* 296 <Link> Link#3 0 0 0
0 0
tu0 1500 <Link> 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 <Link> 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
reply other threads:[~2001-09-07 12:54 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