Date: Mon, 27 Jul 2009 16:08:18 GMT From: Gabor Pali <pgj@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 166629 for review Message-ID: <200907271608.n6RG8IGW097597@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <netinet/tcp_var.h> #include <netinet/udp.h> #include <netinet/udp_var.h> +#include <netinet/ip_carp.h> #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 <netinet/tcp_var.h> #include <netinet/udp.h> #include <netinet/udp_var.h> +#include <netinet/ip_carp.h> #include <err.h> #include <kvm.h> @@ -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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907271608.n6RG8IGW097597>
