PERFORCE change 166807 for review
Gabor Pali
pgj at FreeBSD.org
Thu Jul 30 17:27:26 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=166807
Change 166807 by pgj at petymeg-current on 2009/07/30 17:27:03
Add support for RIP6 statistics.
Affected files ...
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.h#45 edit
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_internal.h#42 edit
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_stat.c#12 edit
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#50 edit
Differences ...
==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.h#45 (text+ko) ====
@@ -129,6 +129,7 @@
#ifdef INET6
stat_ICMP6,
stat_PIM6,
+ stat_RIP6,
#endif
stat_MAX,
stat_Invalid,
@@ -171,6 +172,7 @@
#ifdef INET6
struct icmp6_stat;
struct pim6_stat;
+struct rip6_stat;
#endif
__BEGIN_DECLS
@@ -778,5 +780,16 @@
u_int64_t netstat_pim6s_get_rcv_registers(const struct pim6_stat *);
u_int64_t netstat_pim6s_get_rcv_badregisters(const struct pim6_stat *);
u_int64_t netstat_pim6s_get_snd_registers(const struct pim6_stat *);
+
+const struct rip6_stat *netstat_get_rip6stats(const struct stat_type *);
+
+u_int64_t netstat_rip6s_get_ipackets(const struct rip6_stat *);
+u_int64_t netstat_rip6s_get_isum(const struct rip6_stat *);
+u_int64_t netstat_rip6s_get_badsum(const struct rip6_stat *);
+u_int64_t netstat_rip6s_get_nosock(const struct rip6_stat *);
+u_int64_t netstat_rip6s_get_nosockmcast(const struct rip6_stat *);
+u_int64_t netstat_rip6s_get_fullsock(const struct rip6_stat *);
+u_int64_t netstat_rip6s_get_opackets(const struct rip6_stat *);
+u_int64_t netstat_rip6s_get_delivered(const struct rip6_stat *);
#endif /* !INET6 */
#endif /* !_NETSTAT_H_ */
==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_internal.h#42 (text+ko) ====
@@ -57,6 +57,7 @@
#ifdef INET6
#include <netinet/icmp6.h>
#include <netinet6/pim6_var.h>
+#include <netinet6/raw_ip6.h>
#endif
#include "netstat.h"
@@ -341,6 +342,10 @@
struct pim6_stat {
struct pim6stat s;
};
+
+struct rip6_stat {
+ struct rip6stat s;
+};
#endif
/* Timestamp type. */
==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_stat.c#12 (text+ko) ====
@@ -40,6 +40,7 @@
#include <netinet/icmp_var.h>
#ifdef INET6
#include <netinet6/pim6_var.h>
+#include <netinet6/raw_ip6.h>
#endif
#include <err.h>
@@ -74,6 +75,7 @@
#ifdef INET6
{ ICMP6STAT_VERSION, "net.inet6.icmp6.stats", "_icmp6stat" },
{ PIM6STAT_VERSION, "net.inet6.pim.stats", "_pim6stat" },
+ { RIP6STAT_VERSION, "net.inet6.ip6.rip6stats", "_rip6stat" },
#endif
};
@@ -86,6 +88,9 @@
struct stat_header head;
struct udpstat *u;
+#ifdef INET6
+ struct rip6stat *r;
+#endif
int res;
if (type >= stat_MAX) {
@@ -148,6 +153,15 @@
u->udps_fullsock;
}
+#ifdef INET6
+ if (sttp->stt_type == stat_RIP6) {
+ r = (struct rip6stat *)sttp->stt_data;
+ r->rip6s_delivered =
+ r->rip6s_ipackets - r->rip6s_badsum - r->rip6s_nosock -
+ r->rip6s_nosockmcast - r->rip6s_fullsock;
+ }
+#endif
+
return (0);
}
==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#50 (text+ko) ====
@@ -1738,6 +1738,20 @@
PIM6_ACC(rcv_badregisters);
PIM6_ACC(snd_registers);
#undef PIM6_ACC
+
+#define RIP6_ACC(field) \
+ STATS_ACCX(u_int64_t,rip6,field,rip6s_##field)
+
+STATS_GET(rip6,RIP6);
+RIP6_ACC(ipackets);
+RIP6_ACC(isum);
+RIP6_ACC(badsum);
+RIP6_ACC(nosock);
+RIP6_ACC(nosockmcast);
+RIP6_ACC(fullsock);
+RIP6_ACC(opackets);
+RIP6_ACC(delivered);
+#undef RIP6_ACC
#endif /* !INET6 */
static const char *icmpnames[ICMP_MAXTYPE + 1] = {
More information about the p4-projects
mailing list