version 1.59, 2002/05/16 14:18:34 |
version 1.60, 2002/05/27 01:50:36 |
|
|
} |
} |
#ifdef INET6 |
#ifdef INET6 |
if (inpcb.inp_flags & INP_IPV6) { |
if (inpcb.inp_flags & INP_IPV6) { |
strcpy(namebuf, name0); |
strlcpy(namebuf, name0, sizeof namebuf); |
strcat(namebuf, "6"); |
strlcat(namebuf, "6", sizeof namebuf); |
name = namebuf; |
name = namebuf; |
} else |
} else |
name = name0; |
name = name0; |
|
|
kread(off, (char *)&tcpstat, sizeof (tcpstat)); |
kread(off, (char *)&tcpstat, sizeof (tcpstat)); |
|
|
#define p(f, m) if (tcpstat.f || sflag <= 1) \ |
#define p(f, m) if (tcpstat.f || sflag <= 1) \ |
printf(m, tcpstat.f, plural(tcpstat.f)) |
printf(m, tcpstat.f, plural(tcpstat.f)) |
#define p1(f, m) if (tcpstat.f || sflag <= 1) \ |
#define p1(f, m) if (tcpstat.f || sflag <= 1) \ |
printf(m, tcpstat.f) |
printf(m, tcpstat.f) |
#define p2(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ |
#define p2(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ |
printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2, plural(tcpstat.f2)) |
printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2, plural(tcpstat.f2)) |
#define p2a(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ |
#define p2a(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \ |
printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2) |
printf(m, tcpstat.f1, plural(tcpstat.f1), tcpstat.f2) |
#define p3(f, m) if (tcpstat.f || sflag <= 1) \ |
#define p3(f, m) if (tcpstat.f || sflag <= 1) \ |
printf(m, tcpstat.f, plurales(tcpstat.f)) |
printf(m, tcpstat.f, plurales(tcpstat.f)) |
|
|
p(tcps_sndtotal, "\t%u packet%s sent\n"); |
p(tcps_sndtotal, "\t%u packet%s sent\n"); |
p2(tcps_sndpack,tcps_sndbyte, |
p2(tcps_sndpack,tcps_sndbyte, |
"\t\t%u data packet%s (%qd byte%s)\n"); |
"\t\t%u data packet%s (%qd byte%s)\n"); |
p2(tcps_sndrexmitpack, tcps_sndrexmitbyte, |
p2(tcps_sndrexmitpack, tcps_sndrexmitbyte, |
"\t\t%u data packet%s (%qd byte%s) retransmitted\n"); |
"\t\t%u data packet%s (%qd byte%s) retransmitted\n"); |
p(tcps_sndrexmitfast, "\t\t%qd fast retransmitted packet%s\n"); |
p(tcps_sndrexmitfast, "\t\t%qd fast retransmitted packet%s\n"); |
p2a(tcps_sndacks, tcps_delack, |
p2a(tcps_sndacks, tcps_delack, |
"\t\t%u ack-only packet%s (%u delayed)\n"); |
"\t\t%u ack-only packet%s (%u delayed)\n"); |
p(tcps_sndurg, "\t\t%u URG only packet%s\n"); |
p(tcps_sndurg, "\t\t%u URG only packet%s\n"); |
p(tcps_sndprobe, "\t\t%u window probe packet%s\n"); |
p(tcps_sndprobe, "\t\t%u window probe packet%s\n"); |
p(tcps_sndwinup, "\t\t%u window update packet%s\n"); |
p(tcps_sndwinup, "\t\t%u window update packet%s\n"); |
|
|
p(tcps_rcvdupack, "\t\t%u duplicate ack%s\n"); |
p(tcps_rcvdupack, "\t\t%u duplicate ack%s\n"); |
p(tcps_rcvacktoomuch, "\t\t%u ack%s for unsent data\n"); |
p(tcps_rcvacktoomuch, "\t\t%u ack%s for unsent data\n"); |
p2(tcps_rcvpack, tcps_rcvbyte, |
p2(tcps_rcvpack, tcps_rcvbyte, |
"\t\t%u packet%s (%qu byte%s) received in-sequence\n"); |
"\t\t%u packet%s (%qu byte%s) received in-sequence\n"); |
p2(tcps_rcvduppack, tcps_rcvdupbyte, |
p2(tcps_rcvduppack, tcps_rcvdupbyte, |
"\t\t%u completely duplicate packet%s (%qd byte%s)\n"); |
"\t\t%u completely duplicate packet%s (%qd byte%s)\n"); |
p(tcps_pawsdrop, "\t\t%u old duplicate packet%s\n"); |
p(tcps_pawsdrop, "\t\t%u old duplicate packet%s\n"); |
p2(tcps_rcvpartduppack, tcps_rcvpartdupbyte, |
p2(tcps_rcvpartduppack, tcps_rcvpartdupbyte, |
"\t\t%u packet%s with some dup. data (%qd byte%s duped)\n"); |
"\t\t%u packet%s with some dup. data (%qd byte%s duped)\n"); |
p2(tcps_rcvoopack, tcps_rcvoobyte, |
p2(tcps_rcvoopack, tcps_rcvoobyte, |
"\t\t%u out-of-order packet%s (%qd byte%s)\n"); |
"\t\t%u out-of-order packet%s (%qd byte%s)\n"); |
p2(tcps_rcvpackafterwin, tcps_rcvbyteafterwin, |
p2(tcps_rcvpackafterwin, tcps_rcvbyteafterwin, |
"\t\t%u packet%s (%qd byte%s) of data after window\n"); |
"\t\t%u packet%s (%qd byte%s) of data after window\n"); |
p(tcps_rcvwinprobe, "\t\t%u window probe%s\n"); |
p(tcps_rcvwinprobe, "\t\t%u window probe%s\n"); |
p(tcps_rcvwinupd, "\t\t%u window update packet%s\n"); |
p(tcps_rcvwinupd, "\t\t%u window update packet%s\n"); |
p(tcps_rcvafterclose, "\t\t%u packet%s received after close\n"); |
p(tcps_rcvafterclose, "\t\t%u packet%s received after close\n"); |
|
|
p(tcps_accepts, "\t%u connection accept%s\n"); |
p(tcps_accepts, "\t%u connection accept%s\n"); |
p(tcps_connects, "\t%u connection%s established (including accepts)\n"); |
p(tcps_connects, "\t%u connection%s established (including accepts)\n"); |
p2(tcps_closed, tcps_drops, |
p2(tcps_closed, tcps_drops, |
"\t%u connection%s closed (including %u drop%s)\n"); |
"\t%u connection%s closed (including %u drop%s)\n"); |
p(tcps_conndrops, "\t%u embryonic connection%s dropped\n"); |
p(tcps_conndrops, "\t%u embryonic connection%s dropped\n"); |
p2(tcps_rttupdated, tcps_segstimed, |
p2(tcps_rttupdated, tcps_segstimed, |
"\t%u segment%s updated rtt (of %u attempt%s)\n"); |
"\t%u segment%s updated rtt (of %u attempt%s)\n"); |
p(tcps_rexmttimeo, "\t%u retransmit timeout%s\n"); |
p(tcps_rexmttimeo, "\t%u retransmit timeout%s\n"); |
p(tcps_timeoutdrop, "\t\t%u connection%s dropped by rexmit timeout\n"); |
p(tcps_timeoutdrop, "\t\t%u connection%s dropped by rexmit timeout\n"); |
p(tcps_persisttimeo, "\t%u persist timeout%s\n"); |
p(tcps_persisttimeo, "\t%u persist timeout%s\n"); |
|
|
kread(off, (char *)&udpstat, sizeof (udpstat)); |
kread(off, (char *)&udpstat, sizeof (udpstat)); |
printf("%s:\n", name); |
printf("%s:\n", name); |
#define p(f, m) if (udpstat.f || sflag <= 1) \ |
#define p(f, m) if (udpstat.f || sflag <= 1) \ |
printf(m, udpstat.f, plural(udpstat.f)) |
printf(m, udpstat.f, plural(udpstat.f)) |
#define p1(f, m) if (udpstat.f || sflag <= 1) \ |
#define p1(f, m) if (udpstat.f || sflag <= 1) \ |
printf(m, udpstat.f) |
printf(m, udpstat.f) |
|
|
p(udps_ipackets, "\t%lu datagram%s received\n"); |
p(udps_ipackets, "\t%lu datagram%s received\n"); |
p1(udps_hdrops, "\t%lu with incomplete header\n"); |
p1(udps_hdrops, "\t%lu with incomplete header\n"); |
p1(udps_badlen, "\t%lu with bad data length field\n"); |
p1(udps_badlen, "\t%lu with bad data length field\n"); |
|
|
p(udps_noportbcast, "\t%lu broadcast/multicast datagram%s dropped due to no socket\n"); |
p(udps_noportbcast, "\t%lu broadcast/multicast datagram%s dropped due to no socket\n"); |
p1(udps_nosec, "\t%lu dropped due to missing IPsec protection\n"); |
p1(udps_nosec, "\t%lu dropped due to missing IPsec protection\n"); |
p1(udps_fullsock, "\t%lu dropped due to full socket buffers\n"); |
p1(udps_fullsock, "\t%lu dropped due to full socket buffers\n"); |
delivered = udpstat.udps_ipackets - |
delivered = udpstat.udps_ipackets - udpstat.udps_hdrops - |
udpstat.udps_hdrops - |
udpstat.udps_badlen - udpstat.udps_badsum - |
udpstat.udps_badlen - |
udpstat.udps_noport - udpstat.udps_noportbcast - |
udpstat.udps_badsum - |
udpstat.udps_fullsock; |
udpstat.udps_noport - |
|
udpstat.udps_noportbcast - |
|
udpstat.udps_fullsock; |
|
if (delivered || sflag <= 1) |
if (delivered || sflag <= 1) |
printf("\t%lu delivered\n", delivered); |
printf("\t%lu delivered\n", delivered); |
p(udps_opackets, "\t%lu datagram%s output\n"); |
p(udps_opackets, "\t%lu datagram%s output\n"); |
|
|
printf("%s:\n", name); |
printf("%s:\n", name); |
|
|
#define p(f, m) if (ipstat.f || sflag <= 1) \ |
#define p(f, m) if (ipstat.f || sflag <= 1) \ |
printf(m, ipstat.f, plural(ipstat.f)) |
printf(m, ipstat.f, plural(ipstat.f)) |
#define p1(f, m) if (ipstat.f || sflag <= 1) \ |
#define p1(f, m) if (ipstat.f || sflag <= 1) \ |
printf(m, ipstat.f) |
printf(m, ipstat.f) |
|
|
p(ips_total, "\t%lu total packet%s received\n"); |
p(ips_total, "\t%lu total packet%s received\n"); |
p(ips_badsum, "\t%lu bad header checksum%s\n"); |
p(ips_badsum, "\t%lu bad header checksum%s\n"); |
|
|
printf("%s:\n", name); |
printf("%s:\n", name); |
|
|
#define p(f, m) if (icmpstat.f || sflag <= 1) \ |
#define p(f, m) if (icmpstat.f || sflag <= 1) \ |
printf(m, icmpstat.f, plural(icmpstat.f)) |
printf(m, icmpstat.f, plural(icmpstat.f)) |
|
|
p(icps_error, "\t%lu call%s to icmp_error\n"); |
p(icps_error, "\t%lu call%s to icmp_error\n"); |
p(icps_oldicmp, |
p(icps_oldicmp, |
|
|
first = 0; |
first = 0; |
} |
} |
printf("\t\t%s: %lu\n", icmpnames[i], |
printf("\t\t%s: %lu\n", icmpnames[i], |
icmpstat.icps_outhist[i]); |
icmpstat.icps_outhist[i]); |
} |
} |
p(icps_badcode, "\t%lu message%s with bad code fields\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_tooshort, "\t%lu message%s < minimum length\n"); |
|
|
first = 0; |
first = 0; |
} |
} |
printf("\t\t%s: %lu\n", icmpnames[i], |
printf("\t\t%s: %lu\n", icmpnames[i], |
icmpstat.icps_inhist[i]); |
icmpstat.icps_inhist[i]); |
} |
} |
p(icps_reflect, "\t%lu message response%s generated\n"); |
p(icps_reflect, "\t%lu message response%s generated\n"); |
#undef p |
#undef p |
|
|
printf("%s:\n", name); |
printf("%s:\n", name); |
|
|
#define p(f, m) if (igmpstat.f || sflag <= 1) \ |
#define p(f, m) if (igmpstat.f || sflag <= 1) \ |
printf(m, igmpstat.f, plural(igmpstat.f)) |
printf(m, igmpstat.f, plural(igmpstat.f)) |
#define py(f, m) if (igmpstat.f || sflag <= 1) \ |
#define py(f, m) if (igmpstat.f || sflag <= 1) \ |
printf(m, igmpstat.f, igmpstat.f != 1 ? "ies" : "y") |
printf(m, igmpstat.f, igmpstat.f != 1 ? "ies" : "y") |
|
|
p(igps_rcv_total, "\t%lu message%s received\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_tooshort, "\t%lu message%s received with too few bytes\n"); |
p(igps_rcv_badsum, "\t%lu message%s received with bad checksum\n"); |
p(igps_rcv_badsum, "\t%lu message%s received with bad checksum\n"); |
|
|
first = 0; |
first = 0; |
if (gethostname(domain, sizeof(domain)) == 0 && |
if (gethostname(domain, sizeof(domain)) == 0 && |
(cp = strchr(domain, '.'))) |
(cp = strchr(domain, '.'))) |
(void) strcpy(domain, cp + 1); |
(void) strlcpy(domain, cp + 1, sizeof domain); |
else |
else |
domain[0] = 0; |
domain[0] = '\0'; |
} |
} |
cp = 0; |
cp = 0; |
if (!nflag && inp->s_addr != INADDR_ANY) { |
if (!nflag && inp->s_addr != INADDR_ANY) { |
|
|
printf("%s:\n", name); |
printf("%s:\n", name); |
|
|
#define p(f, m) if (ahstat.f || sflag <= 1) \ |
#define p(f, m) if (ahstat.f || sflag <= 1) \ |
printf(m, ahstat.f, plural(ahstat.f)) |
printf(m, ahstat.f, plural(ahstat.f)) |
#define p1(f, m) if (ahstat.f || sflag <= 1) \ |
#define p1(f, m) if (ahstat.f || sflag <= 1) \ |
printf(m, ahstat.f) |
printf(m, ahstat.f) |
|
|
p1(ahs_input, "\t%u input AH packets\n"); |
p1(ahs_input, "\t%u input AH packets\n"); |
p1(ahs_output, "\t%u output AH packets\n"); |
p1(ahs_output, "\t%u output AH packets\n"); |
|
|
printf("%s:\n", name); |
printf("%s:\n", name); |
|
|
#define p(f, m) if (etheripstat.f || sflag <= 1) \ |
#define p(f, m) if (etheripstat.f || sflag <= 1) \ |
printf(m, etheripstat.f, plural(etheripstat.f)) |
printf(m, etheripstat.f, plural(etheripstat.f)) |
|
|
|
|
p(etherip_hdrops, "\t%u packet%s shorter than header shows\n"); |
p(etherip_hdrops, "\t%u packet%s shorter than header shows\n"); |
|
|
printf("%s:\n", name); |
printf("%s:\n", name); |
|
|
#define p(f, m) if (espstat.f || sflag <= 1) \ |
#define p(f, m) if (espstat.f || sflag <= 1) \ |
printf(m, espstat.f, plural(espstat.f)) |
printf(m, espstat.f, plural(espstat.f)) |
|
|
p(esps_input, "\t%u input ESP packet%s\n"); |
p(esps_input, "\t%u input ESP packet%s\n"); |
p(esps_output, "\t%u output ESP packet%s\n"); |
p(esps_output, "\t%u output ESP packet%s\n"); |
|
|
printf("%s:\n", name); |
printf("%s:\n", name); |
|
|
#define p(f, m) if (ipipstat.f || sflag <= 1) \ |
#define p(f, m) if (ipipstat.f || sflag <= 1) \ |
printf(m, ipipstat.f, plural(ipipstat.f)) |
printf(m, ipipstat.f, plural(ipipstat.f)) |
|
|
p(ipips_ipackets, "\t%u total input packet%s\n"); |
p(ipips_ipackets, "\t%u total input packet%s\n"); |
p(ipips_opackets, "\t%u total output packet%s\n"); |
p(ipips_opackets, "\t%u total output packet%s\n"); |
|
|
printf("%s:\n", name); |
printf("%s:\n", name); |
|
|
#define p(f, m) if (ipcompstat.f || sflag <= 1) \ |
#define p(f, m) if (ipcompstat.f || sflag <= 1) \ |
printf(m, ipcompstat.f, plural(ipcompstat.f)) |
printf(m, ipcompstat.f, plural(ipcompstat.f)) |
|
|
p(ipcomps_input, "\t%u input IPCOMP packet%s\n"); |
p(ipcomps_input, "\t%u input IPCOMP packet%s\n"); |
p(ipcomps_output, "\t%u output IPCOMP packet%s\n"); |
p(ipcomps_output, "\t%u output IPCOMP packet%s\n"); |