PERFORCE change 166845 for review
Gabor Pali
pgj at FreeBSD.org
Thu Jul 30 23:02:37 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=166845
Change 166845 by pgj at petymeg-current on 2009/07/30 23:01:57
Add support for IPcomp statistics.
Affected files ...
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.h#52 edit
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_internal.h#49 edit
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_stat.c#19 edit
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#57 edit
Differences ...
==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.h#52 (text+ko) ====
@@ -92,6 +92,7 @@
/* IPsec: */
#define NETSTAT_ESP_HIST_MAX ESP_ALG_MAX
#define NETSTAT_AH_HIST_MAX AH_ALG_MAX
+#define NETSTAT_IPCOMP_HIST_MAX IPCOMP_ALG_MAX
/* Enum for TCP states: */
@@ -159,6 +160,7 @@
stat_pfkey,
stat_ESP,
stat_AH,
+ stat_IPcomp,
#endif
stat_MAX,
stat_Invalid,
@@ -212,6 +214,7 @@
struct pfkey_stat;
struct esp_stat;
struct ah_stat;
+struct ipcomp_stat;
#endif
__BEGIN_DECLS
@@ -1002,5 +1005,25 @@
u_int32_t netstat_ahs_get_crypto(const struct ah_stat *);
u_int32_t netstat_ahs_get_tunnel(const struct ah_stat *);
u_int32_t netstat_ahs_get_hist(const struct ah_stat *, int);
+
+const struct ipcomp_stat *netstat_get_ipcompstats(const struct stat_type *);
+const char *netstat_ipsec_ipcompname(int);
+
+u_int32_t netstat_ipcomps_get_hdrops(const struct ipcomp_stat *);
+u_int32_t netstat_ipcomps_get_nopf(const struct ipcomp_stat *);
+u_int32_t netstat_ipcomps_get_notdb(const struct ipcomp_stat *);
+u_int32_t netstat_ipcomps_get_badkcr(const struct ipcomp_stat *);
+u_int32_t netstat_ipcomps_get_qfull(const struct ipcomp_stat *);
+u_int32_t netstat_ipcomps_get_noxform(const struct ipcomp_stat *);
+u_int32_t netstat_ipcomps_get_wrap(const struct ipcomp_stat *);
+u_int32_t netstat_ipcomps_get_input(const struct ipcomp_stat *);
+u_int32_t netstat_ipcomps_get_output(const struct ipcomp_stat *);
+u_int32_t netstat_ipcomps_get_invalid(const struct ipcomp_stat *);
+u_int64_t netstat_ipcomps_get_ibytes(const struct ipcomp_stat *);
+u_int64_t netstat_ipcomps_get_obytes(const struct ipcomp_stat *);
+u_int32_t netstat_ipcomps_get_toobig(const struct ipcomp_stat *);
+u_int32_t netstat_ipcomps_get_pdrops(const struct ipcomp_stat *);
+u_int32_t netstat_ipcomps_get_crypto(const struct ipcomp_stat *);
+u_int32_t netstat_ipcomps_get_hist(const struct ipcomp_stat *, int);
#endif /* !IPSEC */
#endif /* !_NETSTAT_H_ */
==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_internal.h#49 (text+ko) ====
@@ -69,6 +69,7 @@
#include <netipsec/keysock.h>
#include <netipsec/esp_var.h>
#include <netipsec/ah_var.h>
+#include <netipsec/ipcomp_var.h>
#endif
#include "netstat.h"
@@ -385,6 +386,10 @@
struct ah_stat {
struct ahstat s;
};
+
+struct ipcomp_stat {
+ struct ipcompstat s;
+};
#endif
/* Timestamp type. */
==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_stat.c#19 (text+ko) ====
@@ -90,6 +90,7 @@
{ PFKEYSTAT_VERSION, "net.key.stats", "_pfkeystat" },
{ ESPSTAT_VERSION, "net.inet.esp.stats", "_espstat" },
{ AHSTAT_VERSION, "net.inet.ah.stats", "_ahstat" },
+ { IPCOMPSTAT_VERSION, "net.inet.ipcomp.stats", "_ipcompstat" },
#endif
};
==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#57 (text+ko) ====
@@ -1972,6 +1972,36 @@
#undef AH_ACC
#undef AH_ACC64
#undef AH_ACCA
+
+#define IPCOMP_ACC(field) \
+ STATS_ACCX(u_int32_t,ipcomp,field,ipcomps_##field)
+
+#define IPCOMP_ACC64(field) \
+ STATS_ACCX(u_int64_t,ipcomp,field,ipcomps_##field)
+
+#define IPCOMP_ACCA(field,size) \
+ STATS_ACCXA(u_int32_t,ipcomp,field,ipcomps_##field,size)
+
+STATS_GET(ipcomp,IPcomp);
+IPCOMP_ACC(hdrops);
+IPCOMP_ACC(nopf);
+IPCOMP_ACC(notdb);
+IPCOMP_ACC(badkcr);
+IPCOMP_ACC(qfull);
+IPCOMP_ACC(noxform);
+IPCOMP_ACC(wrap);
+IPCOMP_ACC(input);
+IPCOMP_ACC(output);
+IPCOMP_ACC(invalid);
+IPCOMP_ACC64(ibytes);
+IPCOMP_ACC64(obytes);
+IPCOMP_ACC(toobig);
+IPCOMP_ACC(pdrops);
+IPCOMP_ACC(crypto);
+IPCOMP_ACCA(hist,IPCOMP_ALG_MAX);
+#undef IPCOMP_ACC
+#undef IPCOMP_ACC64
+#undef IPCOMP_ACCA
#endif /* !IPSEC */
static const char *icmpnames[ICMP_MAXTYPE + 1] = {
@@ -2358,6 +2388,14 @@
{ -1, NULL },
};
+static struct val2str ipsec_ipcompnames[] = {
+ { SADB_X_CALG_NONE, "none" },
+ { SADB_X_CALG_OUI, "oui" },
+ { SADB_X_CALG_DEFLATE, "deflate" },
+ { SADB_X_CALG_LZS, "lzs" },
+ { -1, NULL },
+};
+
const char *
resolve_val2str_name(int proto, const struct val2str *name)
{
@@ -2389,6 +2427,12 @@
}
const char *
+netstat_ipsec_ipcompname(int proto)
+{
+ return (resolve_val2str_name(proto, ipsec_ipcompnames));
+}
+
+const char *
routename(in_addr_t in, int numeric)
{
char *cp;
More information about the p4-projects
mailing list