From owner-p4-projects@FreeBSD.ORG Mon Jul 27 18:33:59 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3E09510656D3; Mon, 27 Jul 2009 18:33:59 +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 F023610656D1 for ; Mon, 27 Jul 2009 18:33:58 +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 D4EC28FC13 for ; Mon, 27 Jul 2009 18:33:58 +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 n6RIXwJ8020490 for ; Mon, 27 Jul 2009 18:33:58 GMT (envelope-from pgj@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n6RIXwf1020488 for perforce@freebsd.org; Mon, 27 Jul 2009 18:33:58 GMT (envelope-from pgj@FreeBSD.org) Date: Mon, 27 Jul 2009 18:33:58 GMT Message-Id: <200907271833.n6RIXwf1020488@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 166642 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 18:34:00 -0000 http://perforce.freebsd.org/chv.cgi?CH=166642 Change 166642 by pgj@petymeg-current on 2009/07/27 18:33:21 Add support for IP statistics. Affected files ... .. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.h#36 edit .. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_internal.h#34 edit .. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_stat.c#4 edit .. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#40 edit Differences ... ==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.h#36 (text+ko) ==== @@ -118,6 +118,7 @@ stat_TCP = 0, stat_UDP, stat_CARP, + stat_IP, stat_MAX, stat_Invalid, }; @@ -146,6 +147,7 @@ struct tcp_stat; struct udp_stat; struct carp_stat; +struct ip_stat; __BEGIN_DECLS const char *netstat_strerror(int); @@ -466,4 +468,36 @@ 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 *); + +const struct ip_stat *netstat_get_ipstats(const struct stat_type *); + +u_int64_t netstat_ips_get_total(const struct ip_stat *); +u_int64_t netstat_ips_get_badsum(const struct ip_stat *); +u_int64_t netstat_ips_get_tooshort(const struct ip_stat *); +u_int64_t netstat_ips_get_toosmall(const struct ip_stat *); +u_int64_t netstat_ips_get_badhlen(const struct ip_stat *); +u_int64_t netstat_ips_get_badlen(const struct ip_stat *); +u_int64_t netstat_ips_get_fragments(const struct ip_stat *); +u_int64_t netstat_ips_get_fragdropped(const struct ip_stat *); +u_int64_t netstat_ips_get_fragtimeout(const struct ip_stat *); +u_int64_t netstat_ips_get_forward(const struct ip_stat *); +u_int64_t netstat_ips_get_fastforward(const struct ip_stat *); +u_int64_t netstat_ips_get_cantforward(const struct ip_stat *); +u_int64_t netstat_ips_get_redirectsent(const struct ip_stat *); +u_int64_t netstat_ips_get_noproto(const struct ip_stat *); +u_int64_t netstat_ips_get_delivered(const struct ip_stat *); +u_int64_t netstat_ips_get_localout(const struct ip_stat *); +u_int64_t netstat_ips_get_odropped(const struct ip_stat *); +u_int64_t netstat_ips_get_reassembled(const struct ip_stat *); +u_int64_t netstat_ips_get_fragmented(const struct ip_stat *); +u_int64_t netstat_ips_get_ofragments(const struct ip_stat *); +u_int64_t netstat_ips_get_cantfrag(const struct ip_stat *); +u_int64_t netstat_ips_get_badoptions(const struct ip_stat *); +u_int64_t netstat_ips_get_noroute(const struct ip_stat *); +u_int64_t netstat_ips_get_badvers(const struct ip_stat *); +u_int64_t netstat_ips_get_rawout(const struct ip_stat *); +u_int64_t netstat_ips_get_toolong(const struct ip_stat *); +u_int64_t netstat_ips_get_notmember(const struct ip_stat *); +u_int64_t netstat_ips_get_nogif(const struct ip_stat *); +u_int64_t netstat_ips_get_badaddr(const struct ip_stat *); #endif /* !_NETSTAT_H_ */ ==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_internal.h#34 (text+ko) ==== @@ -294,6 +294,10 @@ struct carpstats s; }; +struct ip_stat { + struct ipstat 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#4 (text+ko) ==== @@ -58,6 +58,7 @@ { TCPSTAT_VERSION, "net.inet.tcp.stats", "_tcpstat" }, { UDPSTAT_VERSION, "net.inet.udp.stats", "_udpstat" }, { CARPSTAT_VERSION, "net.inet.carp.stats", "_carpstats" }, + { IPSTAT_VERSION, "net.inet.ip.stats", "_ipstat" }, }; int ==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#40 (text+ko) ==== @@ -1998,6 +1998,189 @@ return (csp->s.carps_preempt); } +const struct ip_stat * +netstat_get_ipstats(const struct stat_type *sttp) +{ + if (sttp->stt_type == stat_IP) { + return ((const struct ip_stat *) sttp->stt_data); + } + return (NULL); +} + +u_int64_t +netstat_ips_get_total(const struct ip_stat *isp) +{ + return (isp->s.ips_total); +} + +u_int64_t +netstat_ips_get_badsum(const struct ip_stat *isp) +{ + return (isp->s.ips_badsum); +} + +u_int64_t +netstat_ips_get_tooshort(const struct ip_stat *isp) +{ + return (isp->s.ips_tooshort); +} + +u_int64_t +netstat_ips_get_toosmall(const struct ip_stat *isp) +{ + return (isp->s.ips_toosmall); +} + +u_int64_t +netstat_ips_get_badhlen(const struct ip_stat *isp) +{ + return (isp->s.ips_badhlen); +} + +u_int64_t +netstat_ips_get_badlen(const struct ip_stat *isp) +{ + return (isp->s.ips_badlen); +} + +u_int64_t +netstat_ips_get_fragments(const struct ip_stat *isp) +{ + return (isp->s.ips_fragments); +} + +u_int64_t +netstat_ips_get_fragdropped(const struct ip_stat *isp) +{ + return (isp->s.ips_fragdropped); +} + +u_int64_t +netstat_ips_get_fragtimeout(const struct ip_stat *isp) +{ + return (isp->s.ips_fragtimeout); +} + +u_int64_t +netstat_ips_get_forward(const struct ip_stat *isp) +{ + return (isp->s.ips_forward); +} + +u_int64_t +netstat_ips_get_fastforward(const struct ip_stat *isp) +{ + return (isp->s.ips_fastforward); +} + +u_int64_t +netstat_ips_get_cantforward(const struct ip_stat *isp) +{ + return (isp->s.ips_cantforward); +} + +u_int64_t +netstat_ips_get_redirectsent(const struct ip_stat *isp) +{ + return (isp->s.ips_redirectsent); +} + +u_int64_t +netstat_ips_get_noproto(const struct ip_stat *isp) +{ + return (isp->s.ips_noproto); +} + +u_int64_t +netstat_ips_get_delivered(const struct ip_stat *isp) +{ + return (isp->s.ips_delivered); +} + +u_int64_t +netstat_ips_get_localout(const struct ip_stat *isp) +{ + return (isp->s.ips_localout); +} + +u_int64_t +netstat_ips_get_odropped(const struct ip_stat *isp) +{ + return (isp->s.ips_odropped); +} + +u_int64_t +netstat_ips_get_reassembled(const struct ip_stat *isp) +{ + return (isp->s.ips_reassembled); +} + +u_int64_t +netstat_ips_get_fragmented(const struct ip_stat *isp) +{ + return (isp->s.ips_fragmented); +} + +u_int64_t +netstat_ips_get_ofragments(const struct ip_stat *isp) +{ + return (isp->s.ips_ofragments); +} + +u_int64_t +netstat_ips_get_cantfrag(const struct ip_stat *isp) +{ + return (isp->s.ips_cantfrag); +} + +u_int64_t +netstat_ips_get_badoptions(const struct ip_stat *isp) +{ + return (isp->s.ips_badoptions); +} + +u_int64_t +netstat_ips_get_noroute(const struct ip_stat *isp) +{ + return (isp->s.ips_noroute); +} + +u_int64_t +netstat_ips_get_badvers(const struct ip_stat *isp) +{ + return (isp->s.ips_badvers); +} + +u_int64_t +netstat_ips_get_rawout(const struct ip_stat *isp) +{ + return (isp->s.ips_rawout); +} + +u_int64_t +netstat_ips_get_toolong(const struct ip_stat *isp) +{ + return (isp->s.ips_toolong); +} + +u_int64_t +netstat_ips_get_notmember(const struct ip_stat *isp) +{ + return (isp->s.ips_notmember); +} + +u_int64_t +netstat_ips_get_nogif(const struct ip_stat *isp) +{ + return (isp->s.ips_nogif); +} + +u_int64_t +netstat_ips_get_badaddr(const struct ip_stat *isp) +{ + return (isp->s.ips_badaddr); +} + const char * routename(in_addr_t in, int numeric)