diff options
author | bz <bz@FreeBSD.org> | 2009-12-05 19:21:58 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2009-12-05 19:21:58 +0000 |
commit | 1f7b1b46a366d093e39d0974b2a85eda23401b38 (patch) | |
tree | 3f6afb93439477409cf46fde60ed8e27927d0606 /sys | |
parent | 6cf85ab0d8e3789f598fb069beb105bfda575bcb (diff) | |
download | FreeBSD-src-1f7b1b46a366d093e39d0974b2a85eda23401b38.zip FreeBSD-src-1f7b1b46a366d093e39d0974b2a85eda23401b38.tar.gz |
MFC r199946:
Add more statistics variables for IPcomp.
Try to version the struct in a backward compatible way.
People asked for the versioning of the stats structs in general before.
Note: old netstat binaries, as only consumer, continue to work as they are
still using kvm but will not display the new stats. [1]
Discussed with: rwatson [1]
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netipsec/ipcomp_var.h | 4 | ||||
-rw-r--r-- | sys/netipsec/xform_ipcomp.c | 18 |
2 files changed, 19 insertions, 3 deletions
diff --git a/sys/netipsec/ipcomp_var.h b/sys/netipsec/ipcomp_var.h index a9dbe86..78f1848 100644 --- a/sys/netipsec/ipcomp_var.h +++ b/sys/netipsec/ipcomp_var.h @@ -41,6 +41,7 @@ */ #define IPCOMP_ALG_MAX 8 +#define IPCOMPSTAT_VERSION 1 struct ipcompstat { u_int32_t ipcomps_hdrops; /* Packet shorter than header shows */ u_int32_t ipcomps_nopf; /* Protocol family not supported */ @@ -58,6 +59,9 @@ struct ipcompstat { u_int32_t ipcomps_pdrops; /* Packet blocked due to policy */ u_int32_t ipcomps_crypto; /* "Crypto" processing failure */ u_int32_t ipcomps_hist[IPCOMP_ALG_MAX];/* Per-algorithm op count */ + u_int32_t version; /* Version of this structure. */ + u_int32_t ipcomps_threshold; /* Packet < comp. algo. threshold. */ + u_int32_t ipcomps_uncompr; /* Compression was useles. */ }; #ifdef _KERNEL diff --git a/sys/netipsec/xform_ipcomp.c b/sys/netipsec/xform_ipcomp.c index 2dc18de..4d21e38 100644 --- a/sys/netipsec/xform_ipcomp.c +++ b/sys/netipsec/xform_ipcomp.c @@ -345,7 +345,7 @@ ipcomp_output( * See RFC 3173, 2.2. Non-Expansion Policy. */ if (m->m_pkthdr.len <= ipcompx->minlen) { - /* XXX-BZ V_ipcompstat.threshold++; */ + V_ipcompstat.ipcomps_threshold++; return ipsec_process_done(m, isr); } @@ -569,8 +569,10 @@ ipcomp_output_cb(struct cryptop *crp) goto bad; } } else { - /* compression was useless, we have lost time */ - /* XXX add statistic */ + /* Compression was useless, we have lost time. */ + V_ipcompstat.ipcomps_uncompr++; + DPRINTF(("%s: compressions was useless %d - %d <= %d\n", + __func__, crp->crp_ilen, skip, crp->crp_olen)); /* XXX remember state to not compress the next couple * of packets, RFC 3173, 2.2. Non-Expansion Policy */ } @@ -609,3 +611,13 @@ ipcomp_attach(void) } SYSINIT(ipcomp_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, ipcomp_attach, NULL); + +static void +vnet_ipcomp_attach(const void *unused __unused) +{ + + V_ipcompstat.version = IPCOMPSTAT_VERSION; +} + +VNET_SYSINIT(vnet_ipcomp_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, + vnet_ipcomp_attach, NULL); |