* Dump CARP statistics structure. */
| 950 | * Dump CARP statistics structure. |
| 951 | */ |
| 952 | void |
| 953 | carp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) |
| 954 | { |
| 955 | struct carpstats carpstat; |
| 956 | |
| 957 | if (fetch_stats("net.inet.carp.stats", off, &carpstat, |
| 958 | sizeof(carpstat), kread_counters) != 0) |
| 959 | return; |
| 960 | |
| 961 | xo_open_container(name); |
| 962 | xo_emit("{T:/%s}:\n", name); |
| 963 | |
| 964 | #define p(f, m) if (carpstat.f || sflag <= 1) \ |
| 965 | xo_emit(m, (uintmax_t)carpstat.f, plural(carpstat.f)) |
| 966 | #define p2(f, m) if (carpstat.f || sflag <= 1) \ |
| 967 | xo_emit(m, (uintmax_t)carpstat.f) |
| 968 | |
| 969 | p(carps_ipackets, "\t{:received-inet-packets/%ju} " |
| 970 | "{N:/packet%s received (IPv4)}\n"); |
| 971 | p(carps_ipackets6, "\t{:received-inet6-packets/%ju} " |
| 972 | "{N:/packet%s received (IPv6)}\n"); |
| 973 | p(carps_badttl, "\t\t{:dropped-wrong-ttl/%ju} " |
| 974 | "{N:/packet%s discarded for wrong TTL}\n"); |
| 975 | p(carps_hdrops, "\t\t{:dropped-short-header/%ju} " |
| 976 | "{N:/packet%s shorter than header}\n"); |
| 977 | p(carps_badsum, "\t\t{:dropped-bad-checksum/%ju} " |
| 978 | "{N:/discarded for bad checksum%s}\n"); |
| 979 | p(carps_badver, "\t\t{:dropped-bad-version/%ju} " |
| 980 | "{N:/discarded packet%s with a bad version}\n"); |
| 981 | p2(carps_badlen, "\t\t{:dropped-short-packet/%ju} " |
| 982 | "{N:/discarded because packet too short}\n"); |
| 983 | p2(carps_badauth, "\t\t{:dropped-bad-authentication/%ju} " |
| 984 | "{N:/discarded for bad authentication}\n"); |
| 985 | p2(carps_badvhid, "\t\t{:dropped-bad-vhid/%ju} " |
| 986 | "{N:/discarded for bad vhid}\n"); |
| 987 | p2(carps_badaddrs, "\t\t{:dropped-bad-address-list/%ju} " |
| 988 | "{N:/discarded because of a bad address list}\n"); |
| 989 | p(carps_opackets, "\t{:sent-inet-packets/%ju} " |
| 990 | "{N:/packet%s sent (IPv4)}\n"); |
| 991 | p(carps_opackets6, "\t{:sent-inet6-packets/%ju} " |
| 992 | "{N:/packet%s sent (IPv6)}\n"); |
| 993 | p2(carps_onomem, "\t\t{:send-failed-memory-error/%ju} " |
| 994 | "{N:/send failed due to mbuf memory error}\n"); |
| 995 | #if notyet |
| 996 | p(carps_ostates, "\t\t{:send-state-updates/%s} " |
| 997 | "{N:/state update%s sent}\n"); |
| 998 | #endif |
| 999 | #undef p |
| 1000 | #undef p2 |
| 1001 | xo_close_container(name); |
| 1002 | } |
| 1003 | |
| 1004 | /* |
| 1005 | * Dump IP statistics structure. |
nothing calls this directly
no test coverage detected