PERFORCE change 166642 for review

Gabor Pali pgj at FreeBSD.org
Mon Jul 27 18:34:00 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=166642

Change 166642 by pgj at 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)


More information about the p4-projects mailing list