* Dump IP statistics structure. */
| 1005 | * Dump IP statistics structure. |
| 1006 | */ |
| 1007 | void |
| 1008 | ip_stats(u_long off, const char *name, int af1 __unused, int proto __unused) |
| 1009 | { |
| 1010 | struct ipstat ipstat; |
| 1011 | |
| 1012 | if (fetch_stats("net.inet.ip.stats", off, &ipstat, |
| 1013 | sizeof(ipstat), kread_counters) != 0) |
| 1014 | return; |
| 1015 | |
| 1016 | xo_open_container(name); |
| 1017 | xo_emit("{T:/%s}:\n", name); |
| 1018 | |
| 1019 | #define p(f, m) if (ipstat.f || sflag <= 1) \ |
| 1020 | xo_emit(m, (uintmax_t )ipstat.f, plural(ipstat.f)) |
| 1021 | #define p1a(f, m) if (ipstat.f || sflag <= 1) \ |
| 1022 | xo_emit(m, (uintmax_t )ipstat.f) |
| 1023 | |
| 1024 | p(ips_total, "\t{:received-packets/%ju} " |
| 1025 | "{N:/total packet%s received}\n"); |
| 1026 | p(ips_badsum, "\t{:dropped-bad-checksum/%ju} " |
| 1027 | "{N:/bad header checksum%s}\n"); |
| 1028 | p1a(ips_toosmall, "\t{:dropped-below-minimum-size/%ju} " |
| 1029 | "{N:/with size smaller than minimum}\n"); |
| 1030 | p1a(ips_tooshort, "\t{:dropped-short-packets/%ju} " |
| 1031 | "{N:/with data size < data length}\n"); |
| 1032 | p1a(ips_toolong, "\t{:dropped-too-long/%ju} " |
| 1033 | "{N:/with ip length > max ip packet size}\n"); |
| 1034 | p1a(ips_badhlen, "\t{:dropped-short-header-length/%ju} " |
| 1035 | "{N:/with header length < data size}\n"); |
| 1036 | p1a(ips_badlen, "\t{:dropped-short-data/%ju} " |
| 1037 | "{N:/with data length < header length}\n"); |
| 1038 | p1a(ips_badoptions, "\t{:dropped-bad-options/%ju} " |
| 1039 | "{N:/with bad options}\n"); |
| 1040 | p1a(ips_badvers, "\t{:dropped-bad-version/%ju} " |
| 1041 | "{N:/with incorrect version number}\n"); |
| 1042 | p(ips_fragments, "\t{:received-fragments/%ju} " |
| 1043 | "{N:/fragment%s received}\n"); |
| 1044 | p(ips_fragdropped, "\t{:dropped-fragments/%ju} " |
| 1045 | "{N:/fragment%s dropped (dup or out of space)}\n"); |
| 1046 | p(ips_fragtimeout, "\t{:dropped-fragments-after-timeout/%ju} " |
| 1047 | "{N:/fragment%s dropped after timeout}\n"); |
| 1048 | p(ips_reassembled, "\t{:reassembled-packets/%ju} " |
| 1049 | "{N:/packet%s reassembled ok}\n"); |
| 1050 | p(ips_delivered, "\t{:received-local-packets/%ju} " |
| 1051 | "{N:/packet%s for this host}\n"); |
| 1052 | p(ips_noproto, "\t{:dropped-unknown-protocol/%ju} " |
| 1053 | "{N:/packet%s for unknown\\/unsupported protocol}\n"); |
| 1054 | p(ips_forward, "\t{:forwarded-packets/%ju} " |
| 1055 | "{N:/packet%s forwarded}"); |
| 1056 | p(ips_fastforward, " ({:fast-forwarded-packets/%ju} " |
| 1057 | "{N:/packet%s fast forwarded})"); |
| 1058 | if (ipstat.ips_forward || sflag <= 1) |
| 1059 | xo_emit("\n"); |
| 1060 | p(ips_cantforward, "\t{:packets-cannot-forward/%ju} " |
| 1061 | "{N:/packet%s not forwardable}\n"); |
| 1062 | p(ips_notmember, "\t{:received-unknown-multicast-group/%ju} " |
| 1063 | "{N:/packet%s received for unknown multicast group}\n"); |
| 1064 | p(ips_redirectsent, "\t{:redirects-sent/%ju} " |
nothing calls this directly
no test coverage detected