diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-06-29 20:18:05 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-06-29 20:18:05 +0000 |
commit | 0b1d6d59b408bc7e5d443a930eb2b59b35d58883 (patch) | |
tree | bfe0d518b2e7a81324edf27b82ef502cc14cffc8 /usr.bin | |
parent | c326c9da542ea064bd243d71b785da7f5667a058 (diff) |
Mostly clean -Wall + 64bit issues.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/netstat/if.c | 17 | ||||
-rw-r--r-- | usr.bin/netstat/inet.c | 206 | ||||
-rw-r--r-- | usr.bin/netstat/ipx.c | 28 | ||||
-rw-r--r-- | usr.bin/netstat/iso.c | 149 | ||||
-rw-r--r-- | usr.bin/netstat/main.c | 13 | ||||
-rw-r--r-- | usr.bin/netstat/mbuf.c | 12 | ||||
-rw-r--r-- | usr.bin/netstat/mroute.c | 29 | ||||
-rw-r--r-- | usr.bin/netstat/netstat.h | 6 | ||||
-rw-r--r-- | usr.bin/netstat/ns.c | 33 | ||||
-rw-r--r-- | usr.bin/netstat/route.c | 37 | ||||
-rw-r--r-- | usr.bin/netstat/unix.c | 6 |
11 files changed, 271 insertions, 265 deletions
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index 12d1be9dee4..9c53caa5f31 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.10 1997/01/17 07:12:55 millert Exp $ */ +/* $OpenBSD: if.c,v 1.11 1997/06/29 20:17:58 millert Exp $ */ /* $NetBSD: if.c,v 1.16.4.2 1996/06/07 21:46:46 thorpej Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94"; #else -static char *rcsid = "$OpenBSD: if.c,v 1.10 1997/01/17 07:12:55 millert Exp $"; +static char *rcsid = "$OpenBSD: if.c,v 1.11 1997/06/29 20:17:58 millert Exp $"; #endif #endif /* not lint */ @@ -51,6 +51,7 @@ static char *rcsid = "$OpenBSD: if.c,v 1.10 1997/01/17 07:12:55 millert Exp $"; #include <net/if_types.h> #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> @@ -142,7 +143,7 @@ intpr(interval, ifnetaddr) *cp = '\0'; ifaddraddr = (u_long)ifnet.if_addrlist.tqh_first; } - printf("%-5.5s %-5d ", name, ifnet.if_mtu); + printf("%-5.5s %-5ld ", name, ifnet.if_mtu); if (ifaddraddr == 0) { printf("%-11.11s ", "none"); printf("%-15.15s ", "none"); @@ -199,7 +200,7 @@ intpr(interval, ifnetaddr) char netnum[8]; *(union ipx_net *) &net = sipx->sipx_addr.ipx_net; - sprintf(netnum, "%xH", ntohl(net)); + sprintf(netnum, "%lxH", ntohl(net)); upHex(netnum); printf("ipx:%-8s", netnum); printf("%-17s ", @@ -214,7 +215,7 @@ intpr(interval, ifnetaddr) char netnum[8]; *(union ns_net *) &net = sns->sns_addr.x_net; - sprintf(netnum, "%xH", ntohl(net)); + sprintf(netnum, "%lxH", ntohl(net)); upHex(netnum); printf("ns:%-8s ", netnum); printf("%-17s ", @@ -229,7 +230,7 @@ intpr(interval, ifnetaddr) if (sdl->sdl_type == IFT_ETHER || sdl->sdl_type == IFT_FDDI) printf("%-17.17s ", - ether_ntoa(LLADDR(sdl))); + ether_ntoa((struct ether_addr *)LLADDR(sdl))); else { cp = (char *)LLADDR(sdl); n = sdl->sdl_alen; @@ -254,7 +255,7 @@ intpr(interval, ifnetaddr) } ifaddraddr = (u_long)ifaddr.ifa.ifa_list.tqe_next; } - printf("%8d %5d %8d %5d %5d", + printf("%8ld %5ld %8ld %5ld %5ld", ifnet.if_ipackets, ifnet.if_ierrors, ifnet.if_opackets, ifnet.if_oerrors, ifnet.if_collisions); @@ -374,7 +375,7 @@ loop: continue; } if (ip == interesting) { - printf("%8d %5d %8d %5d %5d", + printf("%8ld %5ld %8ld %5ld %5ld", ifnet.if_ipackets - ip->ift_ip, ifnet.if_ierrors - ip->ift_ie, ifnet.if_opackets - ip->ift_op, diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 9af1ffa9def..90cd595e61a 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet.c,v 1.15 1997/06/25 07:56:18 provos Exp $ */ +/* $OpenBSD: inet.c,v 1.16 1997/06/29 20:17:59 millert Exp $ */ /* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94"; #else -static char *rcsid = "$OpenBSD: inet.c,v 1.15 1997/06/25 07:56:18 provos Exp $"; +static char *rcsid = "$OpenBSD: inet.c,v 1.16 1997/06/29 20:17:59 millert Exp $"; #endif #endif /* not lint */ @@ -149,10 +149,10 @@ protopr(off, name) } if (Aflag) if (istcp) - printf("%8x ", inpcb.inp_ppcb); + printf("%8p ", inpcb.inp_ppcb); else - printf("%8x ", prev); - printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc, + printf("%8p ", prev); + printf("%-5.5s %6ld %6ld ", name, sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc); inetprint(&inpcb.inp_laddr, (int)inpcb.inp_lport, name, 1); inetprint(&inpcb.inp_faddr, (int)inpcb.inp_fport, name, 0); @@ -188,55 +188,55 @@ tcp_stats(off, name) #define p3(f, m) if (tcpstat.f || sflag <= 1) \ printf(m, tcpstat.f, plurales(tcpstat.f)) - p(tcps_sndtotal, "\t%d packet%s sent\n"); + p(tcps_sndtotal, "\t%ld packet%s sent\n"); p2(tcps_sndpack,tcps_sndbyte, - "\t\t%d data packet%s (%qd byte%s)\n"); + "\t\t%ld data packet%s (%qd byte%s)\n"); p2(tcps_sndrexmitpack, tcps_sndrexmitbyte, - "\t\t%d data packet%s (%qd byte%s) retransmitted\n"); + "\t\t%ld data packet%s (%qd byte%s) retransmitted\n"); p2(tcps_sndacks, tcps_delack, - "\t\t%d ack-only packet%s (%d delayed)\n"); - p(tcps_sndurg, "\t\t%d URG only packet%s\n"); - p(tcps_sndprobe, "\t\t%d window probe packet%s\n"); - p(tcps_sndwinup, "\t\t%d window update packet%s\n"); - p(tcps_sndctrl, "\t\t%d control packet%s\n"); - p(tcps_rcvtotal, "\t%d packet%s received\n"); - p2(tcps_rcvackpack, tcps_rcvackbyte, "\t\t%d ack%s (for %qd byte%s)\n"); - p(tcps_rcvdupack, "\t\t%d duplicate ack%s\n"); - p(tcps_rcvacktoomuch, "\t\t%d ack%s for unsent data\n"); + "\t\t%ld ack-only packet%s (%ld delayed)\n"); + p(tcps_sndurg, "\t\t%ld URG only packet%s\n"); + p(tcps_sndprobe, "\t\t%ld window probe packet%s\n"); + p(tcps_sndwinup, "\t\t%ld window update packet%s\n"); + p(tcps_sndctrl, "\t\t%ld control packet%s\n"); + p(tcps_rcvtotal, "\t%ld packet%s received\n"); + p2(tcps_rcvackpack, tcps_rcvackbyte, "\t\t%ld ack%s (for %qd byte%s)\n"); + p(tcps_rcvdupack, "\t\t%ld duplicate ack%s\n"); + p(tcps_rcvacktoomuch, "\t\t%ld ack%s for unsent data\n"); p2(tcps_rcvpack, tcps_rcvbyte, - "\t\t%d packet%s (%qd byte%s) received in-sequence\n"); + "\t\t%ld packet%s (%qd byte%s) received in-sequence\n"); p2(tcps_rcvduppack, tcps_rcvdupbyte, - "\t\t%d completely duplicate packet%s (%qd byte%s)\n"); - p(tcps_pawsdrop, "\t\t%d old duplicate packet%s\n"); + "\t\t%ld completely duplicate packet%s (%qd byte%s)\n"); + p(tcps_pawsdrop, "\t\t%ld old duplicate packet%s\n"); p2(tcps_rcvpartduppack, tcps_rcvpartdupbyte, - "\t\t%d packet%s with some dup. data (%qd byte%s duped)\n"); + "\t\t%ld packet%s with some dup. data (%qd byte%s duped)\n"); p2(tcps_rcvoopack, tcps_rcvoobyte, - "\t\t%d out-of-order packet%s (%qd byte%s)\n"); + "\t\t%ld out-of-order packet%s (%qd byte%s)\n"); p2(tcps_rcvpackafterwin, tcps_rcvbyteafterwin, - "\t\t%d packet%s (%qd byte%s) of data after window\n"); - p(tcps_rcvwinprobe, "\t\t%d window probe%s\n"); - p(tcps_rcvwinupd, "\t\t%d window update packet%s\n"); - p(tcps_rcvafterclose, "\t\t%d packet%s received after close\n"); - p(tcps_rcvbadsum, "\t\t%d discarded for bad checksum%s\n"); - p(tcps_rcvbadoff, "\t\t%d discarded for bad header offset field%s\n"); - p(tcps_rcvshort, "\t\t%d discarded because packet too short\n"); - p(tcps_connattempt, "\t%d connection request%s\n"); - p(tcps_accepts, "\t%d connection accept%s\n"); - p(tcps_connects, "\t%d connection%s established (including accepts)\n"); + "\t\t%ld packet%s (%qd byte%s) of data after window\n"); + p(tcps_rcvwinprobe, "\t\t%ld window probe%s\n"); + p(tcps_rcvwinupd, "\t\t%ld window update packet%s\n"); + p(tcps_rcvafterclose, "\t\t%ld packet%s received after close\n"); + p(tcps_rcvbadsum, "\t\t%ld discarded for bad checksum%s\n"); + p(tcps_rcvbadoff, "\t\t%ld discarded for bad header offset field%s\n"); + p(tcps_rcvshort, "\t\t%ld discarded because packet too short\n"); + p(tcps_connattempt, "\t%ld connection request%s\n"); + p(tcps_accepts, "\t%ld connection accept%s\n"); + p(tcps_connects, "\t%ld connection%s established (including accepts)\n"); p2(tcps_closed, tcps_drops, - "\t%d connection%s closed (including %d drop%s)\n"); - p(tcps_conndrops, "\t%d embryonic connection%s dropped\n"); + "\t%ld connection%s closed (including %ld drop%s)\n"); + p(tcps_conndrops, "\t%ld embryonic connection%s dropped\n"); p2(tcps_rttupdated, tcps_segstimed, - "\t%d segment%s updated rtt (of %d attempt%s)\n"); - p(tcps_rexmttimeo, "\t%d retransmit timeout%s\n"); - p(tcps_timeoutdrop, "\t\t%d connection%s dropped by rexmit timeout\n"); - p(tcps_persisttimeo, "\t%d persist timeout%s\n"); - p(tcps_keeptimeo, "\t%d keepalive timeout%s\n"); - p(tcps_keepprobe, "\t\t%d keepalive probe%s sent\n"); - p(tcps_keepdrops, "\t\t%d connection%s dropped by keepalive\n"); - p(tcps_predack, "\t%d correct ACK header prediction%s\n"); - p(tcps_preddat, "\t%d correct data packet header prediction%s\n"); - p3(tcps_pcbhashmiss, "\t%d PCB cache miss%s\n"); + "\t%ld segment%s updated rtt (of %ld attempt%s)\n"); + p(tcps_rexmttimeo, "\t%ld retransmit timeout%s\n"); + p(tcps_timeoutdrop, "\t\t%ld connection%s dropped by rexmit timeout\n"); + p(tcps_persisttimeo, "\t%ld persist timeout%s\n"); + p(tcps_keeptimeo, "\t%ld keepalive timeout%s\n"); + p(tcps_keepprobe, "\t\t%ld keepalive probe%s sent\n"); + p(tcps_keepdrops, "\t\t%ld connection%s dropped by keepalive\n"); + p(tcps_predack, "\t%ld correct ACK header prediction%s\n"); + p(tcps_preddat, "\t%ld correct data packet header prediction%s\n"); + p3(tcps_pcbhashmiss, "\t%ld PCB cache miss%s\n"); #undef p #undef p2 #undef p3 @@ -259,13 +259,13 @@ udp_stats(off, name) printf("%s:\n", name); #define p(f, m) if (udpstat.f || sflag <= 1) \ printf(m, udpstat.f, plural(udpstat.f)) - p(udps_ipackets, "\t%u datagram%s received\n"); - p(udps_hdrops, "\t%u with incomplete header\n"); - p(udps_badlen, "\t%u with bad data length field\n"); - p(udps_badsum, "\t%u with bad checksum\n"); - p(udps_noport, "\t%u dropped due to no socket\n"); - p(udps_noportbcast, "\t%u broadcast/multicast datagram%s dropped due to no socket\n"); - p(udps_fullsock, "\t%u dropped due to full socket buffers\n"); + p(udps_ipackets, "\t%lu datagram%s received\n"); + p(udps_hdrops, "\t%lu with incomplete header\n"); + p(udps_badlen, "\t%lu with bad data length field\n"); + p(udps_badsum, "\t%lu with bad checksum\n"); + p(udps_noport, "\t%lu dropped due to no socket\n"); + p(udps_noportbcast, "\t%lu broadcast/multicast datagram%s dropped due to no socket\n"); + p(udps_fullsock, "\t%lu dropped due to full socket buffers\n"); delivered = udpstat.udps_ipackets - udpstat.udps_hdrops - udpstat.udps_badlen - @@ -274,8 +274,8 @@ udp_stats(off, name) udpstat.udps_noportbcast - udpstat.udps_fullsock; if (delivered || sflag <= 1) - printf("\t%u delivered\n", delivered); - p(udps_opackets, "\t%u datagram%s output\n"); + printf("\t%lu delivered\n", delivered); + p(udps_opackets, "\t%lu datagram%s output\n"); #undef p } @@ -297,31 +297,31 @@ ip_stats(off, name) #define p(f, m) if (ipstat.f || sflag <= 1) \ printf(m, ipstat.f, plural(ipstat.f)) - p(ips_total, "\t%u total packet%s received\n"); - p(ips_badsum, "\t%u bad header checksum%s\n"); - p(ips_toosmall, "\t%u with size smaller than minimum\n"); - p(ips_tooshort, "\t%u with data size < data length\n"); - p(ips_badhlen, "\t%u with header length < data size\n"); - p(ips_badlen, "\t%u with data length < header length\n"); - p(ips_badoptions, "\t%u with bad options\n"); - p(ips_badvers, "\t%u with incorrect version number\n"); - p(ips_fragments, "\t%u fragment%s received\n"); - p(ips_fragdropped, "\t%u fragment%s dropped (dup or out of space)\n"); - p(ips_badfrags, "\t%u malformed fragment%s dropped\n"); - p(ips_fragtimeout, "\t%u fragment%s dropped after timeout\n"); - p(ips_reassembled, "\t%u packet%s reassembled ok\n"); - p(ips_delivered, "\t%u packet%s for this host\n"); - p(ips_noproto, "\t%u packet%s for unknown/unsupported protocol\n"); - p(ips_forward, "\t%u packet%s forwarded\n"); - p(ips_cantforward, "\t%u packet%s not forwardable\n"); - p(ips_redirectsent, "\t%u redirect%s sent\n"); - p(ips_localout, "\t%u packet%s sent from this host\n"); - p(ips_rawout, "\t%u packet%s sent with fabricated ip header\n"); - p(ips_odropped, "\t%u output packet%s dropped due to no bufs, etc.\n"); - p(ips_noroute, "\t%u output packet%s discarded due to no route\n"); - p(ips_fragmented, "\t%u output datagram%s fragmented\n"); - p(ips_ofragments, "\t%u fragment%s created\n"); - p(ips_cantfrag, "\t%u datagram%s that can't be fragmented\n"); + p(ips_total, "\t%lu total packet%s received\n"); + p(ips_badsum, "\t%lu bad header checksum%s\n"); + p(ips_toosmall, "\t%lu with size smaller than minimum\n"); + p(ips_tooshort, "\t%lu with data size < data length\n"); + p(ips_badhlen, "\t%lu with header length < data size\n"); + p(ips_badlen, "\t%lu with data length < header length\n"); + p(ips_badoptions, "\t%lu with bad options\n"); + p(ips_badvers, "\t%lu with incorrect version number\n"); + p(ips_fragments, "\t%lu fragment%s received\n"); + p(ips_fragdropped, "\t%lu fragment%s dropped (dup or out of space)\n"); + p(ips_badfrags, "\t%lu malformed fragment%s dropped\n"); + p(ips_fragtimeout, "\t%lu fragment%s dropped after timeout\n"); + p(ips_reassembled, "\t%lu packet%s reassembled ok\n"); + p(ips_delivered, "\t%lu packet%s for this host\n"); + p(ips_noproto, "\t%lu packet%s for unknown/unsupported protocol\n"); + p(ips_forward, "\t%lu packet%s forwarded\n"); + p(ips_cantforward, "\t%lu packet%s not forwardable\n"); + p(ips_redirectsent, "\t%lu redirect%s sent\n"); + p(ips_localout, "\t%lu packet%s sent from this host\n"); + p(ips_rawout, "\t%lu packet%s sent with fabricated ip header\n"); + p(ips_odropped, "\t%lu output packet%s dropped due to no bufs, etc.\n"); + p(ips_noroute, "\t%lu output packet%s discarded due to no route\n"); + p(ips_fragmented, "\t%lu output datagram%s fragmented\n"); + p(ips_ofragments, "\t%lu fragment%s created\n"); + p(ips_cantfrag, "\t%lu datagram%s that can't be fragmented\n"); #undef p } @@ -366,32 +366,32 @@ icmp_stats(off, name) #define p(f, m) if (icmpstat.f || sflag <= 1) \ printf(m, icmpstat.f, plural(icmpstat.f)) - p(icps_error, "\t%u call%s to icmp_error\n"); + p(icps_error, "\t%lu call%s to icmp_error\n"); p(icps_oldicmp, - "\t%u error%s not generated 'cuz old message was icmp\n"); + "\t%lu error%s not generated 'cuz old message was icmp\n"); for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++) if (icmpstat.icps_outhist[i] != 0) { if (first) { printf("\tOutput histogram:\n"); first = 0; } - printf("\t\t%s: %u\n", icmpnames[i], + printf("\t\t%s: %lu\n", icmpnames[i], icmpstat.icps_outhist[i]); } - p(icps_badcode, "\t%u message%s with bad code fields\n"); - p(icps_tooshort, "\t%u message%s < minimum length\n"); - p(icps_checksum, "\t%u bad checksum%s\n"); - p(icps_badlen, "\t%u message%s with bad length\n"); + p(icps_badcode, "\t%lu message%s with bad code fields\n"); + p(icps_tooshort, "\t%lu message%s < minimum length\n"); + p(icps_checksum, "\t%lu bad checksum%s\n"); + p(icps_badlen, "\t%lu message%s with bad length\n"); for (first = 1, i = 0; i < ICMP_MAXTYPE + 1; i++) if (icmpstat.icps_inhist[i] != 0) { if (first) { printf("\tInput histogram:\n"); first = 0; } - printf("\t\t%s: %u\n", icmpnames[i], + printf("\t\t%s: %lu\n", icmpnames[i], icmpstat.icps_inhist[i]); } - p(icps_reflect, "\t%u message response%s generated\n"); + p(icps_reflect, "\t%lu message response%s generated\n"); #undef p } @@ -414,28 +414,28 @@ igmp_stats(off, name) printf(m, igmpstat.f, plural(igmpstat.f)) #define py(f, m) if (igmpstat.f || sflag <= 1) \ printf(m, igmpstat.f, igmpstat.f != 1 ? "ies" : "y") - p(igps_rcv_total, "\t%u message%s received\n"); - p(igps_rcv_tooshort, "\t%u message%s received with too few bytes\n"); - p(igps_rcv_badsum, "\t%u message%s received with bad checksum\n"); - py(igps_rcv_queries, "\t%u membership quer%s received\n"); - py(igps_rcv_badqueries, "\t%u membership quer%s received with invalid field(s)\n"); - p(igps_rcv_reports, "\t%u membership report%s received\n"); - p(igps_rcv_badreports, "\t%u membership report%s received with invalid field(s)\n"); - p(igps_rcv_ourreports, "\t%u membership report%s received for groups to which we belong\n"); - p(igps_snd_reports, "\t%u membership report%s sent\n"); + p(igps_rcv_total, "\t%lu message%s received\n"); + p(igps_rcv_tooshort, "\t%lu message%s received with too few bytes\n"); + p(igps_rcv_badsum, "\t%lu message%s received with bad checksum\n"); + py(igps_rcv_queries, "\t%lu membership quer%s received\n"); + py(igps_rcv_badqueries, "\t%lu membership quer%s received with invalid field(s)\n"); + p(igps_rcv_reports, "\t%lu membership report%s received\n"); + p(igps_rcv_badreports, "\t%lu membership report%s received with invalid field(s)\n"); + p(igps_rcv_ourreports, "\t%lu membership report%s received for groups to which we belong\n"); + p(igps_snd_reports, "\t%lu membership report%s sent\n"); #undef p #undef py } struct rpcnams { struct rpcnams *next; - int port; + in_port_t port; char *rpcname; }; char * getrpcportnam(port) - int port; + in_port_t port; { struct sockaddr_in server_addr; register struct hostent *hp; @@ -482,7 +482,7 @@ getrpcportnam(port) if (rpc) n->rpcname = strdup(rpc->r_name); else { - sprintf(num, "%d", head->pml_map.pm_prog); + sprintf(num, "%ld", head->pml_map.pm_prog); n->rpcname = strdup(num); } } @@ -502,7 +502,7 @@ getrpcportnam(port) void inetprint(in, port, proto, local) register struct in_addr *in; - int port; + in_port_t port; char *proto; int local; { @@ -516,10 +516,10 @@ inetprint(in, port, proto, local) sp = getservbyport((int)port, proto); if (sp || port == 0) sprintf(cp, "%.8s", sp ? sp->s_name : "*"); - else if (local && !nflag && (nam = getrpcportnam(ntohs((u_short)port)))) - sprintf(cp, "%d[%.8s]", ntohs((u_short)port), nam); + else if (local && !nflag && (nam = getrpcportnam(ntohs(port)))) + sprintf(cp, "%d[%.8s]", ntohs(port), nam); else - sprintf(cp, "%d", ntohs((u_short)port)); + sprintf(cp, "%d", ntohs(port)); width = Aflag ? 18 : 22; printf(" %-*.*s", width, width, line); } diff --git a/usr.bin/netstat/ipx.c b/usr.bin/netstat/ipx.c index 8c0ad9e5119..960b4b6dd5e 100644 --- a/usr.bin/netstat/ipx.c +++ b/usr.bin/netstat/ipx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipx.c,v 1.1 1996/08/16 09:29:32 mickey Exp $ */ +/* $OpenBSD: ipx.c,v 1.2 1997/06/29 20:18:00 millert Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "from: @(#)ns.c 8.1 (Berkeley) 6/6/93"; #else -static char *rcsid = "$OpenBSD: ipx.c,v 1.1 1996/08/16 09:29:32 mickey Exp $"; +static char *rcsid = "$OpenBSD: ipx.c,v 1.2 1997/06/29 20:18:00 millert Exp $"; #endif #endif /* not lint */ @@ -136,8 +136,8 @@ ipxprotopr(off, name) first = 0; } if (Aflag) - printf("%8x ", ipxpcb.ipxp_ppcb); - printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc, + printf("%8p ", ipxpcb.ipxp_ppcb); + printf("%-5.5s %6ld %6ld ", name, sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc); printf(" %-22.22s", ipx_prpr(&ipxpcb.ipxp_laddr)); printf(" %-22.22s", ipx_prpr(&ipxpcb.ipxp_faddr)); @@ -152,7 +152,7 @@ ipxprotopr(off, name) } } #define ANY(x,y,z) \ - ((x) ? printf("\t%d %s%s%s -- %s\n",x,y,plural(x),z,"x") : 0) + ((x) ? printf("\t%ld %s%s%s -- %s\n",x,y,plural(x),z,"x") : 0) /* * Dump SPX statistics structure. @@ -169,18 +169,18 @@ spx_stats(off, name) return; kread(off, (char *)&spx_istat, sizeof (spx_istat)); printf("%s:\n", name); - ANY(spx_istat.nonucn, "connection", " dropped due to no new sockets "); - ANY(spx_istat.gonawy, "connection", " terminated due to our end dying"); - ANY(spx_istat.nonucn, "connection", + ANY((long)spx_istat.nonucn, "connection", " dropped due to no new sockets "); + ANY((long)spx_istat.gonawy, "connection", " terminated due to our end dying"); + ANY((long)spx_istat.nonucn, "connection", " dropped due to inability to connect"); - ANY(spx_istat.noconn, "connection", + ANY((long)spx_istat.noconn, "connection", " dropped due to inability to connect"); - ANY(spx_istat.notme, "connection", + ANY((long)spx_istat.notme, "connection", " incompleted due to mismatched id's"); - ANY(spx_istat.wrncon, "connection", " dropped due to mismatched id's"); - ANY(spx_istat.bdreas, "packet", " dropped out of sequence"); - ANY(spx_istat.lstdup, "packet", " duplicating the highest packet"); - ANY(spx_istat.notyet, "packet", " refused as exceeding allocation"); + ANY((long)spx_istat.wrncon, "connection", " dropped due to mismatched id's"); + ANY((long)spx_istat.bdreas, "packet", " dropped out of sequence"); + ANY((long)spx_istat.lstdup, "packet", " duplicating the highest packet"); + ANY((long)spx_istat.notyet, "packet", " refused as exceeding allocation"); ANY(spxstat.spxs_connattempt, "connection", " initiated"); ANY(spxstat.spxs_accepts, "connection", " accepted"); ANY(spxstat.spxs_connects, "connection", " established"); diff --git a/usr.bin/netstat/iso.c b/usr.bin/netstat/iso.c index 6f5d6af88ef..f717aaf30f1 100644 --- a/usr.bin/netstat/iso.c +++ b/usr.bin/netstat/iso.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iso.c,v 1.3 1997/01/17 07:12:58 millert Exp $ */ +/* $OpenBSD: iso.c,v 1.4 1997/06/29 20:18:00 millert Exp $ */ /* $NetBSD: iso.c,v 1.12 1995/10/03 21:42:38 thorpej Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "from: @(#)iso.c 8.1 (Berkeley) 6/6/93"; #else -static char *rcsid = "$OpenBSD: iso.c,v 1.3 1997/01/17 07:12:58 millert Exp $"; +static char *rcsid = "$OpenBSD: iso.c,v 1.4 1997/06/29 20:18:00 millert Exp $"; #endif #endif /* not lint */ @@ -244,7 +244,7 @@ iso_protopr(off, name) next = isopcb.isop_next; kget(next, isopcb); if (isopcb.isop_prev != prev) { - printf("prev 0x%x next 0x%x isop_prev 0x%x isop_next 0x%x???\n", + printf("prev 0x%p next 0x%p isop_prev 0x%p isop_next 0x%p???\n", prev, next, isopcb.isop_prev, isopcb.isop_next); break; } @@ -275,9 +275,10 @@ iso_protopr1(kern_addr, istp) first = 0; } if (Aflag) - printf("%8x ", + printf("%8p ", (sockb.so_pcb ? (void *)sockb.so_pcb : (void *)kern_addr)); - printf("%-5.5s %6d %6d ", "tp", sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc); + printf("%-5.5s %6ld %6ld ", "tp", sockb.so_rcv.sb_cc, + sockb.so_snd.sb_cc); if (istp && tpcb.tp_lsuffixlen) { hexprint(tpcb.tp_lsuffixlen, tpcb.tp_lsuffix, "()"); printf("\t"); @@ -327,7 +328,7 @@ tp_protopr(off, name) continue; kget(tpr->tpr_pcb, tpcb); if (tpcb.tp_state == ST_ERROR) - printf("undefined tpcb state: 0x%x\n", tpr->tpr_pcb); + printf("undefined tpcb state: 0x%p\n", tpr->tpr_pcb); if (!aflag && (tpcb.tp_state == TP_LISTENING || tpcb.tp_state == TP_CLOSED || @@ -361,8 +362,8 @@ tp_inproto(pcb) if (!aflag && inet_lnaof(inpcb.inp_laddr) == INADDR_ANY) return; if (Aflag) - printf("%8x ", pcb); - printf("%-5.5s %6d %6d ", "tpip", + printf("%8lx ", pcb); + printf("%-5.5s %6ld %6ld ", "tpip", sockb.so_rcv.sb_cc, sockb.so_snd.sb_cc); inetprint(&inpcb.inp_laddr, inpcb.inp_lport, "tp"); inetprint(&inpcb.inp_faddr, inpcb.inp_fport, "tp"); @@ -558,119 +559,119 @@ tprintstat(s, indent) fprintf(OUT, "%*sReceiving:\n",indent," "); fprintf(OUT, - "\t%*s%d variable parameter%s ignored\n", indent," ", + "\t%*s%ld variable parameter%s ignored\n", indent," ", s->ts_param_ignored ,plural(s->ts_param_ignored)); fprintf(OUT, - "\t%*s%d invalid parameter code%s\n", indent, " ", + "\t%*s%ld invalid parameter code%s\n", indent, " ", s->ts_inv_pcode ,plural(s->ts_inv_pcode)); fprintf(OUT, - "\t%*s%d invalid parameter value%s\n", indent, " ", + "\t%*s%ld invalid parameter value%s\n", indent, " ", s->ts_inv_pval ,plural(s->ts_inv_pval)); fprintf(OUT, - "\t%*s%d invalid dutype%s\n", indent, " ", + "\t%*s%ld invalid dutype%s\n", indent, " ", s->ts_inv_dutype ,plural(s->ts_inv_dutype)); fprintf(OUT, - "\t%*s%d negotiation failure%s\n", indent, " ", + "\t%*s%ld negotiation failure%s\n", indent, " ", s->ts_negotfailed ,plural(s->ts_negotfailed)); fprintf(OUT, - "\t%*s%d invalid destination reference%s\n", indent, " ", + "\t%*s%ld invalid destination reference%s\n", indent, " ", s->ts_inv_dref ,plural(s->ts_inv_dref)); fprintf(OUT, - "\t%*s%d invalid suffix parameter%s\n", indent, " ", + "\t%*s%ld invalid suffix parameter%s\n", indent, " ", s->ts_inv_sufx ,plural(s->ts_inv_sufx)); fprintf(OUT, - "\t%*s%d invalid length\n",indent, " ", s->ts_inv_length); + "\t%*s%ld invalid length\n",indent, " ", s->ts_inv_length); fprintf(OUT, - "\t%*s%d invalid checksum%s\n", indent, " ", + "\t%*s%ld invalid checksum%s\n", indent, " ", s->ts_bad_csum ,plural(s->ts_bad_csum)); fprintf(OUT, - "\t%*s%d DT%s out of order\n", indent, " ", + "\t%*s%ld DT%s out of order\n", indent, " ", s->ts_dt_ooo ,plural(s->ts_dt_ooo)); fprintf(OUT, - "\t%*s%d DT%s not in window\n", indent, " ", + "\t%*s%ld DT%s not in window\n", indent, " ", s->ts_dt_niw ,plural(s->ts_dt_niw)); fprintf(OUT, - "\t%*s%d duplicate DT%s\n", indent, " ", + "\t%*s%ld duplicate DT%s\n", indent, " ", s->ts_dt_dup ,plural(s->ts_dt_dup)); fprintf(OUT, - "\t%*s%d XPD%s not in window\n", indent, " ", + "\t%*s%ld XPD%s not in window\n", indent, " ", s->ts_xpd_niw ,plural(s->ts_xpd_niw)); fprintf(OUT, - "\t%*s%d XPD%s w/o credit to stash\n", indent, " ", + "\t%*s%ld XPD%s w/o credit to stash\n", indent, " ", s->ts_xpd_dup ,plural(s->ts_xpd_dup)); fprintf(OUT, - "\t%*s%d time%s local credit reneged\n", indent, " ", + "\t%*s%ld time%s local credit reneged\n", indent, " ", s->ts_lcdt_reduced ,plural(s->ts_lcdt_reduced)); fprintf(OUT, - "\t%*s%d concatenated TPDU%s\n", indent, " ", + "\t%*s%ld concatenated TPDU%s\n", indent, " ", s->ts_concat_rcvd ,plural(s->ts_concat_rcvd)); fprintf(OUT, "%*sSending:\n", indent, " "); fprintf(OUT, - "\t%*s%d XPD mark%s discarded\n", indent, " ", + "\t%*s%ld XPD mark%s discarded\n", indent, " ", s->ts_xpdmark_del ,plural(s->ts_xpdmark_del)); fprintf(OUT, - "\t%*sXPD stopped data flow %d time%s\n", indent, " ", + "\t%*sXPD stopped data flow %ld time%s\n", indent, " ", s->ts_xpd_intheway ,plural(s->ts_xpd_intheway)); fprintf(OUT, - "\t%*s%d time%s foreign window closed\n", indent, " ", + "\t%*s%ld time%s foreign window closed\n", indent, " ", s->ts_zfcdt ,plural(s->ts_zfcdt)); fprintf(OUT, "%*sMiscellaneous:\n", indent, " "); fprintf(OUT, - "\t%*s%d small mbuf%s\n", indent, " ", + "\t%*s%ld small mbuf%s\n", indent, " ", s->ts_mb_small ,plural(s->ts_mb_small)); fprintf(OUT, - "\t%*s%d cluster%s\n", indent, " ", + "\t%*s%ld cluster%s\n", indent, " ", s->ts_mb_cluster, plural(s->ts_mb_cluster)); fprintf(OUT, - "\t%*s%d source quench \n",indent, " ", + "\t%*s%ld source quench \n",indent, " ", s->ts_quench); fprintf(OUT, - "\t%*s%d dec bit%s\n", indent, " ", + "\t%*s%ld dec bit%s\n", indent, " ", s->ts_rcvdecbit, plural(s->ts_rcvdecbit)); fprintf(OUT, "\t%*sM:L ( M mbuf chains of length L)\n", indent, " "); { register int j; - fprintf(OUT, "\t%*s%d: over 16\n", indent, " ", + fprintf(OUT, "\t%*s%ld: over 16\n", indent, " ", s->ts_mb_len_distr[0]); for( j=1; j<=8; j++) { fprintf(OUT, - "\t%*s%d: %d\t\t%d: %d\n", indent, " ", + "\t%*s%ld: %d\t\t%ld: %d\n", indent, " ", s->ts_mb_len_distr[j],j, s->ts_mb_len_distr[j<<1],j<<1 ); } } fprintf(OUT, - "\t%*s%d EOT rcvd\n", indent, " ", s->ts_eot_input); + "\t%*s%ld EOT rcvd\n", indent, " ", s->ts_eot_input); fprintf(OUT, - "\t%*s%d EOT sent\n", indent, " ", s->ts_EOT_sent); + "\t%*s%ld EOT sent\n", indent, " ", s->ts_EOT_sent); fprintf(OUT, - "\t%*s%d EOT indication%s\n", indent, " ", + "\t%*s%ld EOT indication%s\n", indent, " ", s->ts_eot_user ,plural(s->ts_eot_user)); fprintf(OUT, "%*sConnections:\n", indent, " "); fprintf(OUT, - "\t%*s%d connection%s used extended format\n", indent, " ", + "\t%*s%ld connection%s used extended format\n", indent, " ", s->ts_xtd_fmt ,plural(s->ts_xtd_fmt)); fprintf(OUT, - "\t%*s%d connection%s allowed transport expedited data\n", indent, " ", + "\t%*s%ld connection%s allowed transport expedited data\n", indent, " ", s->ts_use_txpd ,plural(s->ts_use_txpd)); fprintf(OUT, - "\t%*s%d connection%s turned off checksumming\n", indent, " ", + "\t%*s%ld connection%s turned off checksumming\n", indent, " ", s->ts_csum_off ,plural(s->ts_csum_off)); fprintf(OUT, - "\t%*s%d connection%s dropped due to retrans limit\n", indent, " ", + "\t%*s%ld connection%s dropped due to retrans limit\n", indent, " ", s->ts_conn_gaveup ,plural(s->ts_conn_gaveup)); fprintf(OUT, - "\t%*s%d tp 4 connection%s\n", indent, " ", + "\t%*s%ld tp 4 connection%s\n", indent, " ", s->ts_tp4_conn ,plural(s->ts_tp4_conn)); fprintf(OUT, - "\t%*s%d tp 0 connection%s\n", indent, " ", + "\t%*s%ld tp 0 connection%s\n", indent, " ", s->ts_tp0_conn ,plural(s->ts_tp0_conn)); { register int j; @@ -698,7 +699,7 @@ tprintstat(s, indent) } } fprintf(OUT, -"\n%*sTpdus RECVD [%d valid, %3.6f %% of total (%d); %d dropped]\n",indent," ", +"\n%*sTpdus RECVD [%ld valid, %3.6f %% of total (%ld); %ld dropped]\n",indent," ", s->ts_tpdu_rcvd , ((s->ts_pkt_rcvd > 0) ? ((100 * (float)s->ts_tpdu_rcvd)/(float)s->ts_pkt_rcvd) @@ -707,94 +708,94 @@ tprintstat(s, indent) s->ts_recv_drop ); fprintf(OUT, - "\t%*sDT %6d AK %6d DR %4d CR %4d \n", indent, " ", - s->ts_DT_rcvd, s->ts_AK_rcvd, s->ts_DR_rcvd, s->ts_CR_rcvd); + "\t%*sDT %6ld AK %6ld DR %4ld CR %4ld \n", indent, + " ", s->ts_DT_rcvd, s->ts_AK_rcvd, s->ts_DR_rcvd, s->ts_CR_rcvd); fprintf(OUT, - "\t%*sXPD %6d XAK %6d DC %4d CC %4d ER %4d\n", indent, " ", - s->ts_XPD_rcvd, s->ts_XAK_rcvd, s->ts_DC_rcvd, s->ts_CC_rcvd, - s->ts_ER_rcvd); + "\t%*sXPD %6ld XAK %6ld DC %4ld CC %4ld ER %4ld\n", + indent, " ", s->ts_XPD_rcvd, s->ts_XAK_rcvd, s->ts_DC_rcvd, + s->ts_CC_rcvd, s->ts_ER_rcvd); fprintf(OUT, - "\n%*sTpdus SENT [%d total, %d dropped]\n", indent, " ", + "\n%*sTpdus SENT [%ld total, %ld dropped]\n", indent, " ", s->ts_tpdu_sent, s->ts_send_drop); fprintf(OUT, - "\t%*sDT %6d AK %6d DR %4d CR %4d \n", indent, " ", - s->ts_DT_sent, s->ts_AK_sent, s->ts_DR_sent, s->ts_CR_sent); + "\t%*sDT %6ld AK %6ld DR %4ld CR %4ld \n", indent, + " ", s->ts_DT_sent, s->ts_AK_sent, s->ts_DR_sent, s->ts_CR_sent); fprintf(OUT, - "\t%*sXPD %6d XAK %6d DC %4d CC %4d ER %4d\n", indent, " ", - s->ts_XPD_sent, s->ts_XAK_sent, s->ts_DC_sent, s->ts_CC_sent, - s->ts_ER_sent); + "\t%*sXPD %6ld XAK %6ld DC %4ld CC %4ld ER %4ld\n", + indent, " ", s->ts_XPD_sent, s->ts_XAK_sent, s->ts_DC_sent, + s->ts_CC_sent, s->ts_ER_sent); fprintf(OUT, "\n%*sRetransmissions:\n", indent, " "); #define PERCENT(X,Y) (((Y)>0)?((100 *(float)(X)) / (float) (Y)):0) fprintf(OUT, - "\t%*sCR %6d CC %6d DR %6d \n", indent, " ", + "\t%*sCR %6ld CC %6ld DR %6ld \n", indent, " ", s->ts_retrans_cr, s->ts_retrans_cc, s->ts_retrans_dr); fprintf(OUT, - "\t%*sDT %6d (%5.2f%%)\n", indent, " ", + "\t%*sDT %6ld (%5.2f%%)\n", indent, " ", s->ts_retrans_dt, PERCENT(s->ts_retrans_dt, s->ts_DT_sent)); fprintf(OUT, - "\t%*sXPD %6d (%5.2f%%)\n", indent, " ", + "\t%*sXPD %6ld (%5.2f%%)\n", indent, " ", s->ts_retrans_xpd, PERCENT(s->ts_retrans_xpd, s->ts_XPD_sent)); fprintf(OUT, - "\n%*sE Timers: [%6d ticks]\n", indent, " ", s->ts_Eticks); + "\n%*sE Timers: [%6ld ticks]\n", indent, " ", s->ts_Eticks); fprintf(OUT, - "%*s%6d timer%s set \t%6d timer%s expired \t%6d timer%s cancelled\n",indent, " ", + "%*s%6ld timer%s set \t%6ld timer%s expired \t%6ld timer%s cancelled\n",indent, " ", s->ts_Eset ,plural(s->ts_Eset), s->ts_Eexpired ,plural(s->ts_Eexpired), s->ts_Ecan_act ,plural(s->ts_Ecan_act)); fprintf(OUT, - "\n%*sC Timers: [%6d ticks]\n", indent, " ",s->ts_Cticks); + "\n%*sC Timers: [%6ld ticks]\n", indent, " ",s->ts_Cticks); fprintf(OUT, - "%*s%6d timer%s set \t%6d timer%s expired \t%6d timer%s cancelled\n", + "%*s%6ld timer%s set \t%6ld timer%s expired \t%6ld timer%s cancelled\n", indent, " ", s->ts_Cset ,plural(s->ts_Cset), s->ts_Cexpired ,plural(s->ts_Cexpired), s->ts_Ccan_act ,plural(s->ts_Ccan_act)); fprintf(OUT, - "%*s%6d inactive timer%s cancelled\n", indent, " ", + "%*s%6ld inactive timer%s cancelled\n", indent, " ", s->ts_Ccan_inact ,plural(s->ts_Ccan_inact)); fprintf(OUT, "\n%*sPathological debugging activity:\n", indent, " "); fprintf(OUT, - "\t%*s%6d CC%s sent to zero dref\n", indent, " ", + "\t%*s%6ld CC%s sent to zero dref\n", indent, " ", s->ts_zdebug ,plural(s->ts_zdebug)); /* SAME LINE AS ABOVE */ fprintf(OUT, - "\t%*s%6d random DT%s dropped\n", indent, " ", + "\t%*s%6ld random DT%s dropped\n", indent, " ", s->ts_ydebug ,plural(s->ts_ydebug)); fprintf(OUT, - "\t%*s%6d illegally large XPD TPDU%s\n", indent, " ", + "\t%*s%6ld illegally large XPD TPDU%s\n", indent, " ", s->ts_vdebug ,plural(s->ts_vdebug)); fprintf(OUT, - "\t%*s%6d faked reneging of cdt\n", indent, " ", + "\t%*s%6ld faked reneging of cdt\n", indent, " ", s->ts_ldebug ); fprintf(OUT, "\n%*sACK reasons:\n", indent, " "); - fprintf(OUT, "\t%*s%6d not acked immediately\n", indent, " ", + fprintf(OUT, "\t%*s%6ld not acked immediately\n", indent, " ", s->ts_ackreason[_ACK_DONT_] ); - fprintf(OUT, "\t%*s%6d strategy==each\n", indent, " ", + fprintf(OUT, "\t%*s%6ld strategy==each\n", indent, " ", s->ts_ackreason[_ACK_STRAT_EACH_] ); - fprintf(OUT, "\t%*s%6d strategy==fullwindow\n", indent, " ", + fprintf(OUT, "\t%*s%6ld strategy==fullwindow\n", indent, " ", s->ts_ackreason[_ACK_STRAT_FULLWIN_] ); - fprintf(OUT, "\t%*s%6d duplicate DT\n", indent, " ", + fprintf(OUT, "\t%*s%6ld duplicate DT\n", indent, " ", s->ts_ackreason[_ACK_DUP_] ); - fprintf(OUT, "\t%*s%6d EOTSDU\n", indent, " ", + fprintf(OUT, "\t%*s%6ld EOTSDU\n", indent, " ", s->ts_ackreason[_ACK_EOT_] ); - fprintf(OUT, "\t%*s%6d reordered DT\n", indent, " ", + fprintf(OUT, "\t%*s%6ld reordered DT\n", indent, " ", s->ts_ackreason[_ACK_REORDER_] ); - fprintf(OUT, "\t%*s%6d user rcvd\n", indent, " ", + fprintf(OUT, "\t%*s%6ld user rcvd\n", indent, " ", s->ts_ackreason[_ACK_USRRCV_] ); - fprintf(OUT, "\t%*s%6d fcc reqd\n", indent, " ", + fprintf(OUT, "\t%*s%6ld fcc reqd\n", indent, " ", s->ts_ackreason[_ACK_FCC_] ); } #ifndef SSEL diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 555b1534802..bb87ed2d254 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.10 1997/06/18 01:52:27 angelos Exp $ */ +/* $OpenBSD: main.c,v 1.11 1997/06/29 20:18:01 millert Exp $ */ /* $NetBSD: main.c,v 1.9 1996/05/07 02:55:02 thorpej Exp $ */ /* @@ -44,7 +44,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.10 1997/06/18 01:52:27 angelos Exp $"; +static char *rcsid = "$OpenBSD: main.c,v 1.11 1997/06/29 20:18:01 millert Exp $"; #endif #endif /* not lint */ @@ -147,7 +147,7 @@ struct nlist nl[] = { { "_espstat"}, #define N_IP4STAT 38 { "_ip4stat"}, - "", + { ""}, }; struct protox { @@ -231,7 +231,6 @@ main(argc, argv) extern int optind; register struct protoent *p; register struct protox *tp; /* for printing cblocks & stats */ - register char *cp; int ch; char *nlistf = NULL, *memf = NULL; char buf[_POSIX2_LINE_MAX]; @@ -409,7 +408,7 @@ main(argc, argv) setprotoent(1); setservent(1); /* ugh, this is O(MN) ... why do we do this? */ - while (p = getprotoent()) { + while ((p = getprotoent())) { for (tp = protox; tp->pr_name; tp++) if (strcmp(tp->pr_name, p->p_name) == 0) break; @@ -520,11 +519,11 @@ name2protox(name) * Try to find the name in the list of "well-known" names. If that * fails, check if name is an alias for an Internet protocol. */ - if (tp = knownname(name)) + if ((tp = knownname(name))) return (tp); setprotoent(1); /* make protocol lookup cheaper */ - while (p = getprotoent()) { + while ((p = getprotoent())) { /* assert: name not same as p->name */ for (alias = p->p_aliases; *alias; alias++) if (strcmp(name, *alias) == 0) { diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c index d91437120be..4874c4102b6 100644 --- a/usr.bin/netstat/mbuf.c +++ b/usr.bin/netstat/mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.c,v 1.3 1996/06/26 05:37:23 deraadt Exp $ */ +/* $OpenBSD: mbuf.c,v 1.4 1997/06/29 20:18:01 millert Exp $ */ /* $NetBSD: mbuf.c,v 1.9 1996/05/07 02:55:03 thorpej Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "from: @(#)mbuf.c 8.1 (Berkeley) 6/6/93"; #else -static char *rcsid = "$OpenBSD: mbuf.c,v 1.3 1996/06/26 05:37:23 deraadt Exp $"; +static char *rcsid = "$OpenBSD: mbuf.c,v 1.4 1997/06/29 20:18:01 millert Exp $"; #endif #endif /* not lint */ @@ -112,13 +112,13 @@ mbpr(mbaddr) printf("\t%u mbufs allocated to <mbuf type %d>\n", mbstat.m_mtypes[i], i); } - printf("%u/%u mapped pages in use\n", + printf("%lu/%lu mapped pages in use\n", mbstat.m_clusters - mbstat.m_clfree, mbstat.m_clusters); totmem = totmbufs * MSIZE + mbstat.m_clusters * MCLBYTES; totfree = mbstat.m_clfree * MCLBYTES; printf("%u Kbytes allocated to network (%d%% in use)\n", totmem / 1024, (totmem - totfree) * 100 / totmem); - printf("%u requests for memory denied\n", mbstat.m_drops); - printf("%u requests for memory delayed\n", mbstat.m_wait); - printf("%u calls to protocol drain routines\n", mbstat.m_drain); + printf("%lu requests for memory denied\n", mbstat.m_drops); + printf("%lu requests for memory delayed\n", mbstat.m_wait); + printf("%lu calls to protocol drain routines\n", mbstat.m_drain); } diff --git a/usr.bin/netstat/mroute.c b/usr.bin/netstat/mroute.c index 676b5aef814..58b7a7cf3fc 100644 --- a/usr.bin/netstat/mroute.c +++ b/usr.bin/netstat/mroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mroute.c,v 1.3 1996/06/26 05:37:23 deraadt Exp $ */ +/* $OpenBSD: mroute.c,v 1.4 1997/06/29 20:18:02 millert Exp $ */ /* $NetBSD: mroute.c,v 1.10 1996/05/11 13:51:27 mycroft Exp $ */ /* @@ -80,7 +80,7 @@ pktscale(n) n /= 1048576; } - sprintf(buf, "%u%c", n, t); + sprintf(buf, "%lu%c", n, t); return (buf); } @@ -95,7 +95,6 @@ mroutepr(mrpaddr, mfchashtbladdr, mfchashaddr, vifaddr) struct mfc *mfcp, mfc; register struct vif *v; register vifi_t vifi; - struct in_addr *grp; int i; int banner_printed; int saved_nflag; @@ -156,7 +155,7 @@ mroutepr(mrpaddr, mfchashtbladdr, mfchashaddr, vifaddr) printf(" %3u %3u %5u %-15.15s", vifi, v->v_threshold, v->v_rate_limit, routename(v->v_lcl_addr.s_addr)); - printf(" %-15.15s %6u %7u\n", (v->v_flags & VIFF_TUNNEL) ? + printf(" %-15.15s %6lu %7lu\n", (v->v_flags & VIFF_TUNNEL) ? routename(v->v_rmt_addr.s_addr) : "", v->v_pkt_in, v->v_pkt_out); } @@ -238,26 +237,26 @@ mrt_stats(mrpaddr, mstaddr) kread(mstaddr, (char *)&mrtstat, sizeof(mrtstat)); printf("multicast routing:\n"); - printf("\t%d datagram%s with no route for origin\n", + printf("\t%ld datagram%s with no route for origin\n", mrtstat.mrts_no_route, plural(mrtstat.mrts_no_route)); - printf("\t%d upcall%s made to mrouted\n", + printf("\t%ld upcall%s made to mrouted\n", mrtstat.mrts_upcalls, plural(mrtstat.mrts_upcalls)); - printf("\t%d datagram%s with malformed tunnel options\n", + printf("\t%ld datagram%s with malformed tunnel options\n", mrtstat.mrts_bad_tunnel, plural(mrtstat.mrts_bad_tunnel)); - printf("\t%d datagram%s with no room for tunnel options\n", + printf("\t%ld datagram%s with no room for tunnel options\n", mrtstat.mrts_cant_tunnel, plural(mrtstat.mrts_cant_tunnel)); - printf("\t%d datagram%s arrived on wrong interface\n", + printf("\t%ld datagram%s arrived on wrong interface\n", mrtstat.mrts_wrong_if, plural(mrtstat.mrts_wrong_if)); - printf("\t%d datagram%s dropped due to upcall Q overflow\n", + printf("\t%ld datagram%s dropped due to upcall Q overflow\n", mrtstat.mrts_upq_ovflw, plural(mrtstat.mrts_upq_ovflw)); - printf("\t%d datagram%s dropped due to upcall socket overflow\n", + printf("\t%ld datagram%s dropped due to upcall socket overflow\n", mrtstat.mrts_upq_sockfull, plural(mrtstat.mrts_upq_sockfull)); - printf("\t%d datagram%s cleaned up by the cache\n", + printf("\t%ld datagram%s cleaned up by the cache\n", mrtstat.mrts_cache_cleanups, plural(mrtstat.mrts_cache_cleanups)); - printf("\t%d datagram%s dropped selectively by ratelimiter\n", + printf("\t%ld datagram%s dropped selectively by ratelimiter\n", mrtstat.mrts_drop_sel, plural(mrtstat.mrts_drop_sel)); - printf("\t%d datagram%s dropped - bucket Q overflow\n", + printf("\t%ld datagram%s dropped - bucket Q overflow\n", mrtstat.mrts_q_overflow, plural(mrtstat.mrts_q_overflow)); - printf("\t%d datagram%s dropped - larger than bkt size\n", + printf("\t%ld datagram%s dropped - larger than bkt size\n", mrtstat.mrts_pkt2large, plural(mrtstat.mrts_pkt2large)); } diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h index af0160f5f67..8626e8fcf5c 100644 --- a/usr.bin/netstat/netstat.h +++ b/usr.bin/netstat/netstat.h @@ -1,4 +1,4 @@ -/* $OpenBSD: netstat.h,v 1.6 1997/06/18 01:52:27 angelos Exp $ */ +/* $OpenBSD: netstat.h,v 1.7 1997/06/29 20:18:02 millert Exp $ */ /* $NetBSD: netstat.h,v 1.6 1996/05/07 02:55:05 thorpej Exp $ */ /* @@ -89,8 +89,8 @@ char *ns_phost __P((struct sockaddr *)); char *ipx_phost __P((struct sockaddr *)); void upHex __P((char *)); -char *routename __P((u_int32_t)); -char *netname __P((u_int32_t, u_int32_t)); +char *routename __P((in_addr_t)); +char *netname __P((in_addr_t, in_addr_t)); char *ns_print __P((struct sockaddr *)); char *ipx_print __P((struct sockaddr *)); void routepr __P((u_long)); diff --git a/usr.bin/netstat/ns.c b/usr.bin/netstat/ns.c index c46cf16e404..658c857ea60 100644 --- a/usr.bin/netstat/ns.c +++ b/usr.bin/netstat/ns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ns.c,v 1.2 1996/06/26 05:37:25 deraadt Exp $ */ +/* $OpenBSD: ns.c,v 1.3 1997/06/29 20:18:03 millert Exp $ */ /* $NetBSD: ns.c,v 1.8 1995/10/03 21:42:46 thorpej Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "from: @(#)ns.c 8.1 (Berkeley) 6/6/93"; #else -static char *rcsid = "$OpenBSD: ns.c,v 1.2 1996/06/26 05:37:25 deraadt Exp $"; +static char *rcsid = "$OpenBSD: ns.c,v 1.3 1997/06/29 20:18:03 millert Exp $"; #endif #endif /* not lint */ @@ -140,8 +140,8 @@ nsprotopr(off, name) first = 0; } if (Aflag) - printf("%8x ", ppcb); - printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc, + 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)); @@ -157,7 +157,7 @@ nsprotopr(off, name) } } #define ANY(x,y,z) \ - ((x) ? printf("\t%d %s%s%s -- %s\n",x,y,plural(x),z,"x") : 0) + ((x) ? printf("\t%ld %s%s%s -- %s\n",x,y,plural(x),z,"x") : 0) /* * Dump SPP statistics structure. @@ -174,18 +174,23 @@ spp_stats(off, name) return; kread(off, (char *)&spp_istat, sizeof (spp_istat)); printf("%s:\n", name); - ANY(spp_istat.nonucn, "connection", " dropped due to no new sockets "); - ANY(spp_istat.gonawy, "connection", " terminated due to our end dying"); - ANY(spp_istat.nonucn, "connection", + 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(spp_istat.noconn, "connection", + ANY((long)spp_istat.noconn, "connection", " dropped due to inability to connect"); - ANY(spp_istat.notme, "connection", + ANY((long)spp_istat.notme, "connection", " incompleted due to mismatched id's"); - ANY(spp_istat.wrncon, "connection", " dropped due to mismatched id's"); - ANY(spp_istat.bdreas, "packet", " dropped out of sequence"); - ANY(spp_istat.lstdup, "packet", " duplicating the highest packet"); - ANY(spp_istat.notyet, "packet", " refused as exceeding allocation"); + 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"); diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index b02e0852286..9db72c71d56 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.12 1997/06/29 08:45:23 provos Exp $ */ +/* $OpenBSD: route.c,v 1.13 1997/06/29 20:18:03 millert Exp $ */ /* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94"; #else -static char *rcsid = "$OpenBSD: route.c,v 1.12 1997/06/29 08:45:23 provos Exp $"; +static char *rcsid = "$OpenBSD: route.c,v 1.13 1997/06/29 20:18:03 millert Exp $"; #endif #endif /* not lint */ @@ -54,6 +54,7 @@ static char *rcsid = "$OpenBSD: route.c,v 1.12 1997/06/29 08:45:23 provos Exp $" #include <net/route.h> #undef _KERNEL #include <netinet/in.h> +#include <arpa/inet.h> #include <netns/ns.h> @@ -256,7 +257,7 @@ again: kget(rn, rnode); if (rnode.rn_b < 0) { if (Aflag) - printf("%-8.8x ", rn); + printf("%-8.8lx ", rn); if (rnode.rn_flags & RNF_ROOT) { if (Aflag) printf("(root node)%s", @@ -271,11 +272,11 @@ again: 0, 44); putchar('\n'); } - if (rn = rnode.rn_dupedkey) + if ((rn = rnode.rn_dupedkey)) goto again; } else { if (Aflag && do_rtent) { - printf("%-8.8x ", rn); + printf("%-8.8lx ", rn); p_rtnode(); } rn = rnode.rn_r; @@ -300,16 +301,16 @@ p_rtnode() return; } else { sprintf(nbuf, "(%d)", rnode.rn_b); - printf("%6.6s %8.8x : %8.8x", nbuf, rnode.rn_l, rnode.rn_r); + printf("%6.6s %8.8lx : %8.8lx", nbuf, rnode.rn_l, rnode.rn_r); } while (rm) { kget(rm, rmask); sprintf(nbuf, " %d refs, ", rmask.rm_refs); - printf(" mk = %8.8x {(%d),%s", + printf(" mk = %8.8lx {(%d),%s", rm, -1 - rmask.rm_b, rmask.rm_refs ? nbuf : " "); p_sockaddr(kgetsa((struct sockaddr *)rmask.rm_mask), 0, -1); putchar('}'); - if (rm = rmask.rm_mklist) + if ((rm = rmask.rm_mklist)) printf(" ->"); } putchar('\n'); @@ -382,7 +383,7 @@ np_rtentry(rtm) else { p_sockaddr(sa, rtm->rtm_flags, 16); if (sa->sa_len == 0) - sa->sa_len = sizeof(u_int32_t); + sa->sa_len = sizeof(in_addr_t); sa = (struct sockaddr *)(sa->sa_len + (char *)sa); p_sockaddr(sa, 0, 18); } @@ -509,9 +510,9 @@ p_rtentry(rt) p_sockaddr(sa, rt->rt_flags, WID_DST); p_sockaddr(kgetsa(rt->rt_gateway), RTF_HOST, WID_GW); p_flags(rt->rt_flags, "%-6.6s "); - printf("%6d %8d ", rt->rt_refcnt, rt->rt_use); + printf("%6d %8ld ", rt->rt_refcnt, rt->rt_use); if (rt->rt_rmx.rmx_mtu) - printf("%6d ", rt->rt_rmx.rmx_mtu); + printf("%6ld ", rt->rt_rmx.rmx_mtu); else printf("%6s ", "-"); if (rt->rt_ifp) { @@ -527,7 +528,7 @@ p_rtentry(rt) char * routename(in) - u_int32_t in; + in_addr_t in; { register char *cp; static char line[MAXHOSTNAMELEN + 1]; @@ -571,12 +572,12 @@ routename(in) */ char * netname(in, mask) - u_int32_t in, mask; + in_addr_t in, mask; { char *cp = 0; static char line[MAXHOSTNAMELEN + 1]; struct netent *np = 0; - u_int32_t net, subnetshift; + in_addr_t net, subnetshift; in = ntohl(in); mask = ntohl(mask); @@ -662,7 +663,7 @@ ns_print(sa) register struct sockaddr_ns *sns = (struct sockaddr_ns*)sa; struct ns_addr work; union { union ns_net net_e; u_long long_e; } net; - u_short port; + in_port_t port; static char mybuf[50], cport[10], chost[25]; char *host = ""; register char *p; register u_char *q; @@ -730,10 +731,10 @@ ipx_print(sa) register struct sockaddr_ipx *sipx = (struct sockaddr_ipx*)sa; struct ipx_addr work; union { union ipx_net net_e; u_long long_e; } net; - u_short port; + in_port_t port; static char mybuf[50], cport[10], chost[25]; char *host = ""; - register char *p; register u_char *q; + register char *q; work = sipx->sipx_addr; port = ntohs(work.ipx_port); @@ -801,7 +802,7 @@ encap_print(rt) printf("%-15s ", inet_ntoa(sen1.sen_ip_dst)); printf("%-15s %-5u %-5u ", inet_ntoa(sen2.sen_ip_dst), sen1.sen_dport, sen1.sen_proto); - printf("%-15s %08x %-u\n", inet_ntoa(sen3.sen_ipsp_dst), + printf("%-15s %08x %-lu\n", inet_ntoa(sen3.sen_ipsp_dst), ntohl(sen3.sen_ipsp_spi), rt->rt_use); } diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c index 9726aa6fe8c..5a8ea6cea61 100644 --- a/usr.bin/netstat/unix.c +++ b/usr.bin/netstat/unix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unix.c,v 1.2 1996/06/26 05:37:26 deraadt Exp $ */ +/* $OpenBSD: unix.c,v 1.3 1997/06/29 20:18:04 millert Exp $ */ /* $NetBSD: unix.c,v 1.13 1995/10/03 21:42:48 thorpej Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "from: @(#)unix.c 8.1 (Berkeley) 6/6/93"; #else -static char *rcsid = "$OpenBSD: unix.c,v 1.2 1996/06/26 05:37:26 deraadt Exp $"; +static char *rcsid = "$OpenBSD: unix.c,v 1.3 1997/06/29 20:18:04 millert Exp $"; #endif #endif /* not lint */ @@ -129,7 +129,7 @@ unixdomainpr(so, soaddr) "Inode", "Conn", "Refs", "Nextref"); first = 0; } - printf("%8x %-6.6s %6d %6d %8x %8x %8x %8x", + printf("%8p %-6.6s %6ld %6ld %8p %8p %8p %8p", soaddr, socktype[so->so_type], so->so_rcv.sb_cc, so->so_snd.sb_cc, unp->unp_vnode, unp->unp_conn, unp->unp_refs, unp->unp_nextref); |