From owner-p4-projects@FreeBSD.ORG Thu Jul 30 23:02:36 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5903A106566B; Thu, 30 Jul 2009 23:02:36 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18BBC1065679 for ; Thu, 30 Jul 2009 23:02:36 +0000 (UTC) (envelope-from pgj@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 06AA28FC15 for ; Thu, 30 Jul 2009 23:02:36 +0000 (UTC) (envelope-from pgj@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n6UN2ZgV043265 for ; Thu, 30 Jul 2009 23:02:35 GMT (envelope-from pgj@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n6UN2Zi6043263 for perforce@freebsd.org; Thu, 30 Jul 2009 23:02:35 GMT (envelope-from pgj@FreeBSD.org) Date: Thu, 30 Jul 2009 23:02:35 GMT Message-Id: <200907302302.n6UN2Zi6043263@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to pgj@FreeBSD.org using -f From: Gabor Pali To: Perforce Change Reviews Cc: Subject: PERFORCE change 166845 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2009 23:02:37 -0000 http://perforce.freebsd.org/chv.cgi?CH=166845 Change 166845 by pgj@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 #include #include +#include #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;