diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-03-31 17:30:40 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-03-31 17:30:40 +0000 |
commit | 5e8affbf81c49d60dac7c01e8d7e4932594dd87d (patch) | |
tree | ccb187c436feeed43376858fe9f70f1a4fc75dce | |
parent | 34d7f43fc5c799e366d7e64254ce09b7109e90af (diff) |
Add sysctl to retrieve the routing table statisitcs. Will be used by netstat
instead of kvm access. OK henning@
-rw-r--r-- | sys/net/rtsock.c | 9 | ||||
-rw-r--r-- | sys/sys/socket.h | 6 |
2 files changed, 12 insertions, 3 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 56c7a20579f..05d1ac7b2ee 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.56 2006/03/30 09:53:43 claudio Exp $ */ +/* $OpenBSD: rtsock.c,v 1.57 2006/03/31 17:30:39 claudio Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -916,6 +916,13 @@ sysctl_rtable(int *name, u_int namelen, void *where, size_t *given, void *new, case NET_RT_IFLIST: error = sysctl_iflist(af, &w); + break; + + case NET_RT_STATS: + error = sysctl_rdstruct(where, given, new, + &rtstat, sizeof(rtstat)); + splx(s); + return (error); } splx(s); if (w.w_tmem) diff --git a/sys/sys/socket.h b/sys/sys/socket.h index 2ef396b5947..e42d62a5975 100644 --- a/sys/sys/socket.h +++ b/sys/sys/socket.h @@ -1,4 +1,4 @@ -/* $OpenBSD: socket.h,v 1.52 2005/05/27 04:55:28 mcbride Exp $ */ +/* $OpenBSD: socket.h,v 1.53 2006/03/31 17:30:39 claudio Exp $ */ /* $NetBSD: socket.h,v 1.14 1996/02/09 18:25:36 christos Exp $ */ /* @@ -297,13 +297,15 @@ struct sockcred { #define NET_RT_DUMP 1 /* dump; may limit to a.f. */ #define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */ #define NET_RT_IFLIST 3 /* survey interface list */ -#define NET_RT_MAXID 4 +#define NET_RT_STATS 4 /* routing table statistics */ +#define NET_RT_MAXID 5 #define CTL_NET_RT_NAMES { \ { 0, 0 }, \ { "dump", CTLTYPE_STRUCT }, \ { "flags", CTLTYPE_STRUCT }, \ { "iflist", CTLTYPE_STRUCT }, \ + { "stats", CTLTYPE_STRUCT }, \ } /* |