more style(9)
This commit is contained in:
parent
f38512f4af
commit
3feeb33206
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=175076
@ -366,8 +366,7 @@ protopr(u_long off, const char *name, int af1, int proto)
|
||||
#endif /* INET6 */
|
||||
|| (af1 == AF_UNSPEC && ((inp->inp_vflag & INP_IPV4) == 0
|
||||
#ifdef INET6
|
||||
&& (inp->inp_vflag &
|
||||
INP_IPV6) == 0
|
||||
&& (inp->inp_vflag & INP_IPV6) == 0
|
||||
#endif /* INET6 */
|
||||
))
|
||||
)
|
||||
@ -405,14 +404,14 @@ protopr(u_long off, const char *name, int af1, int proto)
|
||||
printf("%-8.8s ", "Tcpcb");
|
||||
if (Lflag)
|
||||
printf("%-5.5s %-14.14s %-22.22s\n",
|
||||
"Proto", "Listen", "Local Address");
|
||||
"Proto", "Listen", "Local Address");
|
||||
else
|
||||
printf((Aflag && !Wflag) ?
|
||||
"%-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)");
|
||||
"Proto", "Recv-Q", "Send-Q",
|
||||
"Local Address", "Foreign Address",
|
||||
"(state)");
|
||||
first = 0;
|
||||
}
|
||||
if (Lflag && so->so_qlimit == 0)
|
||||
@ -425,77 +424,73 @@ protopr(u_long off, const char *name, int af1, int proto)
|
||||
}
|
||||
#ifdef INET6
|
||||
if ((inp->inp_vflag & INP_IPV6) != 0)
|
||||
vchar = ((inp->inp_vflag & INP_IPV4) != 0)
|
||||
? "46" : "6 ";
|
||||
vchar = ((inp->inp_vflag & INP_IPV4) != 0) ?
|
||||
"46" : "6 ";
|
||||
else
|
||||
#endif
|
||||
vchar = ((inp->inp_vflag & INP_IPV4) != 0)
|
||||
? "4 " : " ";
|
||||
vchar = ((inp->inp_vflag & INP_IPV4) != 0) ?
|
||||
"4 " : " ";
|
||||
printf("%-3.3s%-2.2s ", name, vchar);
|
||||
if (Lflag) {
|
||||
char buf1[15];
|
||||
|
||||
snprintf(buf1, 15, "%d/%d/%d", so->so_qlen,
|
||||
so->so_incqlen, so->so_qlimit);
|
||||
so->so_incqlen, so->so_qlimit);
|
||||
printf("%-14.14s ", buf1);
|
||||
} else {
|
||||
printf("%6u %6u ",
|
||||
so->so_rcv.sb_cc,
|
||||
so->so_snd.sb_cc);
|
||||
printf("%6u %6u ", so->so_rcv.sb_cc, so->so_snd.sb_cc);
|
||||
}
|
||||
if (numeric_port) {
|
||||
if (inp->inp_vflag & INP_IPV4) {
|
||||
inetprint(&inp->inp_laddr, (int)inp->inp_lport,
|
||||
name, 1);
|
||||
name, 1);
|
||||
if (!Lflag)
|
||||
inetprint(&inp->inp_faddr,
|
||||
(int)inp->inp_fport, name, 1);
|
||||
(int)inp->inp_fport, name, 1);
|
||||
}
|
||||
#ifdef INET6
|
||||
else if (inp->inp_vflag & INP_IPV6) {
|
||||
inet6print(&inp->in6p_laddr,
|
||||
(int)inp->inp_lport, name, 1);
|
||||
(int)inp->inp_lport, name, 1);
|
||||
if (!Lflag)
|
||||
inet6print(&inp->in6p_faddr,
|
||||
(int)inp->inp_fport, name, 1);
|
||||
(int)inp->inp_fport, name, 1);
|
||||
} /* else nothing printed now */
|
||||
#endif /* INET6 */
|
||||
} else if (inp->inp_flags & INP_ANONPORT) {
|
||||
if (inp->inp_vflag & INP_IPV4) {
|
||||
inetprint(&inp->inp_laddr, (int)inp->inp_lport,
|
||||
name, 1);
|
||||
name, 1);
|
||||
if (!Lflag)
|
||||
inetprint(&inp->inp_faddr,
|
||||
(int)inp->inp_fport, name, 0);
|
||||
(int)inp->inp_fport, name, 0);
|
||||
}
|
||||
#ifdef INET6
|
||||
else if (inp->inp_vflag & INP_IPV6) {
|
||||
inet6print(&inp->in6p_laddr,
|
||||
(int)inp->inp_lport, name, 1);
|
||||
(int)inp->inp_lport, name, 1);
|
||||
if (!Lflag)
|
||||
inet6print(&inp->in6p_faddr,
|
||||
(int)inp->inp_fport, name, 0);
|
||||
(int)inp->inp_fport, name, 0);
|
||||
} /* else nothing printed now */
|
||||
#endif /* INET6 */
|
||||
} else {
|
||||
if (inp->inp_vflag & INP_IPV4) {
|
||||
inetprint(&inp->inp_laddr, (int)inp->inp_lport,
|
||||
name, 0);
|
||||
name, 0);
|
||||
if (!Lflag)
|
||||
inetprint(&inp->inp_faddr,
|
||||
(int)inp->inp_fport, name,
|
||||
inp->inp_lport !=
|
||||
inp->inp_fport);
|
||||
(int)inp->inp_fport, name,
|
||||
inp->inp_lport != inp->inp_fport);
|
||||
}
|
||||
#ifdef INET6
|
||||
else if (inp->inp_vflag & INP_IPV6) {
|
||||
inet6print(&inp->in6p_laddr,
|
||||
(int)inp->inp_lport, name, 0);
|
||||
(int)inp->inp_lport, name, 0);
|
||||
if (!Lflag)
|
||||
inet6print(&inp->in6p_faddr,
|
||||
(int)inp->inp_fport, name,
|
||||
inp->inp_lport !=
|
||||
inp->inp_fport);
|
||||
(int)inp->inp_fport, name,
|
||||
inp->inp_lport != inp->inp_fport);
|
||||
} /* else nothing printed now */
|
||||
#endif /* INET6 */
|
||||
}
|
||||
@ -505,24 +500,25 @@ protopr(u_long off, const char *name, int af1, int proto)
|
||||
else {
|
||||
printf("%s", tcpstates[tp->t_state]);
|
||||
#if defined(TF_NEEDSYN) && defined(TF_NEEDFIN)
|
||||
/* Show T/TCP `hidden state' */
|
||||
if (tp->t_flags & (TF_NEEDSYN|TF_NEEDFIN))
|
||||
putchar('*');
|
||||
/* Show T/TCP `hidden state' */
|
||||
if (tp->t_flags & (TF_NEEDSYN|TF_NEEDFIN))
|
||||
putchar('*');
|
||||
#endif /* defined(TF_NEEDSYN) && defined(TF_NEEDFIN) */
|
||||
}
|
||||
}
|
||||
}
|
||||
putchar('\n');
|
||||
}
|
||||
if (xig != oxig && xig->xig_gen != oxig->xig_gen) {
|
||||
if (oxig->xig_count > xig->xig_count) {
|
||||
printf("Some %s sockets may have been deleted.\n",
|
||||
name);
|
||||
name);
|
||||
} else if (oxig->xig_count < xig->xig_count) {
|
||||
printf("Some %s sockets may have been created.\n",
|
||||
name);
|
||||
name);
|
||||
} else {
|
||||
printf("Some %s sockets may have been created or deleted.\n",
|
||||
name);
|
||||
printf(
|
||||
"Some %s sockets may have been created or deleted.\n",
|
||||
name);
|
||||
}
|
||||
}
|
||||
free(buf);
|
||||
@ -569,34 +565,34 @@ tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
|
||||
printf(m, tcpstat.f, pluralies(tcpstat.f))
|
||||
|
||||
p(tcps_sndtotal, "\t%lu packet%s sent\n");
|
||||
p2(tcps_sndpack,tcps_sndbyte,
|
||||
"\t\t%lu data packet%s (%lu byte%s)\n");
|
||||
p2(tcps_sndpack,tcps_sndbyte, "\t\t%lu data packet%s (%lu byte%s)\n");
|
||||
p2(tcps_sndrexmitpack, tcps_sndrexmitbyte,
|
||||
"\t\t%lu data packet%s (%lu byte%s) retransmitted\n");
|
||||
"\t\t%lu data packet%s (%lu byte%s) retransmitted\n");
|
||||
p(tcps_sndrexmitbad,
|
||||
"\t\t%lu data packet%s unnecessarily retransmitted\n");
|
||||
"\t\t%lu data packet%s unnecessarily retransmitted\n");
|
||||
p(tcps_mturesent, "\t\t%lu resend%s initiated by MTU discovery\n");
|
||||
p2a(tcps_sndacks, tcps_delack,
|
||||
"\t\t%lu ack-only packet%s (%lu delayed)\n");
|
||||
"\t\t%lu ack-only packet%s (%lu delayed)\n");
|
||||
p(tcps_sndurg, "\t\t%lu URG only packet%s\n");
|
||||
p(tcps_sndprobe, "\t\t%lu window probe packet%s\n");
|
||||
p(tcps_sndwinup, "\t\t%lu window update packet%s\n");
|
||||
p(tcps_sndctrl, "\t\t%lu control packet%s\n");
|
||||
p(tcps_rcvtotal, "\t%lu packet%s received\n");
|
||||
p2(tcps_rcvackpack, tcps_rcvackbyte, "\t\t%lu ack%s (for %lu byte%s)\n");
|
||||
p2(tcps_rcvackpack, tcps_rcvackbyte,
|
||||
"\t\t%lu ack%s (for %lu byte%s)\n");
|
||||
p(tcps_rcvdupack, "\t\t%lu duplicate ack%s\n");
|
||||
p(tcps_rcvacktoomuch, "\t\t%lu ack%s for unsent data\n");
|
||||
p2(tcps_rcvpack, tcps_rcvbyte,
|
||||
"\t\t%lu packet%s (%lu byte%s) received in-sequence\n");
|
||||
"\t\t%lu packet%s (%lu byte%s) received in-sequence\n");
|
||||
p2(tcps_rcvduppack, tcps_rcvdupbyte,
|
||||
"\t\t%lu completely duplicate packet%s (%lu byte%s)\n");
|
||||
"\t\t%lu completely duplicate packet%s (%lu byte%s)\n");
|
||||
p(tcps_pawsdrop, "\t\t%lu old duplicate packet%s\n");
|
||||
p2(tcps_rcvpartduppack, tcps_rcvpartdupbyte,
|
||||
"\t\t%lu packet%s with some dup. data (%lu byte%s duped)\n");
|
||||
"\t\t%lu packet%s with some dup. data (%lu byte%s duped)\n");
|
||||
p2(tcps_rcvoopack, tcps_rcvoobyte,
|
||||
"\t\t%lu out-of-order packet%s (%lu byte%s)\n");
|
||||
"\t\t%lu out-of-order packet%s (%lu byte%s)\n");
|
||||
p2(tcps_rcvpackafterwin, tcps_rcvbyteafterwin,
|
||||
"\t\t%lu packet%s (%lu byte%s) of data after window\n");
|
||||
"\t\t%lu packet%s (%lu byte%s) of data after window\n");
|
||||
p(tcps_rcvwinprobe, "\t\t%lu window probe%s\n");
|
||||
p(tcps_rcvwinupd, "\t\t%lu window update packet%s\n");
|
||||
p(tcps_rcvafterclose, "\t\t%lu packet%s received after close\n");
|
||||
@ -611,20 +607,21 @@ tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
|
||||
p(tcps_badrst, "\t%lu ignored RSTs in the window%s\n");
|
||||
p(tcps_connects, "\t%lu connection%s established (including accepts)\n");
|
||||
p2(tcps_closed, tcps_drops,
|
||||
"\t%lu connection%s closed (including %lu drop%s)\n");
|
||||
"\t%lu connection%s closed (including %lu drop%s)\n");
|
||||
p(tcps_cachedrtt, "\t\t%lu connection%s updated cached RTT on close\n");
|
||||
p(tcps_cachedrttvar,
|
||||
"\t\t%lu connection%s updated cached RTT variance on close\n");
|
||||
"\t\t%lu connection%s updated cached RTT variance on close\n");
|
||||
p(tcps_cachedssthresh,
|
||||
"\t\t%lu connection%s updated cached ssthresh on close\n");
|
||||
"\t\t%lu connection%s updated cached ssthresh on close\n");
|
||||
p(tcps_conndrops, "\t%lu embryonic connection%s dropped\n");
|
||||
p2(tcps_rttupdated, tcps_segstimed,
|
||||
"\t%lu segment%s updated rtt (of %lu attempt%s)\n");
|
||||
"\t%lu segment%s updated rtt (of %lu attempt%s)\n");
|
||||
p(tcps_rexmttimeo, "\t%lu retransmit timeout%s\n");
|
||||
p(tcps_timeoutdrop, "\t\t%lu connection%s dropped by rexmit timeout\n");
|
||||
p(tcps_persisttimeo, "\t%lu persist timeout%s\n");
|
||||
p(tcps_persistdrop, "\t\t%lu connection%s dropped by persist timeout\n");
|
||||
p(tcps_finwait2_drops, "\t%lu Connection%s (fin_wait_2) dropped because of timeout\n");
|
||||
p(tcps_finwait2_drops,
|
||||
"\t%lu Connection%s (fin_wait_2) dropped because of timeout\n");
|
||||
p(tcps_keeptimeo, "\t%lu keepalive timeout%s\n");
|
||||
p(tcps_keepprobe, "\t\t%lu keepalive probe%s sent\n");
|
||||
p(tcps_keepdrops, "\t\t%lu connection%s dropped by keepalive\n");
|
||||
@ -649,11 +646,11 @@ tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
|
||||
|
||||
p(tcps_sack_recovery_episode, "\t%lu SACK recovery episode%s\n");
|
||||
p(tcps_sack_rexmits,
|
||||
"\t%lu segment rexmit%s in SACK recovery episodes\n");
|
||||
"\t%lu segment rexmit%s in SACK recovery episodes\n");
|
||||
p(tcps_sack_rexmit_bytes,
|
||||
"\t%lu byte rexmit%s in SACK recovery episodes\n");
|
||||
"\t%lu byte rexmit%s in SACK recovery episodes\n");
|
||||
p(tcps_sack_rcv_blocks,
|
||||
"\t%lu SACK option%s (SACK blocks) received\n");
|
||||
"\t%lu SACK option%s (SACK blocks) received\n");
|
||||
p(tcps_sack_send_blocks, "\t%lu SACK option%s (SACK blocks) sent\n");
|
||||
p1a(tcps_sack_sboverflow, "\t%lu SACK scoreboard overflow\n");
|
||||
|
||||
@ -823,12 +820,12 @@ ip_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
|
||||
putchar('\n');
|
||||
p(ips_cantforward, "\t%lu packet%s not forwardable\n");
|
||||
p(ips_notmember,
|
||||
"\t%lu packet%s received for unknown multicast group\n");
|
||||
"\t%lu packet%s received for unknown multicast group\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");
|
||||
"\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");
|
||||
@ -944,10 +941,10 @@ icmp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
|
||||
}
|
||||
if (icmpnames[i] != NULL)
|
||||
printf("\t\t%s: %lu\n", icmpnames[i],
|
||||
icmpstat.icps_inhist[i]);
|
||||
icmpstat.icps_inhist[i]);
|
||||
else
|
||||
printf("\t\tunknown ICMP #%d: %lu\n", i,
|
||||
icmpstat.icps_inhist[i]);
|
||||
icmpstat.icps_inhist[i]);
|
||||
}
|
||||
p(icps_reflect, "\t%lu message response%s generated\n");
|
||||
p2(icps_badaddr, "\t%lu invalid return address%s\n");
|
||||
@ -992,13 +989,16 @@ igmp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
|
||||
#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_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");
|
||||
#undef p
|
||||
#undef py
|
||||
@ -1042,7 +1042,8 @@ pim_stats(u_long off __unused, const char *name, int af1 __unused,
|
||||
p(pims_rcv_badversion, "\t%ju message%s received with bad version\n");
|
||||
p(pims_rcv_registers_msgs, "\t%ju data register message%s received\n");
|
||||
p(pims_rcv_registers_bytes, "\t%ju data register byte%s received\n");
|
||||
p(pims_rcv_registers_wrongiif, "\t%ju data register message%s received on wrong iif\n");
|
||||
p(pims_rcv_registers_wrongiif,
|
||||
"\t%ju data register message%s received on wrong iif\n");
|
||||
p(pims_rcv_badregisters, "\t%ju bad register%s received\n");
|
||||
p(pims_snd_registers_msgs, "\t%ju data register message%s sent\n");
|
||||
p(pims_snd_registers_bytes, "\t%ju data register byte%s sent\n");
|
||||
|
Loading…
Reference in New Issue
Block a user