diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2005-06-08 04:47:05 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2005-06-08 04:47:05 +0000 |
commit | ff72c17b115203089ffb9e692d489160b793da69 (patch) | |
tree | a9f7db325ac0f93a9b3e930daf1ab7fac6d817e5 /usr.bin/netstat | |
parent | 52eb9ac48eb7ccab8abb68d872017ca8b118c0c5 (diff) |
bye bye, Xerox NS protocols
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r-- | usr.bin/netstat/Makefile | 4 | ||||
-rw-r--r-- | usr.bin/netstat/if.c | 23 | ||||
-rw-r--r-- | usr.bin/netstat/main.c | 98 | ||||
-rw-r--r-- | usr.bin/netstat/netstat.1 | 3 | ||||
-rw-r--r-- | usr.bin/netstat/ns.c | 349 | ||||
-rw-r--r-- | usr.bin/netstat/route.c | 82 |
6 files changed, 44 insertions, 515 deletions
diff --git a/usr.bin/netstat/Makefile b/usr.bin/netstat/Makefile index 3e7e60fe683..548e1614531 100644 --- a/usr.bin/netstat/Makefile +++ b/usr.bin/netstat/Makefile @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile,v 1.15 2005/04/12 14:11:49 reyk Exp $ +# $OpenBSD: Makefile,v 1.16 2005/06/08 04:47:03 henning Exp $ PROG= netstat -SRCS= if.c inet.c inet6.c ipx.c main.c mbuf.c mroute.c ns.c route.c \ +SRCS= if.c inet.c inet6.c ipx.c main.c mbuf.c mroute.c route.c \ unix.c atalk.c mroute6.c net80211.c BINGRP= kmem BINMODE=2555 diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index ac8bedf81a7..7e140e6f2a7 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.43 2005/03/25 17:01:03 jaredy Exp $ */ +/* $OpenBSD: if.c,v 1.44 2005/06/08 04:47:04 henning Exp $ */ /* $NetBSD: if.c,v 1.16.4.2 1996/06/07 21:46:46 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94"; #else -static char *rcsid = "$OpenBSD: if.c,v 1.43 2005/03/25 17:01:03 jaredy Exp $"; +static char *rcsid = "$OpenBSD: if.c,v 1.44 2005/06/08 04:47:04 henning Exp $"; #endif #endif /* not lint */ @@ -48,8 +48,6 @@ static char *rcsid = "$OpenBSD: if.c,v 1.43 2005/03/25 17:01:03 jaredy Exp $"; #include <netinet/in.h> #include <netinet/in_var.h> #include <netinet/if_ether.h> -#include <netns/ns.h> -#include <netns/ns_if.h> #include <netipx/ipx.h> #include <netipx/ipx_if.h> #include <arpa/inet.h> @@ -84,7 +82,6 @@ intpr(int interval, u_long ifnetaddr) #ifdef INET6 struct in6_ifaddr in6; #endif - struct ns_ifaddr ns; struct ipx_ifaddr ipx; } ifaddr; u_long total, ifaddraddr; @@ -295,22 +292,6 @@ intpr(int interval, u_long ifnetaddr) printf("atlk:%-12s",atalk_print(sa,0x10) ); printf("%-12s ",atalk_print(sa,0x0b) ); break; - case AF_NS: - { - struct sockaddr_ns *sns = - (struct sockaddr_ns *)sa; - u_long net; - char netnum[8]; - - *(union ns_net *)&net = sns->sns_addr.x_net; - snprintf(netnum, sizeof netnum, "%xH", - ntohl(net)); - upHex(netnum); - printf("ns:%-8s ", netnum); - printf("%-17s ", - ns_phost((struct sockaddr *)sns)); - } - break; case AF_LINK: { struct sockaddr_dl *sdl = diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 5d3d96a90bb..7287e129af2 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.57 2005/05/02 10:07:19 jmc Exp $ */ +/* $OpenBSD: main.c,v 1.58 2005/06/08 04:47:04 henning Exp $ */ /* $NetBSD: main.c,v 1.9 1996/05/07 02:55:02 thorpej Exp $ */ /* @@ -40,7 +40,7 @@ char copyright[] = #if 0 static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94"; #else -static char *rcsid = "$OpenBSD: main.c,v 1.57 2005/05/02 10:07:19 jmc Exp $"; +static char *rcsid = "$OpenBSD: main.c,v 1.58 2005/06/08 04:47:04 henning Exp $"; #endif #endif /* not lint */ @@ -85,79 +85,71 @@ struct nlist nl[] = { { "_rtstat" }, #define N_UNIXSW 9 { "_unixsw" }, -#define N_IDP 10 - { "_nspcb"}, -#define N_IDPSTAT 11 - { "_idpstat"}, -#define N_SPPSTAT 12 - { "_spp_istat"}, -#define N_NSERR 13 - { "_ns_errstat"}, -#define N_RTREE 14 +#define N_RTREE 10 { "_rt_tables"}, -#define N_FILE 15 +#define N_FILE 11 { "_file" }, -#define N_IGMPSTAT 16 +#define N_IGMPSTAT 12 { "_igmpstat" }, -#define N_MRTPROTO 17 +#define N_MRTPROTO 13 { "_ip_mrtproto" }, -#define N_MRTSTAT 18 +#define N_MRTSTAT 14 { "_mrtstat" }, -#define N_MFCHASHTBL 19 +#define N_MFCHASHTBL 15 { "_mfchashtbl" }, -#define N_MFCHASH 20 +#define N_MFCHASH 16 { "_mfchash" }, -#define N_VIFTABLE 21 +#define N_VIFTABLE 17 { "_viftable" }, -#define N_IPX 22 +#define N_IPX 18 { "_ipxcbtable"}, -#define N_IPXSTAT 23 +#define N_IPXSTAT 19 { "_ipxstat"}, -#define N_SPXSTAT 24 +#define N_SPXSTAT 20 { "_spx_istat"}, -#define N_AHSTAT 25 +#define N_AHSTAT 21 { "_ahstat"}, -#define N_ESPSTAT 26 +#define N_ESPSTAT 22 { "_espstat"}, -#define N_IP4STAT 27 +#define N_IP4STAT 23 { "_ipipstat"}, -#define N_DDPSTAT 28 +#define N_DDPSTAT 24 { "_ddpstat"}, -#define N_DDPCB 29 +#define N_DDPCB 25 { "_ddpcb"}, -#define N_ETHERIPSTAT 30 +#define N_ETHERIPSTAT 26 { "_etheripstat"}, -#define N_IP6STAT 31 +#define N_IP6STAT 27 { "_ip6stat" }, -#define N_ICMP6STAT 32 +#define N_ICMP6STAT 28 { "_icmp6stat" }, -#define N_PIM6STAT 33 +#define N_PIM6STAT 29 { "_pim6stat" }, -#define N_MRT6PROTO 34 +#define N_MRT6PROTO 30 { "_ip6_mrtproto" }, -#define N_MRT6STAT 35 +#define N_MRT6STAT 31 { "_mrt6stat" }, -#define N_MF6CTABLE 36 +#define N_MF6CTABLE 32 { "_mf6ctable" }, -#define N_MIF6TABLE 37 +#define N_MIF6TABLE 33 { "_mif6table" }, -#define N_MBPOOL 38 +#define N_MBPOOL 34 { "_mbpool" }, -#define N_MCLPOOL 39 +#define N_MCLPOOL 35 { "_mclpool" }, -#define N_IPCOMPSTAT 40 +#define N_IPCOMPSTAT 36 { "_ipcompstat" }, -#define N_RIP6STAT 41 +#define N_RIP6STAT 37 { "_rip6stat" }, -#define N_CARPSTAT 42 +#define N_CARPSTAT 38 { "_carpstats" }, -#define N_RAWIPTABLE 43 +#define N_RAWIPTABLE 39 { "_rawcbtable" }, -#define N_RAWIP6TABLE 44 +#define N_RAWIP6TABLE 40 { "_rawin6pcbtable" }, -#define N_PFSYNCSTAT 45 +#define N_PFSYNCSTAT 41 { "_pfsyncstats" }, -#define N_PIMSTAT 46 +#define N_PIMSTAT 42 { "_pimstat" }, { ""} }; @@ -228,17 +220,6 @@ struct protox ipxprotox[] = { 0, 0 } }; -struct protox nsprotox[] = { - { N_IDP, N_IDPSTAT, 1, nsprotopr, - idp_stats, "idp" }, - { N_IDP, N_SPPSTAT, 1, nsprotopr, - spp_stats, "spp" }, - { -1, N_NSERR, 1, 0, - nserr_stats, "ns_err" }, - { -1, -1, 0, 0, - 0, 0 } -}; - struct protox atalkprotox[] = { { N_DDPCB, N_DDPSTAT, 1, atalkprotopr, ddp_stats, "ddp" }, @@ -248,11 +229,11 @@ struct protox atalkprotox[] = { #ifndef INET6 struct protox *protoprotox[] = { - protox, ipxprotox, nsprotox, atalkprotox, NULL + protox, ipxprotox, atalkprotox, NULL }; #else struct protox *protoprotox[] = { - protox, ip6protox, ipxprotox, nsprotox, atalkprotox, NULL + protox, ip6protox, ipxprotox, atalkprotox, NULL }; #endif @@ -301,8 +282,6 @@ main(int argc, char *argv[]) af = AF_UNIX; else if (strcmp(optarg, "ipx") == 0) af = AF_IPX; - else if (strcmp(optarg, "ns") == 0) - af = AF_NS; else if (strcmp(optarg, "encap") == 0) af = PF_KEY; else if (strcmp(optarg, "atalk") == 0) @@ -510,9 +489,6 @@ main(int argc, char *argv[]) if (af == AF_IPX || af == AF_UNSPEC) for (tp = ipxprotox; tp->pr_name; tp++) printproto(tp, tp->pr_name); - if (af == AF_NS || af == AF_UNSPEC) - for (tp = nsprotox; tp->pr_name; tp++) - printproto(tp, tp->pr_name); if ((af == AF_UNIX || af == AF_UNSPEC) && !sflag) unixpr(nl[N_UNIXSW].n_value); if (af == AF_APPLETALK || af == AF_UNSPEC) diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1 index 1cd1e7db527..2219709778c 100644 --- a/usr.bin/netstat/netstat.1 +++ b/usr.bin/netstat/netstat.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: netstat.1,v 1.43 2005/05/02 10:07:19 jmc Exp $ +.\" $OpenBSD: netstat.1,v 1.44 2005/06/08 04:47:04 henning Exp $ .\" $NetBSD: netstat.1,v 1.11 1995/10/03 21:42:43 thorpej Exp $ .\" .\" Copyright (c) 1983, 1990, 1992, 1993 @@ -130,7 +130,6 @@ The following address families are recognized: .It "inet6" Ta Dv "AF_INET6" Ta "IP Version 6" .It "ipx" Ta Dv "AF_IPX" Ta "Novell IPX" .It "atalk" Ta Dv "AF_APPLETALK" Ta "AppleTalk" -.It "ns" Ta Dv "AF_NS" Ta "Xerox NS Protocols" .It "encap" Ta Dv "PF_KEY" Ta "IPsec" .It "local" Ta Dv "AF_LOCAL" Ta "Local to Host (i.e., pipes)" .It "unix" Ta Dv "AF_UNIX" Ta "Local to Host (i.e., pipes)" diff --git a/usr.bin/netstat/ns.c b/usr.bin/netstat/ns.c deleted file mode 100644 index 023655fdf50..00000000000 --- a/usr.bin/netstat/ns.c +++ /dev/null @@ -1,349 +0,0 @@ -/* $OpenBSD: ns.c,v 1.13 2005/03/30 06:45:34 deraadt Exp $ */ -/* $NetBSD: ns.c,v 1.8 1995/10/03 21:42:46 thorpej Exp $ */ - -/* - * Copyright (c) 1983, 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "from: @(#)ns.c 8.1 (Berkeley) 6/6/93"; -#else -static char *rcsid = "$OpenBSD: ns.c,v 1.13 2005/03/30 06:45:34 deraadt Exp $"; -#endif -#endif /* not lint */ - -#include <sys/param.h> -#include <sys/socket.h> -#include <sys/socketvar.h> -#include <sys/mbuf.h> -#include <sys/protosw.h> - -#include <net/route.h> -#include <net/if.h> - -#include <netinet/tcp_fsm.h> - -#include <netns/ns.h> -#include <netns/ns_pcb.h> -#include <netns/idp.h> -#include <netns/idp_var.h> -#include <netns/ns_error.h> -#include <netns/sp.h> -#include <netns/spidp.h> -#include <netns/spp_timer.h> -#include <netns/spp_var.h> -#define SANAMES -#include <netns/spp_debug.h> - -#include <limits.h> -#include <errno.h> -#include <stdio.h> -#include <string.h> -#include "netstat.h" - -struct nspcb nspcb; -struct sppcb sppcb; -struct socket sockb; - -static char *ns_prpr(struct ns_addr *); -static void ns_erputil(int, int); - -static int first = 1; - -/* - * Print a summary of connections related to a Network Systems - * protocol. For SPP, also give state of connection. - * Listening processes (aflag) are suppressed unless the - * -a (all) flag is specified. - */ - -void -nsprotopr(u_long off, char *name) -{ - struct nspcb cb; - struct nspcb *prev, *next; - int isspp; - - if (off == 0) - return; - isspp = strcmp(name, "spp") == 0; - kread(off, &cb, sizeof (struct nspcb)); - nspcb = cb; - prev = (struct nspcb *)off; - if (nspcb.nsp_next == (struct nspcb *)off) - return; - for (;nspcb.nsp_next != (struct nspcb *)off; prev = next) { - u_long ppcb; - - next = nspcb.nsp_next; - kread((u_long)next, &nspcb, sizeof (nspcb)); - if (nspcb.nsp_prev != prev) { - printf("???\n"); - break; - } - if (!aflag && ns_nullhost(nspcb.nsp_faddr) ) { - continue; - } - kread((u_long)nspcb.nsp_socket, &sockb, sizeof (sockb)); - ppcb = (u_long) nspcb.nsp_pcb; - if (ppcb) { - if (isspp) { - kread(ppcb, &sppcb, sizeof (sppcb)); - } else continue; - } else if (isspp) - continue; - if (first) { - printf("Active NS connections"); - if (aflag) - printf(" (including servers)"); - putchar('\n'); - if (Aflag) - printf("%-8.8s ", "PCB"); - printf(Aflag ? - "%-5.5s %-6.6s %-6.6s %-18.18s %-18.18s %s\n" : - "%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s %s\n", - "Proto", "Recv-Q", "Send-Q", - "Local Address", "Foreign Address", "(state)"); - first = 0; - } - if (Aflag) - printf("%8lx ", ppcb); - printf("%-5.5s %6ld %6ld ", name, sockb.so_rcv.sb_cc, - sockb.so_snd.sb_cc); - printf(" %-22.22s", ns_prpr(&nspcb.nsp_laddr)); - printf(" %-22.22s", ns_prpr(&nspcb.nsp_faddr)); - if (isspp) { - extern char *tcpstates[]; - if (sppcb.s_state >= TCP_NSTATES) - printf(" %d", sppcb.s_state); - else - printf(" %s", tcpstates[sppcb.s_state]); - } - putchar('\n'); - prev = next; - } -} -#define ANY(x,y,z) \ - ((x) ? printf("\t%ld %s%s%s -- %s\n",x,y,plural(x),z,"x") : 0) - -/* - * Dump SPP statistics structure. - */ -void -spp_stats(u_long off, char *name) -{ - struct spp_istat spp_istat; -#define sppstat spp_istat.newstats - - if (off == 0) - return; - kread(off, &spp_istat, sizeof (spp_istat)); - printf("%s:\n", name); - ANY((long)spp_istat.nonucn, "connection", - " dropped due to no new sockets "); - ANY((long)spp_istat.gonawy, "connection", - " terminated due to our end dying"); - ANY((long)spp_istat.nonucn, "connection", - " dropped due to inability to connect"); - ANY((long)spp_istat.noconn, "connection", - " dropped due to inability to connect"); - ANY((long)spp_istat.notme, "connection", - " incompleted due to mismatched id's"); - ANY((long)spp_istat.wrncon, "connection", - " dropped due to mismatched id's"); - ANY((long)spp_istat.bdreas, "packet", " dropped out of sequence"); - ANY((long)spp_istat.lstdup, "packet", - " duplicating the highest packet"); - ANY((long)spp_istat.notyet, "packet", - " refused as exceeding allocation"); - ANY(sppstat.spps_connattempt, "connection", " initiated"); - ANY(sppstat.spps_accepts, "connection", " accepted"); - ANY(sppstat.spps_connects, "connection", " established"); - ANY(sppstat.spps_drops, "connection", " dropped"); - ANY(sppstat.spps_conndrops, "embryonic connection", " dropped"); - ANY(sppstat.spps_closed, "connection", " closed (includes drops)"); - ANY(sppstat.spps_segstimed, "packet", " where we tried to get rtt"); - ANY(sppstat.spps_rttupdated, "time", " we got rtt"); - ANY(sppstat.spps_delack, "delayed ack", " sent"); - ANY(sppstat.spps_timeoutdrop, "connection", " dropped in rxmt timeout"); - ANY(sppstat.spps_rexmttimeo, "retransmit timeout", ""); - ANY(sppstat.spps_persisttimeo, "persist timeout", ""); - ANY(sppstat.spps_keeptimeo, "keepalive timeout", ""); - ANY(sppstat.spps_keepprobe, "keepalive probe", " sent"); - ANY(sppstat.spps_keepdrops, "connection", " dropped in keepalive"); - ANY(sppstat.spps_sndtotal, "total packet", " sent"); - ANY(sppstat.spps_sndpack, "data packet", " sent"); - ANY(sppstat.spps_sndbyte, "data byte", " sent"); - ANY(sppstat.spps_sndrexmitpack, "data packet", " retransmitted"); - ANY(sppstat.spps_sndrexmitbyte, "data byte", " retransmitted"); - ANY(sppstat.spps_sndacks, "ack-only packet", " sent"); - ANY(sppstat.spps_sndprobe, "window probe", " sent"); - ANY(sppstat.spps_sndurg, "packet", " sent with URG only"); - ANY(sppstat.spps_sndwinup, "window update-only packet", " sent"); - ANY(sppstat.spps_sndctrl, "control (SYN|FIN|RST) packet", " sent"); - ANY(sppstat.spps_sndvoid, "request", " to send a non-existant packet"); - ANY(sppstat.spps_rcvtotal, "total packet", " received"); - ANY(sppstat.spps_rcvpack, "packet", " received in sequence"); - ANY(sppstat.spps_rcvbyte, "byte", " received in sequence"); - ANY(sppstat.spps_rcvbadsum, "packet", " received with ccksum errs"); - ANY(sppstat.spps_rcvbadoff, "packet", " received with bad offset"); - ANY(sppstat.spps_rcvshort, "packet", " received too short"); - ANY(sppstat.spps_rcvduppack, "duplicate-only packet", " received"); - ANY(sppstat.spps_rcvdupbyte, "duplicate-only byte", " received"); - ANY(sppstat.spps_rcvpartduppack, "packet", " with some duplicate data"); - ANY(sppstat.spps_rcvpartdupbyte, "duplicate byte", " in part-duplicate packet"); - ANY(sppstat.spps_rcvoopack, "out-of-order packet", " received"); - ANY(sppstat.spps_rcvoobyte, "out-of-order byte", " received"); - ANY(sppstat.spps_rcvpackafterwin, "packet", " with data after window"); - ANY(sppstat.spps_rcvbyteafterwin, "byte", " rcvd after window"); - ANY(sppstat.spps_rcvafterclose, "packet", " rcvd after 'close'"); - ANY(sppstat.spps_rcvwinprobe, "rcvd window probe packet", ""); - ANY(sppstat.spps_rcvdupack, "rcvd duplicate ack", ""); - ANY(sppstat.spps_rcvacktoomuch, "rcvd ack", " for unsent data"); - ANY(sppstat.spps_rcvackpack, "rcvd ack packet", ""); - ANY(sppstat.spps_rcvackbyte, "byte", " acked by rcvd acks"); - ANY(sppstat.spps_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) - -/* - * Dump IDP statistics structure. - */ -void -idp_stats(u_long off, char *name) -{ - struct idpstat idpstat; - - if (off == 0) - return; - kread(off, &idpstat, sizeof (idpstat)); - printf("%s:\n", name); - ANY(idpstat.idps_toosmall, "packet", " smaller than a header"); - ANY(idpstat.idps_tooshort, "packet", " smaller than advertised"); - ANY(idpstat.idps_badsum, "packet", " with bad checksums"); -} - -static struct { - u_short code; - char *name; - char *where; -} ns_errnames[] = { - {0, "Unspecified Error", " at Destination"}, - {1, "Bad Checksum", " at Destination"}, - {2, "No Listener", " at Socket"}, - {3, "Packet", " Refused due to lack of space at Destination"}, - {01000, "Unspecified Error", " while gatewayed"}, - {01001, "Bad Checksum", " while gatewayed"}, - {01002, "Packet", " forwarded too many times"}, - {01003, "Packet", " too large to be forwarded"}, - {-1, 0, 0}, -}; - -/* - * Dump NS Error statistics structure. - */ -/*ARGSUSED*/ -void -nserr_stats(u_long off, char *name) -{ - struct ns_errstat ns_errstat; - int j; - int histoprint = 1; - int z; - - if (off == 0) - return; - kread(off, &ns_errstat, sizeof (ns_errstat)); - printf("NS error statistics:\n"); - ANY(ns_errstat.ns_es_error, "call", " to ns_error"); - ANY(ns_errstat.ns_es_oldshort, "error", - " ignored due to insufficient addressing"); - ANY(ns_errstat.ns_es_oldns_err, "error request", - " in response to error packets"); - ANY(ns_errstat.ns_es_tooshort, "error packet", - " received incomplete"); - ANY(ns_errstat.ns_es_badcode, "error packet", - " received of unknown type"); - for (j = 0; j < NS_ERR_MAX; j ++) { - z = ns_errstat.ns_es_outhist[j]; - if (z && histoprint) { - printf("Output Error Histogram:\n"); - histoprint = 0; - } - ns_erputil(z, ns_errstat.ns_es_codes[j]); - - } - histoprint = 1; - for (j = 0; j < NS_ERR_MAX; j ++) { - z = ns_errstat.ns_es_inhist[j]; - if (z && histoprint) { - printf("Input Error Histogram:\n"); - histoprint = 0; - } - ns_erputil(z, ns_errstat.ns_es_codes[j]); - } -} - -static void -ns_erputil(int z, int c) -{ - char *name, *where; - char codebuf[30]; - int j; - - for (j = 0;; j ++) { - if ((name = ns_errnames[j].name) == 0) - break; - if (ns_errnames[j].code == c) - break; - } - if (name == 0) { - if (c > 01000) - where = "in transit"; - else - where = "at destination"; - snprintf(codebuf, sizeof codebuf, - "Unknown XNS error code 0%o", c); - name = codebuf; - } else - where = ns_errnames[j].where; - ANY(z, name, where); -} - -static struct sockaddr_ns ssns = {AF_NS}; - -static -char *ns_prpr(struct ns_addr *x) -{ - struct sockaddr_ns *sns = &ssns; - - sns->sns_addr = *x; - return(ns_print((struct sockaddr *)sns)); -} diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 9643d79c8da..0bee6446773 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.69 2005/06/07 00:53:25 henning Exp $ */ +/* $OpenBSD: route.c,v 1.70 2005/06/08 04:47:04 henning Exp $ */ /* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94"; #else -static char *rcsid = "$OpenBSD: route.c,v 1.69 2005/06/07 00:53:25 henning Exp $"; +static char *rcsid = "$OpenBSD: route.c,v 1.70 2005/06/08 04:47:04 henning Exp $"; #endif #endif /* not lint */ @@ -52,8 +52,6 @@ static char *rcsid = "$OpenBSD: route.c,v 1.69 2005/06/07 00:53:25 henning Exp $ #include <netinet/in.h> #include <arpa/inet.h> -#include <netns/ns.h> - #include <netipx/ipx.h> #include <netatalk/at.h> @@ -196,9 +194,6 @@ pr_family(int af) afname = "Internet6"; break; #endif - case AF_NS: - afname = "XNS"; - break; case AF_IPX: afname = "IPX"; break; @@ -494,10 +489,6 @@ p_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags, int width) } #endif - case AF_NS: - cp = ns_print(sa); - break; - case AF_IPX: cp = ipx_print(sa); break; @@ -852,75 +843,6 @@ rt_stats(u_long off) rtstat.rts_wildcard, plural(rtstat.rts_wildcard)); } -short ns_nullh[] = {0,0,0}; -short ns_bh[] = {-1,-1,-1}; - -char * -ns_print(struct sockaddr *sa) -{ - struct sockaddr_ns *sns = (struct sockaddr_ns*)sa; - struct ns_addr work; - union { union ns_net net_e; u_long long_e; } net; - in_port_t port; - static char mybuf[50], cport[10], chost[25]; - char *host = ""; - char *p; - u_char *q; - - work = sns->sns_addr; - port = ntohs(work.x_port); - work.x_port = 0; - net.net_e = work.x_net; - if (ns_nullhost(work) && net.long_e == 0) { - if (port ) { - snprintf(mybuf, sizeof mybuf, "*.%xH", port); - upHex(mybuf); - } else - snprintf(mybuf, sizeof mybuf, "*.*"); - return (mybuf); - } - - if (bcmp(ns_bh, work.x_host.c_host, 6) == 0) { - host = "any"; - } else if (bcmp(ns_nullh, work.x_host.c_host, 6) == 0) { - host = "*"; - } else { - q = work.x_host.c_host; - snprintf(chost, sizeof chost, "%02x%02x%02x%02x%02x%02xH", - q[0], q[1], q[2], q[3], q[4], q[5]); - for (p = chost; *p == '0' && p < chost + 12; p++) - continue; - host = p; - } - if (port) - snprintf(cport, sizeof cport, ".%xH", htons(port)); - else - *cport = 0; - - snprintf(mybuf, sizeof mybuf, "%xH.%s%s", ntohl(net.long_e), - host, cport); - upHex(mybuf); - return(mybuf); -} - -char * -ns_phost(struct sockaddr *sa) -{ - struct sockaddr_ns *sns = (struct sockaddr_ns *)sa; - struct sockaddr_ns work; - static union ns_net ns_zeronet; - char *p; - - work = *sns; - work.sns_addr.x_port = 0; - work.sns_addr.x_net = ns_zeronet; - - p = ns_print((struct sockaddr *)&work); - if (strncmp("0H.", p, 3) == 0) - p += 3; - return(p); -} - u_short ipx_nullh[] = {0,0,0}; u_short ipx_bh[] = {0xffff,0xffff,0xffff}; |