PERFORCE change 166815 for review

Gabor Pali pgj at FreeBSD.org
Thu Jul 30 17:58:00 UTC 2009


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

Change 166815 by pgj at petymeg-current on 2009/07/30 17:57:22

	Add (optional) support for IPX statistics.

Affected files ...

.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/Makefile#15 edit
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.h#46 edit
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_internal.h#43 edit
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_stat.c#13 edit
.. //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#51 edit

Differences ...

==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/Makefile#15 (text+ko) ====

@@ -26,4 +26,8 @@
 CFLAGS+=    -DINET6
 .endif
 
+.if ${MK_IPX_SUPPORT} != "no"
+CFLAGS+=    -DIPX
+.endif
+
 .include <bsd.lib.mk>

==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat.h#46 (text+ko) ====

@@ -131,6 +131,9 @@
     stat_PIM6,
     stat_RIP6,
 #endif
+#ifdef IPX
+    stat_IPX,
+#endif
     stat_MAX,
     stat_Invalid,
 };
@@ -174,6 +177,9 @@
 struct pim6_stat;
 struct rip6_stat;
 #endif
+#ifdef IPX
+struct ipx_stat;
+#endif
 
 __BEGIN_DECLS
 const char		    *netstat_strerror(int);
@@ -792,4 +798,20 @@
 u_int64_t   netstat_rip6s_get_opackets(const struct rip6_stat *);
 u_int64_t   netstat_rip6s_get_delivered(const struct rip6_stat *);
 #endif /* !INET6 */
+
+#ifdef IPX
+const struct ipx_stat	*netstat_get_ipxstats(const struct stat_type *);
+
+u_int64_t   netstat_ipxs_get_total(const struct ipx_stat *);
+u_int64_t   netstat_ipxs_get_badsum(const struct ipx_stat *);
+u_int64_t   netstat_ipxs_get_tooshort(const struct ipx_stat *);
+u_int64_t   netstat_ipxs_get_toosmall(const struct ipx_stat *);
+u_int64_t   netstat_ipxs_get_forward(const struct ipx_stat *);
+u_int64_t   netstat_ipxs_get_cantforward(const struct ipx_stat *);
+u_int64_t   netstat_ipxs_get_delivered(const struct ipx_stat *);
+u_int64_t   netstat_ipxs_get_localout(const struct ipx_stat *);
+u_int64_t   netstat_ipxs_get_odropped(const struct ipx_stat *);
+u_int64_t   netstat_ipxs_get_noroute(const struct ipx_stat *);
+u_int64_t   netstat_ipxs_get_mtutoosmall(const struct ipx_stat *);
+#endif /* !IPX */
 #endif /* !_NETSTAT_H_ */

==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_internal.h#43 (text+ko) ====

@@ -59,6 +59,9 @@
 #include <netinet6/pim6_var.h>
 #include <netinet6/raw_ip6.h>
 #endif
+#ifdef IPX
+#include <netipx/ipx_var.h>
+#endif
 
 #include "netstat.h"
 
@@ -348,6 +351,12 @@
 };
 #endif
 
+#ifdef IPX
+struct ipx_stat {
+	struct ipxstat s;
+};
+#endif
+
 /* Timestamp type. */
 struct timestamp_type {
 	u_int32_t   ts_sec;

==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_stat.c#13 (text+ko) ====

@@ -42,6 +42,9 @@
 #include <netinet6/pim6_var.h>
 #include <netinet6/raw_ip6.h>
 #endif
+#ifdef IPX
+#include <netipx/ipx_var.h>
+#endif
 
 #include <err.h>
 #include <kvm.h>
@@ -77,6 +80,9 @@
 	{ PIM6STAT_VERSION, "net.inet6.pim.stats", "_pim6stat" },
 	{ RIP6STAT_VERSION, "net.inet6.ip6.rip6stats", "_rip6stat" },
 #endif
+#ifdef IPX
+	{ IPXSTAT_VERSION, "net.ipx.ipx.stats", "_ipxstat" },
+#endif
 };
 
 int

==== //depot/projects/soc2009/pgj_libstat/src/lib/libnetstat/netstat_util.c#51 (text+ko) ====

@@ -1754,6 +1754,25 @@
 #undef RIP6_ACC
 #endif /* !INET6 */
 
+#ifdef IPX
+#define IPX_ACC(field) \
+    STATS_ACCX(u_int64_t,ipx,field,ipxs_##field)
+
+STATS_GET(ipx,IPX);
+IPX_ACC(total);
+IPX_ACC(badsum);
+IPX_ACC(tooshort);
+IPX_ACC(toosmall);
+IPX_ACC(forward);
+IPX_ACC(cantforward);
+IPX_ACC(delivered);
+IPX_ACC(localout);
+IPX_ACC(odropped);
+IPX_ACC(noroute);
+IPX_ACC(mtutoosmall);
+#undef IPX_ACC
+#endif /* !IPX */
+
 static	const char *icmpnames[ICMP_MAXTYPE + 1] = {
 	"echo reply",			/* RFC 792 */
 	"#1",


More information about the p4-projects mailing list