From 64a0cc86b52d93c9979f8071cca3263e9ce48662 Mon Sep 17 00:00:00 2001 From: John Hay Date: Sat, 10 May 1997 10:03:43 +0000 Subject: [PATCH] Add the new ipx statistics variables. Remove the dns lookup code in the ipx functions. That is bogus and slows things like netstat -r(f ipx) down, without gaining anything. Remove the ipx error protocol statistics. --- usr.bin/netstat/ipx.c | 25 +++++++++++++++++++------ usr.bin/netstat/main.c | 12 ++++-------- usr.bin/netstat/route.c | 15 +++------------ 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/usr.bin/netstat/ipx.c b/usr.bin/netstat/ipx.c index 654d2e6babe2..0e8d34ff8d17 100644 --- a/usr.bin/netstat/ipx.c +++ b/usr.bin/netstat/ipx.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)ns.c 8.1 (Berkeley) 6/6/93"; */ static const char rcsid[] = - "$Id$"; + "$Id: ipx.c,v 1.7 1997/02/22 19:56:22 peter Exp $"; #endif /* not lint */ #include @@ -52,7 +52,9 @@ static const char rcsid[] = #include #include #include +#ifdef IPXERRORMSGS #include +#endif #include #include #include @@ -150,8 +152,8 @@ ipxprotopr(off, name) prev = next; } } -#define ANY(x,y,z) \ - ((x) ? printf("\t%ld %s%s%s -- %s\n",(long)x,y,plural(x),z,"x") : 0) + +#define ANY(x,y,z) (printf("\t%u %s%s%s\n",x,y,plural(x),z)) /* * Dump SPX statistics structure. @@ -228,8 +230,9 @@ spx_stats(off, name) ANY(spxstat.spxs_rcvackbyte, "byte", " acked by rcvd acks"); ANY(spxstat.spxs_rcvwinupd, "rcvd window update packet", ""); } + #undef ANY -#define ANY(x,y,z) ((x) ? printf("\t%d %s%s%s\n",x,y,plural(x),z) : 0) +#define ANY(x,y,z) (printf("\t%u %s%s%s\n",x,y,plural(x),z)) /* * Dump IPX statistics structure. @@ -245,9 +248,17 @@ ipx_stats(off, name) return; kread(off, (char *)&ipxstat, sizeof (ipxstat)); printf("%s:\n", name); - ANY(ipxstat.ipxs_toosmall, "packet", " smaller than a header"); - ANY(ipxstat.ipxs_tooshort, "packet", " smaller than advertised"); + ANY(ipxstat.ipxs_total, "total packet", " received"); ANY(ipxstat.ipxs_badsum, "packet", " with bad checksums"); + ANY(ipxstat.ipxs_tooshort, "packet", " smaller than advertised"); + ANY(ipxstat.ipxs_toosmall, "packet", " smaller than a header"); + ANY(ipxstat.ipxs_forward, "packet", " forwarded"); + ANY(ipxstat.ipxs_cantforward, "packet", " not forwardable"); + ANY(ipxstat.ipxs_delivered, "packet", " for this host"); + ANY(ipxstat.ipxs_localout, "packet", " sent from this host"); + ANY(ipxstat.ipxs_odropped, "packet", " dropped due to no bufs, etc."); + ANY(ipxstat.ipxs_noroute, "packet", " discarded due to no route"); + ANY(ipxstat.ipxs_mtutoosmall, "packet", " too big"); } static struct { @@ -266,6 +277,7 @@ static struct { {-1, 0, 0}, }; +#ifdef IPXERRORMSGS /* * Dump IPX Error statistics structure. */ @@ -337,6 +349,7 @@ ipx_erputil(z, c) where = ipx_errnames[j].where; ANY(z, name, where); } +#endif /* IPXERRORMSGS */ static struct sockaddr_ipx ssipx = {AF_IPX}; diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 56b908035243..08e15ee10f26 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -131,15 +131,13 @@ struct nlist nl[] = { { "_ipxstat"}, #define N_SPXSTAT 33 { "_spx_istat"}, -#define N_IPXERR 34 - { "_ipx_errstat"}, -#define N_DDPSTAT 35 +#define N_DDPSTAT 34 { "_ddpstat"}, -#define N_DDPCB 36 +#define N_DDPCB 35 { "_ddpcb"}, -#define N_DIVPCB 37 +#define N_DIVPCB 36 { "_divcb"}, -#define N_DIVSTAT 38 +#define N_DIVSTAT 37 { "_divstat"}, { "" }, }; @@ -180,8 +178,6 @@ struct protox ipxprotox[] = { ipx_stats, "ipx" }, { N_IPX, N_SPXSTAT, 1, ipxprotopr, spx_stats, "spx" }, - { -1, N_IPXERR, 1, 0, - ipxerr_stats, "ipx_err" }, { -1, -1, 0, 0, 0, 0 } }; diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 710087a5e0db..b6487fe23b4f 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -36,7 +36,7 @@ static char sccsid[] = "From: @(#)route.c 8.6 (Berkeley) 4/28/95"; #endif static const char rcsid[] = - "$Id$"; + "$Id: route.c,v 1.25 1997/02/22 19:56:23 peter Exp $"; #endif /* not lint */ #include @@ -730,8 +730,6 @@ ipx_print(sa) static char mybuf[50]; char cport[10], chost[15], cnet[15]; - if(!nflag) - sp = getservbyport(work.x_port, "ipx"); port = ntohs(work.x_port); if (ipx_nullnet(work) && ipx_nullhost(work)) { @@ -745,9 +743,7 @@ static char mybuf[50]; return (mybuf); } - if (!nflag && (np = getnetbyaddr(*(u_long *)&work.x_net, AF_IPX))) - net = np->n_name; - else if (ipx_wildnet(work)) + if (ipx_wildnet(work)) net = "any"; else if (ipx_nullnet(work)) net = "*"; @@ -760,9 +756,7 @@ static char mybuf[50]; net = p; } - if (!nflag && (hp = gethostbyaddr((char *)&work.x_host, 6, AF_IPX))) - host = hp->h_name; - else if (ipx_wildhost(work)) + if (ipx_wildhost(work)) host = "any"; else if (ipx_nullhost(work)) host = "*"; @@ -800,9 +794,6 @@ static union ipx_net ipx_zeronet; work = *sipx; in = work.sipx_addr; - hp = gethostbyaddr((char *)&in, sizeof(struct ipx_addr), AF_IPX); - if (hp) return (hp->h_name); - work.sipx_addr.x_port = 0; work.sipx_addr.x_net = ipx_zeronet; p = ipx_print((struct sockaddr *)&work);