diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-12-31 00:32:50 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-12-31 00:32:50 +0000 |
commit | e1d1aaa012c9d5a1a1ab782daafff83fbba24197 (patch) | |
tree | 5bb9867431582c600708571b09870e41f652cbcf /usr.bin/netstat/ipx.c | |
parent | a8001e07a0a6eafe699578bd97cf5efd54ab363f (diff) | |
download | FreeBSD-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/ipx.c')
-rw-r--r-- | usr.bin/netstat/ipx.c | 26 |
1 files changed, 23 insertions, 3 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; } |