diff options
Diffstat (limited to 'usr.bin/netstat/inet.c')
| -rw-r--r-- | usr.bin/netstat/inet.c | 182 |
1 files changed, 91 insertions, 91 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 0a2848e4b503..057f150bb429 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -136,10 +136,10 @@ protopr(off, name) } if (Aflag) if (istcp) - printf("%8x ", inpcb.inp_ppcb); + printf("%8x ", (int)inpcb.inp_ppcb); else - printf("%8x ", next); - printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc, + printf("%8x ", (int)next); + 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); inetprint(&inpcb.inp_faddr, (int)inpcb.inp_fport, name); @@ -182,63 +182,63 @@ 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 (%d byte%s)\n"); + "\t\t%ld data packet%s (%ld byte%s)\n"); p2(tcps_sndrexmitpack, tcps_sndrexmitbyte, - "\t\t%d data packet%s (%d byte%s) retransmitted\n"); - p(tcps_mturesent, "\t\t%d resend%s initiated by MTU discovery\n"); + "\t\t%ld data packet%s (%ld byte%s) retransmitted\n"); + p(tcps_mturesent, "\t\t%ld resend%s initiated by MTU discovery\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 %d 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 %ld 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 (%d byte%s) received in-sequence\n"); + "\t\t%ld packet%s (%ld byte%s) received in-sequence\n"); p2(tcps_rcvduppack, tcps_rcvdupbyte, - "\t\t%d completely duplicate packet%s (%d byte%s)\n"); - p(tcps_pawsdrop, "\t\t%d old duplicate packet%s\n"); + "\t\t%ld completely duplicate packet%s (%ld 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 (%d byte%s duped)\n"); + "\t\t%ld packet%s with some dup. data (%ld byte%s duped)\n"); p2(tcps_rcvoopack, tcps_rcvoobyte, - "\t\t%d out-of-order packet%s (%d byte%s)\n"); + "\t\t%ld out-of-order packet%s (%ld byte%s)\n"); p2(tcps_rcvpackafterwin, tcps_rcvbyteafterwin, - "\t\t%d packet%s (%d 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_badsyn, "\t%d bad connection attempt%s\n"); - p(tcps_listendrop, "\t%d listen queue overflow%s\n"); - p(tcps_connects, "\t%d connection%s established (including accepts)\n"); + "\t\t%ld packet%s (%ld 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_badsyn, "\t%ld bad connection attempt%s\n"); + p(tcps_listendrop, "\t%ld listen queue overflow%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_cachedrtt, "\t\t%d connection%s updated cached RTT on close\n"); + "\t%ld connection%s closed (including %ld drop%s)\n"); + p(tcps_cachedrtt, "\t\t%ld connection%s updated cached RTT on close\n"); p(tcps_cachedrttvar, - "\t\t%d connection%s updated cached RTT variance on close\n"); + "\t\t%ld connection%s updated cached RTT variance on close\n"); p(tcps_cachedssthresh, - "\t\t%d connection%s updated cached ssthresh on close\n"); - p(tcps_conndrops, "\t%d embryonic connection%s dropped\n"); + "\t\t%ld connection%s updated cached ssthresh on close\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_persistdrop, "\t\t%d connection%s dropped by persist timeout\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"); + "\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_persistdrop, "\t\t%ld connection%s dropped by persist timeout\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"); #undef p #undef p2 #undef p3 @@ -261,13 +261,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 - @@ -276,8 +276,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 } @@ -299,30 +299,30 @@ 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_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_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 } @@ -367,32 +367,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 } @@ -493,7 +493,7 @@ inetname(inp) else { inp->s_addr = ntohl(inp->s_addr); #define C(x) ((x) & 0xff) - sprintf(line, "%u.%u.%u.%u", C(inp->s_addr >> 24), + sprintf(line, "%lu.%lu.%lu.%lu", C(inp->s_addr >> 24), C(inp->s_addr >> 16), C(inp->s_addr >> 8), C(inp->s_addr)); } return (line); |
