aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorGarrett Wollman <wollman@FreeBSD.org>1996-12-11 20:39:43 +0000
committerGarrett Wollman <wollman@FreeBSD.org>1996-12-11 20:39:43 +0000
commit0e27dc0563ee38af6ba28aa9a2e169b2fe965a57 (patch)
treebd595dbdbdda14314aba8fd5e943cc8d283205b7 /usr.bin
parent294121822b0e0f1fd19d95fb994263da0f453587 (diff)
downloadsrc-0e27dc0563ee38af6ba28aa9a2e169b2fe965a57.tar.gz
src-0e27dc0563ee38af6ba28aa9a2e169b2fe965a57.zip
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/netstat/if.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c
index fb7ef447e50b..76ef9eb7dadf 100644
--- a/usr.bin/netstat/if.c
+++ b/usr.bin/netstat/if.c
@@ -82,6 +82,7 @@ intpr(interval, ifnetaddr)
u_long ifnetaddr;
{
struct ifnet ifnet;
+ struct ifnethead ifnethead;
union {
struct ifaddr ifa;
struct in_ifaddr in;
@@ -107,8 +108,12 @@ intpr(interval, ifnetaddr)
sidewaysintpr((unsigned)interval, ifnetaddr);
return;
}
- if (kread(ifnetaddr, (char *)&ifnetaddr, sizeof ifnetaddr))
+ if (kread(ifnetaddr, (char *)&ifnethead, sizeof ifnethead))
return;
+ ifnetaddr = (u_long)ifnethead.tqh_first;
+ if (kread(ifnetaddr, (char *)&ifnet, sizeof ifnet))
+ return;
+
printf("%-5.5s %-5.5s %-13.13s %-15.15s %8.8s %5.5s",
"Name", "Mtu", "Network", "Address", "Ipkts", "Ierrs");
if (bflag)
@@ -134,7 +139,7 @@ intpr(interval, ifnetaddr)
kread((u_long)ifnet.if_name, tname, 16))
return;
tname[15] = '\0';
- ifnetaddr = (u_long)ifnet.if_next;
+ ifnetaddr = (u_long)ifnet.if_link.tqe_next;
snprintf(name, 32, "%s%d", tname, ifnet.if_unit);
if (interface != 0 && (strcmp(name, interface) != 0))
continue;
@@ -332,6 +337,7 @@ u_char signalled; /* set if alarm goes off "early" */
* Repeat display every interval seconds, showing statistics
* collected over that interval. Assumes that interval is non-zero.
* First line printed at top of screen is always cumulative.
+ * XXX - should be rewritten to use ifmib(4).
*/
static void
sidewaysintpr(interval, off)
@@ -340,14 +346,17 @@ sidewaysintpr(interval, off)
{
struct ifnet ifnet;
u_long firstifnet;
+ struct ifnethead ifnethead;
register struct iftot *ip, *total;
register int line;
struct iftot *lastif, *sum, *interesting;
int oldmask, first;
u_long interesting_off;
- if (kread(off, (char *)&firstifnet, sizeof (u_long)))
+ if (kread(off, (char *)&ifnethead, sizeof ifnethead))
return;
+ firstifnet = (u_long)ifnethead.tqh_first;
+
lastif = iftot;
sum = iftot + MAXIF - 1;
total = sum - 1;
@@ -370,7 +379,7 @@ sidewaysintpr(interval, off)
ip++;
if (ip >= iftot + MAXIF - 2)
break;
- off = (u_long) ifnet.if_next;
+ off = (u_long) ifnet.if_link.tqe_next;
}
lastif = ip;
@@ -448,7 +457,7 @@ loop:
sum->ift_ob += ifnet.if_obytes;
sum->ift_co += ifnet.if_collisions;
sum->ift_dr += ifnet.if_snd.ifq_drops;
- off = (u_long) ifnet.if_next;
+ off = (u_long) ifnet.if_link.tqe_next;
}
if (!first) {
printf("%10u %5u %10u %10u %5u %10u %5u",