PERFORCE change 166879 for review
Gabor Pali
pgj at FreeBSD.org
Fri Jul 31 22:07:51 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=166879
Change 166879 by pgj at petymeg-current on 2009/07/31 22:07:36
- Standardize forwarding statistics.
- Add header.
- Merge rttrash into struct rtstat for the ease of use.
Affected files ...
.. //depot/projects/soc2009/pgj_libstat/src/sys/net/route.c#2 edit
.. //depot/projects/soc2009/pgj_libstat/src/sys/net/route.h#2 edit
Differences ...
==== //depot/projects/soc2009/pgj_libstat/src/sys/net/route.c#2 (text+ko) ====
@@ -90,8 +90,18 @@
TUNABLE_INT("net.add_addr_allfibs", &rt_add_addr_allfibs);
#ifdef VIMAGE_GLOBALS
+static struct stat_header rtstat_header = {
+ .sth_version = RTSTAT_VERSION,
+ .sth_len = sizeof(struct rtstat)
+};
static struct rtstat rtstat;
+SYSCTL_STRUCT(_net_inet_ip, OID_AUTO, rtstat, CTLFLAG_RW, &rtstat, rtstat,
+ "IPv4 Forwarding Statistics (struct rtstat, net/route.h)");
+
+SYSCTL_STRUCT(_net_inet_ip, OID_AUTO, rtstat_header, CTLFLAG_RD, &rtstat_header,
+ stat_header, "IPv4 Forwarding Statistics header");
+
/* by default only the first 'row' of tables will be accessed. */
/*
* XXXMRT When we fix netstat, and do this differnetly,
@@ -101,7 +111,7 @@
*/
struct radix_node_head *rt_tables[RT_MAXFIBS][AF_MAX+1];
-static int rttrash; /* routes not in table but not freed */
+#define rttrash rtstat.rts_trash
#endif
static void rt_maskedcopy(struct sockaddr *,
@@ -460,7 +470,7 @@
INIT_VNET_NET(curvnet);
struct rtentry *rt, *rt0 = NULL;
int error = 0;
- short *stat = NULL;
+ u_int64_t *stat = NULL;
struct rt_addrinfo info;
struct ifaddr *ifa;
struct radix_node_head *rnh =
==== //depot/projects/soc2009/pgj_libstat/src/sys/net/route.h#2 (text+ko) ====
@@ -210,12 +210,15 @@
/*
* Routing statistics.
*/
+#define RTSTAT_VERSION 0x00000001
+
struct rtstat {
- short rts_badredirect; /* bogus redirect calls */
- short rts_dynamic; /* routes created by redirects */
- short rts_newgateway; /* routes modified by redirects */
- short rts_unreach; /* lookups which failed */
- short rts_wildcard; /* lookups satisfied by a wildcard */
+ u_int64_t rts_badredirect; /* bogus redirect calls */
+ u_int64_t rts_dynamic; /* routes created by redirects */
+ u_int64_t rts_newgateway; /* routes modified by redirects */
+ u_int64_t rts_unreach; /* lookups which failed */
+ u_int64_t rts_wildcard; /* lookups satisfied by a wildcard */
+ u_int64_t rts_trash; /* routes not in table but not freed */
};
/*
* Structures for routing messages.
More information about the p4-projects
mailing list