Commit 9c073fe0 authored by Mike Frysinger's avatar Mike Frysinger

statistics: sort tables statically (and constify)

Rather than do the sorting at runtime, run the tables through `sort`.
This lets us constify them and speed up runtime slightly.
parent 70c3a90b
...@@ -116,9 +116,7 @@ ...@@ -116,9 +116,7 @@
/* prototypes for statistics.c */ /* prototypes for statistics.c */
void parsesnmp(int, int, int); void parsesnmp(int, int, int);
void inittab(void);
void parsesnmp6(int, int, int); void parsesnmp6(int, int, int);
void inittab6(void);
typedef enum { typedef enum {
SS_FREE = 0, /* not allocated */ SS_FREE = 0, /* not allocated */
...@@ -2099,14 +2097,12 @@ int main ...@@ -2099,14 +2097,12 @@ int main
if (!strcmp(afname, "inet")) { if (!strcmp(afname, "inet")) {
#if HAVE_AFINET #if HAVE_AFINET
inittab();
parsesnmp(flag_raw, flag_tcp, flag_udp); parsesnmp(flag_raw, flag_tcp, flag_udp);
#else #else
ENOSUPP("netstat", "AF INET"); ENOSUPP("netstat", "AF INET");
#endif #endif
} else if(!strcmp(afname, "inet6")) { } else if(!strcmp(afname, "inet6")) {
#if HAVE_AFINET6 #if HAVE_AFINET6
inittab6();
parsesnmp6(flag_raw, flag_tcp, flag_udp); parsesnmp6(flag_raw, flag_tcp, flag_udp);
#else #else
ENOSUPP("netstat", "AF INET6"); ENOSUPP("netstat", "AF INET6");
......
...@@ -53,247 +53,230 @@ static enum State state; ...@@ -53,247 +53,230 @@ static enum State state;
* Don't mark the first field as translatable! It's a snmp MIB standard. * Don't mark the first field as translatable! It's a snmp MIB standard.
* - acme * - acme
*/ */
static struct entry Iptab[] = static const struct entry Iptab[] =
{ { /* Keep the entries sorted! */
{"Forwarding", N_("Forwarding is %s"), i_forward | I_STATIC},
{"DefaultTTL", N_("Default TTL is %llu"), number | I_STATIC}, {"DefaultTTL", N_("Default TTL is %llu"), number | I_STATIC},
{"InReceives", N_("%llu total packets received"), number}, {"Forwarding", N_("Forwarding is %s"), i_forward | I_STATIC},
{"InHdrErrors", N_("%llu with invalid headers"), opt_number},
{"InAddrErrors", N_("%llu with invalid addresses"), opt_number},
{"ForwDatagrams", N_("%llu forwarded"), number}, {"ForwDatagrams", N_("%llu forwarded"), number},
{"InUnknownProtos", N_("%llu with unknown protocol"), opt_number}, {"FragCreates", N_("%llu fragments created"), opt_number},
{"InDiscards", N_("%llu incoming packets discarded"), number}, {"FragFails", N_("%llu fragments failed"), opt_number},
{"FragOKs", N_("%llu fragments received ok"), opt_number},
{"InAddrErrors", N_("%llu with invalid addresses"), opt_number},
{"InDelivers", N_("%llu incoming packets delivered"), number}, {"InDelivers", N_("%llu incoming packets delivered"), number},
{"OutRequests", N_("%llu requests sent out"), number}, /*? */ {"InDiscards", N_("%llu incoming packets discarded"), number},
{"InHdrErrors", N_("%llu with invalid headers"), opt_number},
{"InReceives", N_("%llu total packets received"), number},
{"InUnknownProtos", N_("%llu with unknown protocol"), opt_number},
{"OutDiscards", N_("%llu outgoing packets dropped"), opt_number}, {"OutDiscards", N_("%llu outgoing packets dropped"), opt_number},
{"OutNoRoutes", N_("%llu dropped because of missing route"), opt_number}, {"OutNoRoutes", N_("%llu dropped because of missing route"), opt_number},
{"ReasmTimeout", N_("%llu fragments dropped after timeout"), opt_number}, {"OutRequests", N_("%llu requests sent out"), number}, /*? */
{"ReasmReqds", N_("%llu reassemblies required"), opt_number}, /* ? */
{"ReasmOKs", N_("%llu packets reassembled ok"), opt_number},
{"ReasmFails", N_("%llu packet reassembles failed"), opt_number}, {"ReasmFails", N_("%llu packet reassembles failed"), opt_number},
{"FragOKs", N_("%llu fragments received ok"), opt_number}, {"ReasmOKs", N_("%llu packets reassembled ok"), opt_number},
{"FragFails", N_("%llu fragments failed"), opt_number}, {"ReasmReqds", N_("%llu reassemblies required"), opt_number}, /* ? */
{"FragCreates", N_("%llu fragments created"), opt_number} {"ReasmTimeout", N_("%llu fragments dropped after timeout"), opt_number},
}; };
static struct entry Ip6tab[] = static const struct entry Ip6tab[] =
{ { /* Keep the entries sorted! */
{"Ip6InReceives", N_("%llu total packets received"), number}, {"Ip6FragCreates", N_("%llu fragments created"), opt_number},
{"Ip6FragFails", N_("%llu fragments failed"), opt_number},
{"Ip6FragOKs", N_("%llu fragments received ok"), opt_number},
{"Ip6InAddrErrors", N_("%llu with invalid addresses"), opt_number},
{"Ip6InDelivers", N_("%llu incoming packets delivered"), number},
{"Ip6InDiscards", N_("%llu incoming packets discarded"), number},
{"Ip6InHdrErrors", N_("%llu with invalid headers"), opt_number}, {"Ip6InHdrErrors", N_("%llu with invalid headers"), opt_number},
{"Ip6InTooBigErrors", N_("%llu with packets too big"), opt_number}, {"Ip6InMcastPkts", N_("%llu incoming multicast packets"), opt_number},
{"Ip6InNoRoutes", N_("%llu incoming packets with no route"), opt_number}, {"Ip6InNoRoutes", N_("%llu incoming packets with no route"), opt_number},
{"Ip6InAddrErrors", N_("%llu with invalid addresses"), opt_number}, {"Ip6InReceives", N_("%llu total packets received"), number},
{"Ip6InUnknownProtos", N_("%llu with unknown protocol"), opt_number}, {"Ip6InTooBigErrors", N_("%llu with packets too big"), opt_number},
{"Ip6InTruncatedPkts", N_("%llu with truncated packets"), opt_number}, {"Ip6InTruncatedPkts", N_("%llu with truncated packets"), opt_number},
{"Ip6InDiscards", N_("%llu incoming packets discarded"), number}, {"Ip6InUnknownProtos", N_("%llu with unknown protocol"), opt_number},
{"Ip6InDelivers", N_("%llu incoming packets delivered"), number},
{"Ip6OutForwDatagrams", N_("%llu forwarded"), number},
{"Ip6OutRequests", N_("%llu requests sent out"), number}, /*? */
{"Ip6OutDiscards", N_("%llu outgoing packets dropped"), opt_number}, {"Ip6OutDiscards", N_("%llu outgoing packets dropped"), opt_number},
{"Ip6OutForwDatagrams", N_("%llu forwarded"), number},
{"Ip6OutMcastPkts", N_("%llu outgoing multicast packets"), opt_number},
{"Ip6OutNoRoutes", N_("%llu dropped because of missing route"), opt_number}, {"Ip6OutNoRoutes", N_("%llu dropped because of missing route"), opt_number},
{"Ip6ReasmTimeout", N_("%llu fragments dropped after timeout"), opt_number}, {"Ip6OutRequests", N_("%llu requests sent out"), number}, /*? */
{"Ip6ReasmReqds", N_("%llu reassemblies required"), opt_number}, /* ? */
{"Ip6ReasmOKs", N_("%llu packets reassembled ok"), opt_number},
{"Ip6ReasmFails", N_("%llu packet reassembles failed"), opt_number}, {"Ip6ReasmFails", N_("%llu packet reassembles failed"), opt_number},
{"Ip6FragOKs", N_("%llu fragments received ok"), opt_number}, {"Ip6ReasmOKs", N_("%llu packets reassembled ok"), opt_number},
{"Ip6FragFails", N_("%llu fragments failed"), opt_number}, {"Ip6ReasmReqds", N_("%llu reassemblies required"), opt_number}, /* ? */
{"Ip6FragCreates", N_("%llu fragments created"), opt_number}, {"Ip6ReasmTimeout", N_("%llu fragments dropped after timeout"), opt_number},
{"Ip6InMcastPkts", N_("%llu incoming multicast packets"), opt_number},
{"Ip6OutMcastPkts", N_("%llu outgoing multicast packets"), opt_number}
}; };
static struct entry Icmptab[] = static const struct entry Icmptab[] =
{ { /* Keep the entries sorted! */
{"InMsgs", N_("%llu ICMP messages received"), number}, {"InAddrMaskReps", N_("address mask replies: %llu"), i_inp_icmp | I_TITLE}, /*? */
{"InErrors", N_("%llu input ICMP message failed."), number}, {"InAddrMasks", N_("address mask request: %llu"), i_inp_icmp | I_TITLE}, /*? */
{"InDestUnreachs", N_("destination unreachable: %llu"), i_inp_icmp | I_TITLE}, {"InDestUnreachs", N_("destination unreachable: %llu"), i_inp_icmp | I_TITLE},
{"InTimeExcds", N_("timeout in transit: %llu"), i_inp_icmp | I_TITLE}, {"InEchoReps", N_("echo replies: %llu"), i_inp_icmp | I_TITLE},
{"InEchos", N_("echo requests: %llu"), i_inp_icmp | I_TITLE},
{"InErrors", N_("%llu input ICMP message failed."), number},
{"InMsgs", N_("%llu ICMP messages received"), number},
{"InParmProbs", N_("wrong parameters: %llu"), i_inp_icmp | I_TITLE}, /*? */ {"InParmProbs", N_("wrong parameters: %llu"), i_inp_icmp | I_TITLE}, /*? */
{"InSrcQuenchs", N_("source quenches: %llu"), i_inp_icmp | I_TITLE},
{"InRedirects", N_("redirects: %llu"), i_inp_icmp | I_TITLE}, {"InRedirects", N_("redirects: %llu"), i_inp_icmp | I_TITLE},
{"InEchos", N_("echo requests: %llu"), i_inp_icmp | I_TITLE}, {"InSrcQuenchs", N_("source quenches: %llu"), i_inp_icmp | I_TITLE},
{"InEchoReps", N_("echo replies: %llu"), i_inp_icmp | I_TITLE}, {"InTimeExcds", N_("timeout in transit: %llu"), i_inp_icmp | I_TITLE},
{"InTimestamps", N_("timestamp request: %llu"), i_inp_icmp | I_TITLE},
{"InTimestampReps", N_("timestamp reply: %llu"), i_inp_icmp | I_TITLE}, {"InTimestampReps", N_("timestamp reply: %llu"), i_inp_icmp | I_TITLE},
{"InAddrMasks", N_("address mask request: %llu"), i_inp_icmp | I_TITLE}, /*? */ {"InTimestamps", N_("timestamp request: %llu"), i_inp_icmp | I_TITLE},
{"InAddrMaskReps", N_("address mask replies: %llu"), i_inp_icmp | I_TITLE}, /*? */ {"OutAddrMaskReps", N_("address mask replies: %llu"), i_outp_icmp | I_TITLE},
{"OutMsgs", N_("%llu ICMP messages sent"), number}, {"OutAddrMasks", N_("address mask requests: %llu"), i_outp_icmp | I_TITLE},
{"OutErrors", N_("%llu ICMP messages failed"), number},
{"OutDestUnreachs", N_("destination unreachable: %llu"), i_outp_icmp | I_TITLE}, {"OutDestUnreachs", N_("destination unreachable: %llu"), i_outp_icmp | I_TITLE},
{"OutTimeExcds", N_("time exceeded: %llu"), i_outp_icmp | I_TITLE}, {"OutEchoReps", N_("echo replies: %llu"), i_outp_icmp | I_TITLE},
{"OutEchos", N_("echo request: %llu"), i_outp_icmp | I_TITLE},
{"OutErrors", N_("%llu ICMP messages failed"), number},
{"OutMsgs", N_("%llu ICMP messages sent"), number},
{"OutParmProbs", N_("wrong parameters: %llu"), i_outp_icmp | I_TITLE}, /*? */ {"OutParmProbs", N_("wrong parameters: %llu"), i_outp_icmp | I_TITLE}, /*? */
{"OutSrcQuenchs", N_("source quench: %llu"), i_outp_icmp | I_TITLE},
{"OutRedirects", N_("redirect: %llu"), i_outp_icmp | I_TITLE}, {"OutRedirects", N_("redirect: %llu"), i_outp_icmp | I_TITLE},
{"OutEchos", N_("echo request: %llu"), i_outp_icmp | I_TITLE}, {"OutSrcQuenchs", N_("source quench: %llu"), i_outp_icmp | I_TITLE},
{"OutEchoReps", N_("echo replies: %llu"), i_outp_icmp | I_TITLE}, {"OutTimeExcds", N_("time exceeded: %llu"), i_outp_icmp | I_TITLE},
{"OutTimestamps", N_("timestamp requests: %llu"), i_outp_icmp | I_TITLE},
{"OutTimestampReps", N_("timestamp replies: %llu"), i_outp_icmp | I_TITLE}, {"OutTimestampReps", N_("timestamp replies: %llu"), i_outp_icmp | I_TITLE},
{"OutAddrMasks", N_("address mask requests: %llu"), i_outp_icmp | I_TITLE}, {"OutTimestamps", N_("timestamp requests: %llu"), i_outp_icmp | I_TITLE},
{"OutAddrMaskReps", N_("address mask replies: %llu"), i_outp_icmp | I_TITLE},
}; };
static struct entry Icmp6tab[] = static const struct entry Icmp6tab[] =
{ { /* Keep the entries sorted! */
{"Icmp6InMsgs", N_("%llu ICMP messages received"), number},
{"Icmp6InErrors", N_("%llu input ICMP message failed."), number},
{"Icmp6InDestUnreachs", N_("destination unreachable: %llu"), i_inp_icmp | I_TITLE}, {"Icmp6InDestUnreachs", N_("destination unreachable: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InPktTooBigs", N_("packets too big: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InTimeExcds", N_("received ICMPv6 time exceeded: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InParmProblems", N_("parameter problem: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InEchos", N_("echo requests: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InEchoReplies", N_("echo replies: %llu"), i_inp_icmp | I_TITLE}, {"Icmp6InEchoReplies", N_("echo replies: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InEchos", N_("echo requests: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InErrors", N_("%llu input ICMP message failed."), number},
{"Icmp6InGroupMembQueries", N_("group member queries: %llu"), i_inp_icmp | I_TITLE}, {"Icmp6InGroupMembQueries", N_("group member queries: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InGroupMembResponses", N_("group member responses: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InGroupMembReductions", N_("group member reductions: %llu"), i_inp_icmp | I_TITLE}, {"Icmp6InGroupMembReductions", N_("group member reductions: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InRouterSolicits", N_("router solicits: %llu"), i_inp_icmp | I_TITLE}, {"Icmp6InGroupMembResponses", N_("group member responses: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InRouterAdvertisements", N_("router advertisement: %llu"), i_inp_icmp | I_TITLE}, {"Icmp6InMsgs", N_("%llu ICMP messages received"), number},
{"Icmp6InNeighborSolicits", N_("neighbour solicits: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InNeighborAdvertisements", N_("neighbour advertisement: %llu"), i_inp_icmp | I_TITLE}, {"Icmp6InNeighborAdvertisements", N_("neighbour advertisement: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InNeighborSolicits", N_("neighbour solicits: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InParmProblems", N_("parameter problem: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InPktTooBigs", N_("packets too big: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InRedirects", N_("redirects: %llu"), i_inp_icmp | I_TITLE}, {"Icmp6InRedirects", N_("redirects: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6OutMsgs", N_("%llu ICMP messages sent"), number}, {"Icmp6InRouterAdvertisements", N_("router advertisement: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InRouterSolicits", N_("router solicits: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6InTimeExcds", N_("received ICMPv6 time exceeded: %llu"), i_inp_icmp | I_TITLE},
{"Icmp6OutDestUnreachs", N_("destination unreachable: %llu"), i_outp_icmp | I_TITLE}, {"Icmp6OutDestUnreachs", N_("destination unreachable: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutPktTooBigs", N_("packets too big: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutTimeExcds", N_("sent ICMPv6 time exceeded: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutParmProblems", N_("parameter problem: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutEchos", N_("echo requests: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutEchoReplies", N_("echo replies: %llu"), i_outp_icmp | I_TITLE}, {"Icmp6OutEchoReplies", N_("echo replies: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutEchos", N_("echo requests: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutGroupMembQueries", N_("group member queries: %llu"), i_outp_icmp | I_TITLE}, {"Icmp6OutGroupMembQueries", N_("group member queries: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutGroupMembResponses", N_("group member responses: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutGroupMembReductions", N_("group member reductions: %llu"), i_outp_icmp | I_TITLE}, {"Icmp6OutGroupMembReductions", N_("group member reductions: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutRouterSolicits", N_("router solicits: %llu"), i_outp_icmp | I_TITLE}, {"Icmp6OutGroupMembResponses", N_("group member responses: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutRouterAdvertisements ", N_("router advertisement: %llu"), i_outp_icmp | I_TITLE}, {"Icmp6OutMsgs", N_("%llu ICMP messages sent"), number},
{"Icmp6OutNeighborSolicits", N_("neighbor solicits: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutNeighborAdvertisements", N_("neighbor advertisements: %llu"), i_outp_icmp | I_TITLE}, {"Icmp6OutNeighborAdvertisements", N_("neighbor advertisements: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutNeighborSolicits", N_("neighbor solicits: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutParmProblems", N_("parameter problem: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutPktTooBigs", N_("packets too big: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutRedirects", N_("redirects: %llu"), i_outp_icmp | I_TITLE}, {"Icmp6OutRedirects", N_("redirects: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutRouterAdvertisements ", N_("router advertisement: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutRouterSolicits", N_("router solicits: %llu"), i_outp_icmp | I_TITLE},
{"Icmp6OutTimeExcds", N_("sent ICMPv6 time exceeded: %llu"), i_outp_icmp | I_TITLE},
}; };
static struct entry Tcptab[] = static const struct entry Tcptab[] =
{ { /* Keep the entries sorted! */
{"RtoAlgorithm", N_("RTO algorithm is %s"), i_rto_alg | I_STATIC},
{"RtoMin", "", number},
{"RtoMax", "", number},
{"MaxConn", "", number},
{"ActiveOpens", N_("%llu active connections openings"), number}, {"ActiveOpens", N_("%llu active connections openings"), number},
{"PassiveOpens", N_("%llu passive connection openings"), number},
{"AttemptFails", N_("%llu failed connection attempts"), number}, {"AttemptFails", N_("%llu failed connection attempts"), number},
{"EstabResets", N_("%llu connection resets received"), number},
{"CurrEstab", N_("%llu connections established"), number}, {"CurrEstab", N_("%llu connections established"), number},
{"EstabResets", N_("%llu connection resets received"), number},
{"InErrs", N_("%llu bad segments received."), number},
{"InSegs", N_("%llu segments received"), number}, {"InSegs", N_("%llu segments received"), number},
{"MaxConn", "", number},
{"OutRsts", N_("%llu resets sent"), number},
{"OutSegs", N_("%llu segments send out"), number}, {"OutSegs", N_("%llu segments send out"), number},
{"PassiveOpens", N_("%llu passive connection openings"), number},
{"RetransSegs", N_("%llu segments retransmited"), number}, {"RetransSegs", N_("%llu segments retransmited"), number},
{"InErrs", N_("%llu bad segments received."), number}, {"RtoAlgorithm", N_("RTO algorithm is %s"), i_rto_alg | I_STATIC},
{"OutRsts", N_("%llu resets sent"), number}, {"RtoMax", "", number},
{"RtoMin", "", number},
}; };
static struct entry Udptab[] = static const struct entry Udptab[] =
{ { /* Keep the entries sorted! */
{"InDatagrams", N_("%llu packets received"), number}, {"InDatagrams", N_("%llu packets received"), number},
{"NoPorts", N_("%llu packets to unknown port received."), number},
{"InErrors", N_("%llu packet receive errors"), number}, {"InErrors", N_("%llu packet receive errors"), number},
{"NoPorts", N_("%llu packets to unknown port received."), number},
{"OutDatagrams", N_("%llu packets sent"), number}, {"OutDatagrams", N_("%llu packets sent"), number},
{"RcvbufErrors", N_("%llu receive buffer errors"), number}, {"RcvbufErrors", N_("%llu receive buffer errors"), number},
{"SndbufErrors", N_("%llu send buffer errors"), number}, {"SndbufErrors", N_("%llu send buffer errors"), number},
}; };
static struct entry Udp6tab[] = static const struct entry Udp6tab[] =
{ { /* Keep the entries sorted! */
{"Udp6InDatagrams", N_("%llu packets received"), number}, {"Udp6InDatagrams", N_("%llu packets received"), number},
{"Udp6NoPorts", N_("%llu packets to unknown port received."), number},
{"Udp6InErrors", N_("%llu packet receive errors"), number}, {"Udp6InErrors", N_("%llu packet receive errors"), number},
{"Udp6NoPorts", N_("%llu packets to unknown port received."), number},
{"Udp6OutDatagrams", N_("%llu packets sent"), number}, {"Udp6OutDatagrams", N_("%llu packets sent"), number},
}; };
static struct entry Tcpexttab[] = static const struct entry Tcpexttab[] =
{ { /* Keep the entries sorted! */
{"SyncookiesSent", N_("%llu SYN cookies sent"), opt_number}, {"DelayedACKLocked", N_("%llu delayed acks further delayed because of locked socket"), opt_number},
{"SyncookiesRecv", N_("%llu SYN cookies received"), opt_number}, {"DelayedACKLost", N_("Quick ack mode was activated %llu times"), opt_number},
{"DelayedACKs", N_("%llu delayed acks sent"), opt_number},
{"EmbryonicRsts", N_("%llu resets received for embryonic SYN_RECV sockets"), opt_number},
{"ListenDrops", N_("%llu SYNs to LISTEN sockets dropped"), opt_number},
{"ListenOverflows", N_("%llu times the listen queue of a socket overflowed"), opt_number},
{"LockDroppedIcmps", N_("%llu ICMP packets dropped because socket was locked"), opt_number},
{"OfoPruned", N_("%llu packets dropped from out-of-order queue because of socket buffer overrun"), opt_number},
{"OutOfWindowIcmps", N_("%llu ICMP packets dropped because they were out-of-window"), opt_number},
{"PAWSActive", N_("%llu active connections rejected because of time stamp"), opt_number},
{"PAWSEstab", N_("%llu packets rejects in established connections because of timestamp"), opt_number},
{"PAWSPassive", N_("%llu passive connections rejected because of time stamp"), opt_number},
{"PruneCalled", N_("%llu packets pruned from receive queue because of socket buffer overrun"), opt_number},
{"RcvPruned", N_("%llu packets pruned from receive queue"), opt_number},
{"SockMallocOOM", N_("Ran %llu times out of system memory during packet sending"), opt_number},
{"SyncookiesFailed", N_("%llu invalid SYN cookies received"), opt_number}, {"SyncookiesFailed", N_("%llu invalid SYN cookies received"), opt_number},
{"SyncookiesRecv", N_("%llu SYN cookies received"), opt_number},
{ "EmbryonicRsts", N_("%llu resets received for embryonic SYN_RECV sockets"), {"SyncookiesSent", N_("%llu SYN cookies sent"), opt_number},
opt_number }, {"TCPAbortFailed", N_("%llu times unable to send RST due to no memory"), opt_number},
{ "PruneCalled", N_("%llu packets pruned from receive queue because of socket" {"TCPAbortOnClose", N_("%llu connections reset due to early user close"), opt_number},
" buffer overrun"), opt_number }, {"TCPAbortOnData", N_("%llu connections reset due to unexpected data"), opt_number},
/* obsolete: 2.2.0 doesn't do that anymore */ {"TCPAbortOnLinger", N_("%llu connections aborted after user close in linger timeout"), opt_number},
{ "RcvPruned", N_("%llu packets pruned from receive queue"), opt_number }, {"TCPAbortOnMemory", N_("%llu connections aborted due to memory pressure"), opt_number},
{ "OfoPruned", N_("%llu packets dropped from out-of-order queue because of" {"TCPAbortOnSyn", N_("%llu connections reset due to unexpected SYN"), opt_number},
" socket buffer overrun"), opt_number }, {"TCPAbortOnTimeout", N_("%llu connections aborted due to timeout"), opt_number},
{ "OutOfWindowIcmps", N_("%llu ICMP packets dropped because they were " {"TCPDirectCopyFromBacklog", N_("%llu bytes directly in process context from backlog"), opt_number},
"out-of-window"), opt_number }, {"TCPDirectCopyFromPrequeue", N_("%llu bytes directly received in process context from prequeue"), opt_number},
{ "LockDroppedIcmps", N_("%llu ICMP packets dropped because" {"TCPDSACKOfoRecv", N_("%llu DSACKs for out of order packets received"), opt_number},
" socket was locked"), opt_number }, {"TCPDSACKOfoSent", N_("%llu DSACKs sent for out of order packets"), opt_number},
{ "TW", N_("%llu TCP sockets finished time wait in fast timer"), opt_number }, {"TCPDSACKOldSent", N_("%llu DSACKs sent for old packets"), opt_number},
{ "TWRecycled", N_("%llu time wait sockets recycled by time stamp"), opt_number }, {"TCPDSACKRecv", N_("%llu DSACKs received"), opt_number},
{ "TWKilled", N_("%llu TCP sockets finished time wait in slow timer"), opt_number }, {"TCPDSackUndo", N_("%llu congestion window recovered without slow start using DSACK"), opt_number},
{ "PAWSPassive", N_("%llu passive connections rejected because of" {"TCPDSACKUndo", N_("%llu congestion windows recovered without slow start by DSACK"), opt_number},
" time stamp"), opt_number }, {"TCPFACKReorder", N_("Detected reordering %llu times using FACK"), opt_number},
{ "PAWSActive", N_("%llu active connections rejected because of " {"TCPFastRetrans", N_("%llu fast retransmits"), opt_number},
"time stamp"), opt_number }, {"TCPForwardRetrans", N_("%llu forward retransmits"), opt_number},
{ "PAWSEstab", N_("%llu packets rejects in established connections because of" {"TCPFullUndo", N_("%llu congestion windows fully recovered without slow start"), opt_number},
" timestamp"), opt_number }, {"TCPHPAcks", N_("%llu predicted acknowledgments"), opt_number},
{ "DelayedACKs", N_("%llu delayed acks sent"), opt_number }, {"TCPHPHits", N_("%llu packet headers predicted"), number},
{ "DelayedACKLocked", N_("%llu delayed acks further delayed because of" {"TCPHPHitsToUser", N_("%llu packets header predicted and directly queued to user"), opt_number},
" locked socket"), opt_number }, {"TCPLossFailures", N_("%llu timeouts in loss state"), opt_number},
{ "DelayedACKLost", N_("Quick ack mode was activated %llu times"), opt_number }, {"TCPLoss", N_("%llu TCP data loss events"), opt_number},
{ "ListenOverflows", N_("%llu times the listen queue of a socket overflowed"), {"TCPLossUndo", N_("%llu congestion windows recovered without slow start after partial ack"), opt_number},
opt_number }, {"TCPLostRetransmits", N_("%llu retransmits lost"), opt_number},
{ "ListenDrops", N_("%llu SYNs to LISTEN sockets dropped"), opt_number }, {"TCPMemoryPressures", N_("TCP ran low on memory %llu times"), opt_number},
{ "TCPPrequeued", N_("%llu packets directly queued to recvmsg prequeue."), {"TCPPartialUndo", N_("%llu congestion windows partially recovered using Hoe heuristic"), opt_number},
opt_number }, {"TCPPrequeued", N_("%llu packets directly queued to recvmsg prequeue."), opt_number},
{ "TCPDirectCopyFromBacklog", N_("%llu bytes directly in process context from backlog"), opt_number }, {"TCPPrequeueDropped", N_("%llu packets dropped from prequeue"), opt_number},
{ "TCPDirectCopyFromPrequeue", N_("%llu bytes directly received in process context from prequeue"), {"TCPPureAcks", N_("%llu acknowledgments not containing data payload received"), opt_number},
opt_number }, {"TCPRcvCollapsed", N_("%llu packets collapsed in receive queue due to low socket buffer"), opt_number},
{ "TCPPrequeueDropped", N_("%llu packets dropped from prequeue"), opt_number }, {"TCPRenoFailures", N_("%llu timeouts after reno fast retransmit"), opt_number},
{ "TCPHPHits", N_("%llu packet headers predicted"), number }, {"TCPRenoRecoveryFailed", N_("%llu reno fast retransmits failed"), opt_number},
{ "TCPHPHitsToUser", N_("%llu packets header predicted and " {"TCPRenoRecoveryFail", N_("%llu classic Reno fast retransmits failed"), opt_number},
"directly queued to user"), opt_number }, {"TCPRenoRecovery", N_("%llu times recovered from packet loss due to fast retransmit"), opt_number},
{ "SockMallocOOM", N_("Ran %llu times out of system memory during " {"TCPRenoReorder", N_("Detected reordering %llu times using reno fast retransmit"), opt_number},
"packet sending"), opt_number }, {"TCPSackFailures", N_("%llu timeouts after SACK recovery"), opt_number},
{ "TCPPureAcks", N_("%llu acknowledgments not containing data payload received"), opt_number }, {"TCPSackRecoveryFail", N_("%llu SACK retransmits failed"), opt_number},
{ "TCPHPAcks", N_("%llu predicted acknowledgments"), opt_number }, {"TCPSackRecovery", N_("%llu times recovered from packet loss by selective acknowledgements"), opt_number},
{ "TCPRenoRecovery", N_("%llu times recovered from packet loss due to fast retransmit"), opt_number }, {"TCPSACKReneging", N_("%llu bad SACK blocks received"), opt_number},
{ "TCPSackRecovery", N_("%llu times recovered from packet loss by selective acknowledgements"), opt_number }, {"TCPSACKReorder", N_("Detected reordering %llu times using SACK"), opt_number},
{ "TCPSACKReneging", N_("%llu bad SACK blocks received"), opt_number }, {"TCPSchedulerFailed", N_("%llu times receiver scheduled too late for direct processing"), opt_number},
{ "TCPFACKReorder", N_("Detected reordering %llu times using FACK"), opt_number }, {"TCPSlowStartRetrans", N_("%llu retransmits in slow start"), opt_number},
{ "TCPSACKReorder", N_("Detected reordering %llu times using SACK"), opt_number }, {"TCPTimeouts", N_("%llu other TCP timeouts"), opt_number},
{ "TCPTSReorder", N_("Detected reordering %llu times using time stamp"), opt_number }, {"TCPTSReorder", N_("Detected reordering %llu times using time stamp"), opt_number},
{ "TCPRenoReorder", N_("Detected reordering %llu times using reno fast retransmit"), opt_number }, {"TWKilled", N_("%llu TCP sockets finished time wait in slow timer"), opt_number},
{ "TCPFullUndo", N_("%llu congestion windows fully recovered without slow start"), opt_number }, {"TW", N_("%llu TCP sockets finished time wait in fast timer"), opt_number},
{ "TCPPartialUndo", N_("%llu congestion windows partially recovered using Hoe heuristic"), opt_number }, {"TWRecycled", N_("%llu time wait sockets recycled by time stamp"), opt_number},
{ "TCPDSackUndo", N_("%llu congestion window recovered without slow start using DSACK"), opt_number },
{ "TCPLossUndo", N_("%llu congestion windows recovered without slow start after partial ack"), opt_number },
{ "TCPLostRetransmits", N_("%llu retransmits lost"), opt_number },
{ "TCPRenoFailures", N_("%llu timeouts after reno fast retransmit"), opt_number },
{ "TCPSackFailures", N_("%llu timeouts after SACK recovery"), opt_number },
{ "TCPLossFailures", N_("%llu timeouts in loss state"), opt_number },
{ "TCPFastRetrans", N_("%llu fast retransmits"), opt_number },
{ "TCPForwardRetrans", N_("%llu forward retransmits"), opt_number },
{ "TCPSlowStartRetrans", N_("%llu retransmits in slow start"), opt_number },
{ "TCPTimeouts", N_("%llu other TCP timeouts"), opt_number },
{ "TCPRenoRecoveryFailed", N_("%llu reno fast retransmits failed"), opt_number },
{ "TCPSackRecoveryFail", N_("%llu SACK retransmits failed"), opt_number },
{ "TCPSchedulerFailed", N_("%llu times receiver scheduled too late for direct processing"), opt_number },
{ "TCPRcvCollapsed", N_("%llu packets collapsed in receive queue due to low socket buffer"), opt_number },
{ "TCPDSACKOldSent", N_("%llu DSACKs sent for old packets"), opt_number },
{ "TCPDSACKOfoSent", N_("%llu DSACKs sent for out of order packets"), opt_number },
{ "TCPDSACKRecv", N_("%llu DSACKs received"), opt_number },
{ "TCPDSACKOfoRecv", N_("%llu DSACKs for out of order packets received"), opt_number },
{ "TCPAbortOnSyn", N_("%llu connections reset due to unexpected SYN"), opt_number },
{ "TCPAbortOnData", N_("%llu connections reset due to unexpected data"), opt_number },
{ "TCPAbortOnClose", N_("%llu connections reset due to early user close"), opt_number },
{ "TCPAbortOnMemory", N_("%llu connections aborted due to memory pressure"), opt_number },
{ "TCPAbortOnTimeout", N_("%llu connections aborted due to timeout"), opt_number },
{ "TCPAbortOnLinger", N_("%llu connections aborted after user close in linger timeout"), opt_number },
{ "TCPAbortFailed", N_("%llu times unable to send RST due to no memory"), opt_number },
{ "TCPMemoryPressures", N_("TCP ran low on memory %llu times"), opt_number },
{ "TCPLoss", N_("%llu TCP data loss events"), opt_number },
{ "TCPDSACKUndo", N_("%llu congestion windows recovered without slow start by DSACK"),
opt_number },
{ "TCPRenoRecoveryFail", N_("%llu classic Reno fast retransmits failed"), opt_number },
}; };
struct tabtab { struct tabtab {
const char *title; const char *title;
struct entry *tab; const struct entry *tab;
size_t size; size_t size;
int *flag; int *flag;
}; };
...@@ -555,24 +538,3 @@ void parsesnmp6(int flag_raw, int flag_tcp, int flag_udp) ...@@ -555,24 +538,3 @@ void parsesnmp6(int flag_raw, int flag_tcp, int flag_udp)
fclose(f); fclose(f);
} }
void inittab(void)
{
const struct tabtab *t;
/* we sort at runtime because I'm lazy ;) */
for (t = snmptabs; t->title; t++) {
qsort(t->tab, t->size / sizeof(struct entry),
sizeof(struct entry), cmpentries);
}
}
void inittab6(void)
{
const struct tabtab *t;
for (t = snmp6tabs; t->title; t++)
qsort(t->tab, t->size / sizeof(struct entry),
sizeof(struct entry), cmpentries);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment