From owner-p4-projects@FreeBSD.ORG Mon Jul 27 16:08:19 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 154561065679; Mon, 27 Jul 2009 16:08:18 +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 7B2C01065677 for ; Mon, 27 Jul 2009 16:08:18 +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 692508FC13 for ; Mon, 27 Jul 2009 16:08:18 +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 n6RG8IKj097599 for ; Mon, 27 Jul 2009 16:08:18 GMT (envelope-from pgj@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n6RG8IGW097597 for perforce@freebsd.org; Mon, 27 Jul 2009 16:08:18 GMT (envelope-from pgj@FreeBSD.org) Date: Mon, 27 Jul 2009 16:08:18 GMT Message-Id: <200907271608.n6RG8IGW097597@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 166629 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: Mon, 27 Jul 2009 16:08:19 -0000 http://perforce.freebsd.org/chv.cgi?CH=166629 Change 166629 by pgj@petymeg-current on 2009/07/27 16:07:51 Add support for CARP statistics. Affected files ... .. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.h#35 edit .. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_internal.h#33 edit .. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_stat.c#3 edit .. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#39 edit Differences ... ==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.h#35 (text+ko) ==== @@ -117,6 +117,7 @@ enum stat { stat_TCP = 0, stat_UDP, + stat_CARP, stat_MAX, stat_Invalid, }; @@ -144,6 +145,7 @@ struct stat_type; struct tcp_stat; struct udp_stat; +struct carp_stat; __BEGIN_DECLS const char *netstat_strerror(int); @@ -445,4 +447,23 @@ u_int64_t netstat_udps_get_fastout(const struct udp_stat *); u_int64_t netstat_udps_get_noportmcast(const struct udp_stat *); u_int64_t netstat_udps_get_filtermcast(const struct udp_stat *); + +const struct carp_stat *netstat_get_carpstats(const struct stat_type *); + +u_int64_t netstat_carps_get_ipackets(const struct carp_stat *); +u_int64_t netstat_carps_get_ipackets6(const struct carp_stat *); +u_int64_t netstat_carps_get_badif(const struct carp_stat *); +u_int64_t netstat_carps_get_badttl(const struct carp_stat *); +u_int64_t netstat_carps_get_hdrops(const struct carp_stat *); +u_int64_t netstat_carps_get_badsum(const struct carp_stat *); +u_int64_t netstat_carps_get_badver(const struct carp_stat *); +u_int64_t netstat_carps_get_badlen(const struct carp_stat *); +u_int64_t netstat_carps_get_badauth(const struct carp_stat *); +u_int64_t netstat_carps_get_badvhid(const struct carp_stat *); +u_int64_t netstat_carps_get_badaddrs(const struct carp_stat *); +u_int64_t netstat_carps_get_opackets(const struct carp_stat *); +u_int64_t netstat_carps_get_opackets6(const struct carp_stat *); +u_int64_t netstat_carps_get_onomem(const struct carp_stat *); +u_int64_t netstat_carps_get_ostates(const struct carp_stat *); +u_int64_t netstat_carps_get_preempt(const struct carp_stat *); #endif /* !_NETSTAT_H_ */ ==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_internal.h#33 (text+ko) ==== @@ -44,6 +44,7 @@ #include #include #include +#include #include "netstat.h" @@ -289,6 +290,10 @@ struct udpstat s; }; +struct carp_stat { + struct carpstats s; +}; + int kread_data(kvm_t *kvm, u_long kvm_pointer, void *address, size_t size); int kread_string(kvm_t *kvm, u_long kvm_pointer, char *buffer, int buflen); ==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_stat.c#3 (text+ko) ==== @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -56,6 +57,7 @@ } stat_info [] = { { TCPSTAT_VERSION, "net.inet.tcp.stats", "_tcpstat" }, { UDPSTAT_VERSION, "net.inet.udp.stats", "_udpstat" }, + { CARPSTAT_VERSION, "net.inet.carp.stats", "_carpstats" }, }; int ==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#39 (text+ko) ==== @@ -1893,6 +1893,111 @@ return (usp->s.udps_filtermcast); } +const struct carp_stat * +netstat_get_carpstats(const struct stat_type *sttp) +{ + if (sttp->stt_type == stat_CARP) { + return ((const struct carp_stat *) sttp->stt_data); + } + return (NULL); +} + +u_int64_t +netstat_carps_get_ipackets(const struct carp_stat *csp) +{ + return (csp->s.carps_ipackets); +} + +u_int64_t +netstat_carps_get_ipackets6(const struct carp_stat *csp) +{ + return (csp->s.carps_ipackets6); +} + +u_int64_t +netstat_carps_get_badif(const struct carp_stat *csp) +{ + return (csp->s.carps_badif); +} + +u_int64_t +netstat_carps_get_badttl(const struct carp_stat *csp) +{ + return (csp->s.carps_badttl); +} + +u_int64_t +netstat_carps_get_hdrops(const struct carp_stat *csp) +{ + return (csp->s.carps_hdrops); +} + +u_int64_t +netstat_carps_get_badsum(const struct carp_stat *csp) +{ + return (csp->s.carps_badsum); +} + +u_int64_t +netstat_carps_get_badver(const struct carp_stat *csp) +{ + return (csp->s.carps_badver); +} + +u_int64_t +netstat_carps_get_badlen(const struct carp_stat *csp) +{ + return (csp->s.carps_badlen); +} + +u_int64_t +netstat_carps_get_badauth(const struct carp_stat *csp) +{ + return (csp->s.carps_badauth); +} + +u_int64_t +netstat_carps_get_badvhid(const struct carp_stat *csp) +{ + return (csp->s.carps_badvhid); +} + +u_int64_t +netstat_carps_get_badaddrs(const struct carp_stat *csp) +{ + return (csp->s.carps_badaddrs); +} + +u_int64_t +netstat_carps_get_opackets(const struct carp_stat *csp) +{ + return (csp->s.carps_opackets); +} + +u_int64_t +netstat_carps_get_opackets6(const struct carp_stat *csp) +{ + return (csp->s.carps_opackets6); +} + +u_int64_t +netstat_carps_get_onomem(const struct carp_stat *csp) +{ + return (csp->s.carps_onomem); +} + +u_int64_t +netstat_carps_get_ostates(const struct carp_stat *csp) +{ + return (csp->s.carps_ostates); +} + +u_int64_t +netstat_carps_get_preempt(const struct carp_stat *csp) +{ + return (csp->s.carps_preempt); +} + const char * routename(in_addr_t in, int numeric)