summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-12-31 00:32:50 +0000
committerrwatson <rwatson@FreeBSD.org>2004-12-31 00:32:50 +0000
commite1d1aaa012c9d5a1a1ab782daafff83fbba24197 (patch)
tree5bb9867431582c600708571b09870e41f652cbcf /usr.bin/netstat
parenta8001e07a0a6eafe699578bd97cf5efd54ab363f (diff)
downloadFreeBSD-src-e1d1aaa012c9d5a1a1ab782daafff83fbba24197.zip
FreeBSD-src-e1d1aaa012c9d5a1a1ab782daafff83fbba24197.tar.gz
Update netstat(1) for recent conversion of netipx to queue(9) from
home-brew linked lists. Read in the ipxpcb_list structure first in order to find the first pcb pointer. Then follow the chain as before, only the termination condition is a NULL next pointer rather than a next pointer equal to the original offset.
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r--usr.bin/netstat/ipx.c26
-rw-r--r--usr.bin/netstat/main.c2
2 files changed, 24 insertions, 4 deletions
diff --git a/usr.bin/netstat/ipx.c b/usr.bin/netstat/ipx.c
index b4f2940..2d4aad0 100644
--- a/usr.bin/netstat/ipx.c
+++ b/usr.bin/netstat/ipx.c
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2004, Robert N. M. Watson
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -68,6 +69,8 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include "netstat.h"
+struct ipxpcbhead ipxpcb_list;
+int ipxpcb_list_read;
struct ipxpcb ipxpcb;
struct spxpcb spxpcb;
struct socket sockb;
@@ -93,21 +96,38 @@ ipxprotopr(u_long off, const char *name, int af1 __unused)
if (off == 0)
return;
+
+ /*
+ * First time around, read in the pcb list header. After that, we
+ * walk sequential pcbs.
+ */
+ if (ipxpcb_list_read == 0) {
+ kread(off, (char *)&ipxpcb_list, sizeof(ipxpcb_list));
+ off = (u_long)LIST_FIRST(&ipxpcb_list);
+ ipxpcb_list_read = 1;
+ }
+
isspx = strcmp(name, "spx") == 0;
kread(off, (char *)&cb, sizeof (struct ipxpcb));
ipxpcb = cb;
prev = (struct ipxpcb *)off;
- if (ipxpcb.ipxp_next == (struct ipxpcb *)off)
+ if (LIST_NEXT(&ipxpcb, ipxp_list) == NULL)
return;
- for (;ipxpcb.ipxp_next != (struct ipxpcb *)off; prev = next) {
+ for (;LIST_NEXT(&ipxpcb, ipxp_list) != NULL; prev = next) {
u_long ppcb;
- next = ipxpcb.ipxp_next;
+ next = LIST_NEXT(&ipxpcb, ipxp_list);
kread((u_long)next, (char *)&ipxpcb, sizeof (ipxpcb));
+#if 0
+ /*
+ * queue(9) macros do not give us a prev pointer, so skip
+ * sanity check for now.
+ */
if (ipxpcb.ipxp_prev != prev) {
printf("???\n");
break;
}
+#endif
if (!aflag && ipx_nullhost(ipxpcb.ipxp_faddr) ) {
continue;
}
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index 13d52d6..e5cd2fd 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -83,7 +83,7 @@ static struct nlist nl[] = {
#define N_VIFTABLE 5
{ "_viftable" },
#define N_IPX 6
- { "_ipxpcb"},
+ { "_ipxpcb_list"},
#define N_IPXSTAT 7
{ "_ipxstat"},
#define N_SPXSTAT 8
OpenPOWER on IntegriCloud