summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2006-03-31 17:30:39 +0000
committerclaudio <claudio@openbsd.org>2006-03-31 17:30:39 +0000
commit111ae881f033340efffe0ce7ade8445ecbe225b0 (patch)
treea15e83f2fa8646e47e6ad3db0ab08a83f1a6b815
parentBackout, causes panics (diff)
downloadwireguard-openbsd-111ae881f033340efffe0ce7ade8445ecbe225b0.tar.xz
wireguard-openbsd-111ae881f033340efffe0ce7ade8445ecbe225b0.zip
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.c9
-rw-r--r--sys/sys/socket.h6
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 }, \
}
/*