Changeset View
Changeset View
Standalone View
Standalone View
head/usr.bin/netstat/inet.c
Show First 20 Lines • Show All 315 Lines • ▼ Show 20 Lines | "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-45.45s} {T:/%s}"), | ||||
xo_emit((Aflag && !Wflag) ? | xo_emit((Aflag && !Wflag) ? | ||||
"{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-18.18s} {T:/%-18.18s}" : | "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-18.18s} {T:/%-18.18s}" : | ||||
((!Wflag || af1 == AF_INET) ? | ((!Wflag || af1 == AF_INET) ? | ||||
"{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-22.22s} {T:/%-22.22s}" : | "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-22.22s} {T:/%-22.22s}" : | ||||
"{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-45.45s} {T:/%-45.45s}"), | "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-45.45s} {T:/%-45.45s}"), | ||||
"Proto", "Recv-Q", "Send-Q", | "Proto", "Recv-Q", "Send-Q", | ||||
"Local Address", "Foreign Address"); | "Local Address", "Foreign Address"); | ||||
if (!xflag && !Rflag) | if (!xflag && !Rflag) | ||||
xo_emit(" (state)"); | xo_emit(" {T:/%-11.11s}", "(state)"); | ||||
} | } | ||||
if (xflag) { | if (xflag) { | ||||
xo_emit(" {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} " | xo_emit(" {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} " | ||||
"{T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} " | "{T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} " | ||||
"{T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} " | "{T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} " | ||||
"{T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s}", | "{T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s}", | ||||
"R-MBUF", "S-MBUF", "R-CLUS", "S-CLUS", | "R-MBUF", "S-MBUF", "R-CLUS", "S-CLUS", | ||||
"R-HIWA", "S-HIWA", "R-LOWA", "S-LOWA", | "R-HIWA", "S-HIWA", "R-LOWA", "S-LOWA", | ||||
"R-BCNT", "S-BCNT", "R-BMAX", "S-BMAX"); | "R-BCNT", "S-BCNT", "R-BMAX", "S-BMAX"); | ||||
xo_emit(" {T:/%7.7s} {T:/%7.7s} {T:/%7.7s} " | xo_emit(" {T:/%7.7s} {T:/%7.7s} {T:/%7.7s} " | ||||
"{T:/%7.7s} {T:/%7.7s} {T:/%7.7s}", | "{T:/%7.7s} {T:/%7.7s} {T:/%7.7s}", | ||||
"rexmt", "persist", "keep", "2msl", | "rexmt", "persist", "keep", "2msl", | ||||
"delack", "rcvtime"); | "delack", "rcvtime"); | ||||
} else if (Rflag) { | } else if (Rflag) { | ||||
xo_emit(" {T:/%8.8s} {T:/%5.5s}", | xo_emit(" {T:/%8.8s} {T:/%5.5s}", | ||||
"flowid", "ftype"); | "flowid", "ftype"); | ||||
} | } | ||||
if (Pflag) | |||||
xo_emit(" {T:/%s}", "Log ID"); | |||||
xo_emit("\n"); | xo_emit("\n"); | ||||
first = 0; | first = 0; | ||||
} | } | ||||
if (Lflag && so->so_qlimit == 0) | if (Lflag && so->so_qlimit == 0) | ||||
continue; | continue; | ||||
xo_open_instance("socket"); | xo_open_instance("socket"); | ||||
if (Aflag) { | if (Aflag) { | ||||
if (istcp) | if (istcp) | ||||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | if (xflag) { | ||||
(tp->tt_2msl % 1000) / 10, | (tp->tt_2msl % 1000) / 10, | ||||
tp->tt_delack / 1000, | tp->tt_delack / 1000, | ||||
(tp->tt_delack % 1000) / 10, | (tp->tt_delack % 1000) / 10, | ||||
tp->t_rcvtime / 1000, | tp->t_rcvtime / 1000, | ||||
(tp->t_rcvtime % 1000) / 10); | (tp->t_rcvtime % 1000) / 10); | ||||
} | } | ||||
if (istcp && !Lflag && !xflag && !Tflag && !Rflag) { | if (istcp && !Lflag && !xflag && !Tflag && !Rflag) { | ||||
if (tp->t_state < 0 || tp->t_state >= TCP_NSTATES) | if (tp->t_state < 0 || tp->t_state >= TCP_NSTATES) | ||||
xo_emit("{:tcp-state/%d}", tp->t_state); | xo_emit("{:tcp-state/%-11d}", tp->t_state); | ||||
else { | else { | ||||
xo_emit("{:tcp-state/%s}", | xo_emit("{:tcp-state/%-11s}", | ||||
tcpstates[tp->t_state]); | tcpstates[tp->t_state]); | ||||
#if defined(TF_NEEDSYN) && defined(TF_NEEDFIN) | #if defined(TF_NEEDSYN) && defined(TF_NEEDFIN) | ||||
/* Show T/TCP `hidden state' */ | /* Show T/TCP `hidden state' */ | ||||
if (tp->t_flags & (TF_NEEDSYN|TF_NEEDFIN)) | if (tp->t_flags & (TF_NEEDSYN|TF_NEEDFIN)) | ||||
xo_emit("{:need-syn-or-fin/*}"); | xo_emit("{:need-syn-or-fin/*}"); | ||||
#endif /* defined(TF_NEEDSYN) && defined(TF_NEEDFIN) */ | #endif /* defined(TF_NEEDSYN) && defined(TF_NEEDFIN) */ | ||||
} | } | ||||
} | } | ||||
if (Rflag) { | if (Rflag) { | ||||
/* XXX: is this right Alfred */ | /* XXX: is this right Alfred */ | ||||
xo_emit(" {:flow-id/%08x} {:flow-type/%5d}", | xo_emit(" {:flow-id/%08x} {:flow-type/%5d}", | ||||
inp->inp_flowid, | inp->inp_flowid, | ||||
inp->inp_flowtype); | inp->inp_flowtype); | ||||
} | } | ||||
if (istcp && Pflag) | |||||
xo_emit(" {:log-id/%s}", tp->xt_logid[0] == '\0' ? | |||||
"-" : tp->xt_logid); | |||||
xo_emit("\n"); | xo_emit("\n"); | ||||
xo_close_instance("socket"); | xo_close_instance("socket"); | ||||
} | } | ||||
if (xig != oxig && xig->xig_gen != oxig->xig_gen) { | if (xig != oxig && xig->xig_gen != oxig->xig_gen) { | ||||
if (oxig->xig_count > xig->xig_count) { | if (oxig->xig_count > xig->xig_count) { | ||||
xo_emit("Some {d:lost/%s} sockets may have been " | xo_emit("Some {d:lost/%s} sockets may have been " | ||||
"deleted.\n", name); | "deleted.\n", name); | ||||
} else if (oxig->xig_count < xig->xig_count) { | } else if (oxig->xig_count < xig->xig_count) { | ||||
▲ Show 20 Lines • Show All 896 Lines • Show Last 20 Lines |