summaryrefslogtreecommitdiffstats
path: root/freebsd/usr.bin/netstat/ipsec.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/usr.bin/netstat/ipsec.c')
-rw-r--r--freebsd/usr.bin/netstat/ipsec.c399
1 files changed, 197 insertions, 202 deletions
diff --git a/freebsd/usr.bin/netstat/ipsec.c b/freebsd/usr.bin/netstat/ipsec.c
index 53dfdbe1..5b7c185b 100644
--- a/freebsd/usr.bin/netstat/ipsec.c
+++ b/freebsd/usr.bin/netstat/ipsec.c
@@ -1,5 +1,9 @@
#include <machine/rtems-bsd-user-space.h>
+#ifdef __rtems__
+#include "rtems-bsd-netstat-namespace.h"
+#endif /* __rtems__ */
+
/* $KAME: ipsec.c,v 1.33 2003/07/25 09:54:32 itojun Exp $ */
/*-
@@ -90,6 +94,9 @@ static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95";
#endif /* not lint */
#endif
+#ifdef __rtems__
+#include <machine/rtems-bsd-program.h>
+#endif /* __rtems__ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -109,9 +116,14 @@ __FBSDID("$FreeBSD$");
#include <stdint.h>
#include <stdio.h>
+#include <stdbool.h>
#include <string.h>
#include <unistd.h>
+#include <libxo/xo.h>
#include "netstat.h"
+#ifdef __rtems__
+#include "rtems-bsd-netstat-ipsec-data.h"
+#endif /* __rtems__ */
#ifdef IPSEC
struct val2str {
@@ -157,6 +169,9 @@ static struct val2str ipsec_espnames[] = {
#ifdef SADB_X_EALG_AESCTR
{ SADB_X_EALG_AESCTR, "aes-ctr", },
#endif
+#ifdef SADB_X_EALG_AESGCM16
+ { SADB_X_EALG_AESGCM16, "aes-gcm-16", },
+#endif
{ -1, NULL },
};
@@ -168,98 +183,44 @@ static struct val2str ipsec_compnames[] = {
{ -1, NULL },
};
-static void ipsec_hist(const u_quad_t *hist, size_t histmax,
- const struct val2str *name, const char *title);
static void print_ipsecstats(const struct ipsecstat *ipsecstat);
-
-/*
- * Dump IPSEC statistics structure.
- */
-static void
-ipsec_hist(const u_quad_t *hist, size_t histmax, const struct val2str *name,
- const char *title)
-{
- int first;
- size_t proto;
- const struct val2str *p;
-
- first = 1;
- for (proto = 0; proto < histmax; proto++) {
- if (hist[proto] <= 0)
- continue;
- if (first) {
- printf("\t%s histogram:\n", title);
- first = 0;
- }
- for (p = name; p && p->str; p++) {
- if (p->val == (int)proto)
- break;
- }
- if (p && p->str) {
- printf("\t\t%s: %ju\n", p->str, (uintmax_t)hist[proto]);
- } else {
- printf("\t\t#%ld: %ju\n", (long)proto,
- (uintmax_t)hist[proto]);
- }
- }
-}
-
static void
print_ipsecstats(const struct ipsecstat *ipsecstat)
{
+ xo_open_container("ipsec-statistics");
+
#define p(f, m) if (ipsecstat->f || sflag <= 1) \
- printf(m, (uintmax_t)ipsecstat->f, plural(ipsecstat->f))
-#define pes(f, m) if (ipsecstat->f || sflag <= 1) \
- printf(m, (uintmax_t)ipsecstat->f, plurales(ipsecstat->f))
-#define hist(f, n, t) \
- ipsec_hist((f), sizeof(f)/sizeof(f[0]), (n), (t));
-
- p(in_success, "\t%ju inbound packet%s processed successfully\n");
- p(in_polvio, "\t%ju inbound packet%s violated process security "
- "policy\n");
- p(in_nosa, "\t%ju inbound packet%s with no SA available\n");
- p(in_inval, "\t%ju invalid inbound packet%s\n");
- p(in_nomem, "\t%ju inbound packet%s failed due to insufficient memory\n");
- p(in_badspi, "\t%ju inbound packet%s failed getting SPI\n");
- p(in_ahreplay, "\t%ju inbound packet%s failed on AH replay check\n");
- p(in_espreplay, "\t%ju inbound packet%s failed on ESP replay check\n");
- p(in_ahauthsucc, "\t%ju inbound packet%s considered authentic\n");
- p(in_ahauthfail, "\t%ju inbound packet%s failed on authentication\n");
- hist(ipsecstat->in_ahhist, ipsec_ahnames, "AH input");
- hist(ipsecstat->in_esphist, ipsec_espnames, "ESP input");
- hist(ipsecstat->in_comphist, ipsec_compnames, "IPComp input");
-
- p(out_success, "\t%ju outbound packet%s processed successfully\n");
- p(out_polvio, "\t%ju outbound packet%s violated process security "
- "policy\n");
- p(out_nosa, "\t%ju outbound packet%s with no SA available\n");
- p(out_inval, "\t%ju invalid outbound packet%s\n");
- p(out_nomem, "\t%ju outbound packet%s failed due to insufficient memory\n");
- p(out_noroute, "\t%ju outbound packet%s with no route\n");
- hist(ipsecstat->out_ahhist, ipsec_ahnames, "AH output");
- hist(ipsecstat->out_esphist, ipsec_espnames, "ESP output");
- hist(ipsecstat->out_comphist, ipsec_compnames, "IPComp output");
- p(spdcachelookup, "\t%ju SPD cache lookup%s\n");
- pes(spdcachemiss, "\t%ju SPD cache miss%s\n");
-#undef pes
-#undef hist
- p(ips_in_polvio, "\t%ju inbound packet%s violated process "
- "security policy\n");
- p(ips_out_polvio, "\t%ju outbound packet%s violated process "
- "security policy\n");
- p(ips_out_nosa, "\t%ju outbound packet%s with no SA available\n");
- p(ips_out_nomem, "\t%ju outbound packet%s failed due to "
- "insufficient memory\n");
- p(ips_out_noroute, "\t%ju outbound packet%s with no route "
- "available\n");
- p(ips_out_inval, "\t%ju invalid outbound packet%s\n");
- p(ips_out_bundlesa, "\t%ju outbound packet%s with bundled SAs\n");
- p(ips_mbcoalesced, "\t%ju mbuf%s coalesced during clone\n");
- p(ips_clcoalesced, "\t%ju cluster%s coalesced during clone\n");
- p(ips_clcopied, "\t%ju cluster%s copied during clone\n");
- p(ips_mbinserted, "\t%ju mbuf%s inserted during makespace\n");
+ xo_emit(m, (uintmax_t)ipsecstat->f, plural(ipsecstat->f))
+
+ p(ips_in_polvio, "\t{:dropped-policy-violation/%ju} "
+ "{N:/inbound packet%s violated process security policy}\n");
+ p(ips_in_nomem, "\t{:dropped-no-memory/%ju} "
+ "{N:/inbound packet%s failed due to insufficient memory}\n");
+ p(ips_in_inval, "\t{:dropped-invalid/%ju} "
+ "{N:/invalid inbound packet%s}\n");
+ p(ips_out_polvio, "\t{:discarded-policy-violation/%ju} "
+ "{N:/outbound packet%s violated process security policy}\n");
+ p(ips_out_nosa, "\t{:discarded-no-sa/%ju} "
+ "{N:/outbound packet%s with no SA available}\n");
+ p(ips_out_nomem, "\t{:discarded-no-memory/%ju} "
+ "{N:/outbound packet%s failed due to insufficient memory}\n");
+ p(ips_out_noroute, "\t{:discarded-no-route/%ju} "
+ "{N:/outbound packet%s with no route available}\n");
+ p(ips_out_inval, "\t{:discarded-invalid/%ju} "
+ "{N:/invalid outbound packet%s}\n");
+ p(ips_out_bundlesa, "\t{:send-bundled-sa/%ju} "
+ "{N:/outbound packet%s with bundled SAs}\n");
+ p(ips_mbcoalesced, "\t{:mbufs-coalesced-during-clone/%ju} "
+ "{N:/mbuf%s coalesced during clone}\n");
+ p(ips_clcoalesced, "\t{:clusters-coalesced-during-clone/%ju} "
+ "{N:/cluster%s coalesced during clone}\n");
+ p(ips_clcopied, "\t{:clusters-copied-during-clone/%ju} "
+ "{N:/cluster%s copied during clone}\n");
+ p(ips_mbinserted, "\t{:mbufs-inserted/%ju} "
+ "{N:/mbuf%s inserted during makespace}\n");
#undef p
+ xo_close_container("ipsec-statistics");
}
void
@@ -267,17 +228,22 @@ ipsec_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
{
struct ipsecstat ipsecstat;
- if (off == 0)
- return;
- printf ("%s:\n", name);
- kread(off, (char *)&ipsecstat, sizeof(ipsecstat));
+ if (strcmp(name, "ipsec6") == 0) {
+ if (fetch_stats("net.inet6.ipsec6.ipsecstats", off,&ipsecstat,
+ sizeof(ipsecstat), kread_counters) != 0)
+ return;
+ } else {
+ if (fetch_stats("net.inet.ipsec.ipsecstats", off, &ipsecstat,
+ sizeof(ipsecstat), kread_counters) != 0)
+ return;
+ }
+
+ xo_emit("{T:/%s}:\n", name);
print_ipsecstats(&ipsecstat);
}
-static void ipsec_hist_new(const u_int32_t *hist, size_t histmax,
- const struct val2str *name, const char *title);
static void print_ahstats(const struct ahstat *ahstat);
static void print_espstats(const struct espstat *espstat);
static void print_ipcompstats(const struct ipcompstat *ipcompstat);
@@ -286,8 +252,8 @@ static void print_ipcompstats(const struct ipcompstat *ipcompstat);
* Dump IPSEC statistics structure.
*/
static void
-ipsec_hist_new(const u_int32_t *hist, size_t histmax,
- const struct val2str *name, const char *title)
+ipsec_hist_new(const uint64_t *hist, size_t histmax,
+ const struct val2str *name, const char *title, const char *cname)
{
int first;
size_t proto;
@@ -298,56 +264,72 @@ ipsec_hist_new(const u_int32_t *hist, size_t histmax,
if (hist[proto] <= 0)
continue;
if (first) {
- printf("\t%s histogram:\n", title);
+ xo_open_list(cname);
+ xo_emit("\t{T:/%s histogram}:\n", title);
first = 0;
}
+ xo_open_instance(cname);
for (p = name; p && p->str; p++) {
if (p->val == (int)proto)
break;
}
if (p && p->str) {
- printf("\t\t%s: %u\n", p->str, hist[proto]);
+ xo_emit("\t\t{k:name}: {:count/%ju}\n", p->str,
+ (uintmax_t)hist[proto]);
} else {
- printf("\t\t#%lu: %u\n", (unsigned long)proto,
- hist[proto]);
+ xo_emit("\t\t#{k:name/%lu}: {:count/%ju}\n",
+ (unsigned long)proto, (uintmax_t)hist[proto]);
}
+ xo_close_instance(cname);
}
+ if (!first)
+ xo_close_list(cname);
}
static void
print_ahstats(const struct ahstat *ahstat)
{
-#define p32(f, m) if (ahstat->f || sflag <= 1) \
- printf("\t%u" m, (unsigned int)ahstat->f, plural(ahstat->f))
-#define p64(f, m) if (ahstat->f || sflag <= 1) \
- printf("\t%ju" m, (uintmax_t)ahstat->f, plural(ahstat->f))
-#define hist(f, n, t) \
- ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t));
-
- p32(ahs_hdrops, " packet%s shorter than header shows\n");
- p32(ahs_nopf, " packet%s dropped; protocol family not supported\n");
- p32(ahs_notdb, " packet%s dropped; no TDB\n");
- p32(ahs_badkcr, " packet%s dropped; bad KCR\n");
- p32(ahs_qfull, " packet%s dropped; queue full\n");
- p32(ahs_noxform, " packet%s dropped; no transform\n");
- p32(ahs_wrap, " replay counter wrap%s\n");
- p32(ahs_badauth, " packet%s dropped; bad authentication detected\n");
- p32(ahs_badauthl, " packet%s dropped; bad authentication length\n");
- p32(ahs_replay, " possible replay packet%s detected\n");
- p32(ahs_input, " packet%s in\n");
- p32(ahs_output, " packet%s out\n");
- p32(ahs_invalid, " packet%s dropped; invalid TDB\n");
- p64(ahs_ibytes, " byte%s in\n");
- p64(ahs_obytes, " byte%s out\n");
- p32(ahs_toobig, " packet%s dropped; larger than IP_MAXPACKET\n");
- p32(ahs_pdrops, " packet%s blocked due to policy\n");
- p32(ahs_crypto, " crypto processing failure%s\n");
- p32(ahs_tunnel, " tunnel sanity check failure%s\n");
- hist(ahstat->ahs_hist, ipsec_ahnames, "AH output");
-
-#undef p32
-#undef p64
+ xo_open_container("ah-statictics");
+
+#define p(f, n, m) if (ahstat->f || sflag <= 1) \
+ xo_emit("\t{:" n "/%ju} {N:/" m "}\n", \
+ (uintmax_t)ahstat->f, plural(ahstat->f))
+#define hist(f, n, t, c) \
+ ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t), (c))
+
+ p(ahs_hdrops, "dropped-short-header",
+ "packet%s shorter than header shows");
+ p(ahs_nopf, "dropped-bad-protocol",
+ "packet%s dropped; protocol family not supported");
+ p(ahs_notdb, "dropped-no-tdb", "packet%s dropped; no TDB");
+ p(ahs_badkcr, "dropped-bad-kcr", "packet%s dropped; bad KCR");
+ p(ahs_qfull, "dropped-queue-full", "packet%s dropped; queue full");
+ p(ahs_noxform, "dropped-no-transform",
+ "packet%s dropped; no transform");
+ p(ahs_wrap, "replay-counter-wraps", "replay counter wrap%s");
+ p(ahs_badauth, "dropped-bad-auth",
+ "packet%s dropped; bad authentication detected");
+ p(ahs_badauthl, "dropped-bad-auth-level",
+ "packet%s dropped; bad authentication length");
+ p(ahs_replay, "possile-replay-detected",
+ "possible replay packet%s detected");
+ p(ahs_input, "received-packets", "packet%s in");
+ p(ahs_output, "send-packets", "packet%s out");
+ p(ahs_invalid, "dropped-bad-tdb", "packet%s dropped; invalid TDB");
+ p(ahs_ibytes, "received-bytes", "byte%s in");
+ p(ahs_obytes, "send-bytes", "byte%s out");
+ p(ahs_toobig, "dropped-too-large",
+ "packet%s dropped; larger than IP_MAXPACKET");
+ p(ahs_pdrops, "dropped-policy-violation",
+ "packet%s blocked due to policy");
+ p(ahs_crypto, "crypto-failures", "crypto processing failure%s");
+ p(ahs_tunnel, "tunnel-failures", "tunnel sanity check failure%s");
+ hist(ahstat->ahs_hist, ipsec_ahnames,
+ "AH output", "ah-output-histogram");
+
+#undef p
#undef hist
+ xo_close_container("ah-statictics");
}
void
@@ -355,10 +337,11 @@ ah_stats(u_long off, const char *name, int family __unused, int proto __unused)
{
struct ahstat ahstat;
- if (off == 0)
+ if (fetch_stats("net.inet.ah.stats", off, &ahstat,
+ sizeof(ahstat), kread_counters) != 0)
return;
- printf ("%s:\n", name);
- kread(off, (char *)&ahstat, sizeof(ahstat));
+
+ xo_emit("{T:/%s}:\n", name);
print_ahstats(&ahstat);
}
@@ -366,38 +349,47 @@ ah_stats(u_long off, const char *name, int family __unused, int proto __unused)
static void
print_espstats(const struct espstat *espstat)
{
-#define p32(f, m) if (espstat->f || sflag <= 1) \
- printf("\t%u" m, (unsigned int)espstat->f, plural(espstat->f))
-#define p64(f, m) if (espstat->f || sflag <= 1) \
- printf("\t%ju" m, (uintmax_t)espstat->f, plural(espstat->f))
-#define hist(f, n, t) \
- ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t));
-
- p32(esps_hdrops, " packet%s shorter than header shows\n");
- p32(esps_nopf, " packet%s dropped; protocol family not supported\n");
- p32(esps_notdb, " packet%s dropped; no TDB\n");
- p32(esps_badkcr, " packet%s dropped; bad KCR\n");
- p32(esps_qfull, " packet%s dropped; queue full\n");
- p32(esps_noxform, " packet%s dropped; no transform\n");
- p32(esps_badilen, " packet%s dropped; bad ilen\n");
- p32(esps_wrap, " replay counter wrap%s\n");
- p32(esps_badenc, " packet%s dropped; bad encryption detected\n");
- p32(esps_badauth, " packet%s dropped; bad authentication detected\n");
- p32(esps_replay, " possible replay packet%s detected\n");
- p32(esps_input, " packet%s in\n");
- p32(esps_output, " packet%s out\n");
- p32(esps_invalid, " packet%s dropped; invalid TDB\n");
- p64(esps_ibytes, " byte%s in\n");
- p64(esps_obytes, " byte%s out\n");
- p32(esps_toobig, " packet%s dropped; larger than IP_MAXPACKET\n");
- p32(esps_pdrops, " packet%s blocked due to policy\n");
- p32(esps_crypto, " crypto processing failure%s\n");
- p32(esps_tunnel, " tunnel sanity check failure%s\n");
- hist(espstat->esps_hist, ipsec_espnames, "ESP output");
-
-#undef p32
-#undef p64
+ xo_open_container("esp-statictics");
+#define p(f, n, m) if (espstat->f || sflag <= 1) \
+ xo_emit("\t{:" n "/%ju} {N:/" m "}\n", \
+ (uintmax_t)espstat->f, plural(espstat->f))
+#define hist(f, n, t, c) \
+ ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t), (c));
+
+ p(esps_hdrops, "dropped-short-header",
+ "packet%s shorter than header shows");
+ p(esps_nopf, "dropped-bad-protocol",
+ "packet%s dropped; protocol family not supported");
+ p(esps_notdb, "dropped-no-tdb", "packet%s dropped; no TDB");
+ p(esps_badkcr, "dropped-bad-kcr", "packet%s dropped; bad KCR");
+ p(esps_qfull, "dropped-queue-full", "packet%s dropped; queue full");
+ p(esps_noxform, "dropped-no-transform",
+ "packet%s dropped; no transform");
+ p(esps_badilen, "dropped-bad-length", "packet%s dropped; bad ilen");
+ p(esps_wrap, "replay-counter-wraps", "replay counter wrap%s");
+ p(esps_badenc, "dropped-bad-crypto",
+ "packet%s dropped; bad encryption detected");
+ p(esps_badauth, "dropped-bad-auth",
+ "packet%s dropped; bad authentication detected");
+ p(esps_replay, "possible-replay-detected",
+ "possible replay packet%s detected");
+ p(esps_input, "received-packets", "packet%s in");
+ p(esps_output, "sent-packets", "packet%s out");
+ p(esps_invalid, "dropped-bad-tdb", "packet%s dropped; invalid TDB");
+ p(esps_ibytes, "receieve-bytes", "byte%s in");
+ p(esps_obytes, "sent-bytes", "byte%s out");
+ p(esps_toobig, "dropped-too-large",
+ "packet%s dropped; larger than IP_MAXPACKET");
+ p(esps_pdrops, "dropped-policy-violation",
+ "packet%s blocked due to policy");
+ p(esps_crypto, "crypto-failures", "crypto processing failure%s");
+ p(esps_tunnel, "tunnel-failures", "tunnel sanity check failure%s");
+ hist(espstat->esps_hist, ipsec_espnames,
+ "ESP output", "esp-output-histogram");
+
+#undef p
#undef hist
+ xo_close_container("esp-statictics");
}
void
@@ -405,10 +397,11 @@ esp_stats(u_long off, const char *name, int family __unused, int proto __unused)
{
struct espstat espstat;
- if (off == 0)
+ if (fetch_stats("net.inet.esp.stats", off, &espstat,
+ sizeof(espstat), kread_counters) != 0)
return;
- printf ("%s:\n", name);
- kread(off, (char *)&espstat, sizeof(espstat));
+
+ xo_emit("{T:/%s}:\n", name);
print_espstats(&espstat);
}
@@ -416,43 +409,44 @@ esp_stats(u_long off, const char *name, int family __unused, int proto __unused)
static void
print_ipcompstats(const struct ipcompstat *ipcompstat)
{
- uint32_t version;
-#define p32(f, m) if (ipcompstat->f || sflag <= 1) \
- printf("\t%u" m, (unsigned int)ipcompstat->f, plural(ipcompstat->f))
-#define p64(f, m) if (ipcompstat->f || sflag <= 1) \
- printf("\t%ju" m, (uintmax_t)ipcompstat->f, plural(ipcompstat->f))
-#define hist(f, n, t) \
- ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t));
-
-#ifndef IPCOMPSTAT_VERSION
- version = 0;
-#else
- version = ipcompstat->version;
-#endif
- p32(ipcomps_hdrops, " packet%s shorter than header shows\n");
- p32(ipcomps_nopf, " packet%s dropped; protocol family not supported\n");
- p32(ipcomps_notdb, " packet%s dropped; no TDB\n");
- p32(ipcomps_badkcr, " packet%s dropped; bad KCR\n");
- p32(ipcomps_qfull, " packet%s dropped; queue full\n");
- p32(ipcomps_noxform, " packet%s dropped; no transform\n");
- p32(ipcomps_wrap, " replay counter wrap%s\n");
- p32(ipcomps_input, " packet%s in\n");
- p32(ipcomps_output, " packet%s out\n");
- p32(ipcomps_invalid, " packet%s dropped; invalid TDB\n");
- p64(ipcomps_ibytes, " byte%s in\n");
- p64(ipcomps_obytes, " byte%s out\n");
- p32(ipcomps_toobig, " packet%s dropped; larger than IP_MAXPACKET\n");
- p32(ipcomps_pdrops, " packet%s blocked due to policy\n");
- p32(ipcomps_crypto, " crypto processing failure%s\n");
- hist(ipcompstat->ipcomps_hist, ipsec_compnames, "COMP output");
- if (version >= 1) {
- p32(ipcomps_threshold, " packet%s sent uncompressed; size < compr. algo. threshold\n");
- p32(ipcomps_uncompr, " packet%s sent uncompressed; compression was useless\n");
- }
+ xo_open_container("ipcomp-statictics");
+
+#define p(f, n, m) if (ipcompstat->f || sflag <= 1) \
+ xo_emit("\t{:" n "/%ju} {N:/" m "}\n", \
+ (uintmax_t)ipcompstat->f, plural(ipcompstat->f))
+#define hist(f, n, t, c) \
+ ipsec_hist_new((f), sizeof(f)/sizeof(f[0]), (n), (t), (c));
+
+ p(ipcomps_hdrops, "dropped-short-header",
+ "packet%s shorter than header shows");
+ p(ipcomps_nopf, "dropped-bad-protocol",
+ "packet%s dropped; protocol family not supported");
+ p(ipcomps_notdb, "dropped-no-tdb", "packet%s dropped; no TDB");
+ p(ipcomps_badkcr, "dropped-bad-kcr", "packet%s dropped; bad KCR");
+ p(ipcomps_qfull, "dropped-queue-full", "packet%s dropped; queue full");
+ p(ipcomps_noxform, "dropped-no-transform",
+ "packet%s dropped; no transform");
+ p(ipcomps_wrap, "replay-counter-wraps", "replay counter wrap%s");
+ p(ipcomps_input, "receieve-packets", "packet%s in");
+ p(ipcomps_output, "sent-packets", "packet%s out");
+ p(ipcomps_invalid, "dropped-bad-tdb", "packet%s dropped; invalid TDB");
+ p(ipcomps_ibytes, "receieved-bytes", "byte%s in");
+ p(ipcomps_obytes, "sent-bytes", "byte%s out");
+ p(ipcomps_toobig, "dropped-too-large",
+ "packet%s dropped; larger than IP_MAXPACKET");
+ p(ipcomps_pdrops, "dropped-policy-violation",
+ "packet%s blocked due to policy");
+ p(ipcomps_crypto, "crypto-failure", "crypto processing failure%s");
+ hist(ipcompstat->ipcomps_hist, ipsec_compnames,
+ "COMP output", "comp-output-histogram");
+ p(ipcomps_threshold, "sent-uncompressed-small-packets",
+ "packet%s sent uncompressed; size < compr. algo. threshold");
+ p(ipcomps_uncompr, "sent-uncompressed-useless-packets",
+ "packet%s sent uncompressed; compression was useless");
-#undef p32
-#undef p64
+#undef p
#undef hist
+ xo_close_container("ipcomp-statictics");
}
void
@@ -461,10 +455,11 @@ ipcomp_stats(u_long off, const char *name, int family __unused,
{
struct ipcompstat ipcompstat;
- if (off == 0)
+ if (fetch_stats("net.inet.ipcomp.stats", off, &ipcompstat,
+ sizeof(ipcompstat), kread_counters) != 0)
return;
- printf ("%s:\n", name);
- kread(off, (char *)&ipcompstat, sizeof(ipcompstat));
+
+ xo_emit("{T:/%s}:\n", name);
print_ipcompstats(&ipcompstat);
}