diff options
author | 2011-04-21 14:55:22 +0000 | |
---|---|---|
committer | 2011-04-21 14:55:22 +0000 | |
commit | 82baf71d3a0ff43e57453094674194115fa86b43 (patch) | |
tree | 1b2954c86bb300fe65745e16d94cc44f7a8f5060 /usr.sbin/snmpd/kroute.c | |
parent | Make this code actually compile on hppa64. (diff) | |
download | wireguard-openbsd-82baf71d3a0ff43e57453094674194115fa86b43.tar.xz wireguard-openbsd-82baf71d3a0ff43e57453094674194115fa86b43.zip |
Add a "filter-routes" option; when set, snmpd asks the kernel not to
send route updates. If you aren't interested in examining routing tables
over SNMP (e.g. if you only use it for sensors or interface stats) this
reduces cpu use during heavy route updates. Makes my full-table bgp
routers happier when a major peer bounces. ok reyk@
Diffstat (limited to 'usr.sbin/snmpd/kroute.c')
-rw-r--r-- | usr.sbin/snmpd/kroute.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/snmpd/kroute.c b/usr.sbin/snmpd/kroute.c index 006453c6ac4..d5e3b100cf6 100644 --- a/usr.sbin/snmpd/kroute.c +++ b/usr.sbin/snmpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.16 2011/03/07 07:43:02 henning Exp $ */ +/* $OpenBSD: kroute.c,v 1.17 2011/04/21 14:55:22 sthen Exp $ */ /* * Copyright (c) 2007, 2008 Reyk Floeter <reyk@vantronix.net> @@ -45,6 +45,8 @@ #include "snmpd.h" +extern struct snmpd *env; + struct { struct event ks_ev; u_long ks_iflastchange; @@ -160,6 +162,10 @@ kr_init(void) &opt, sizeof(opt)) == -1) log_warn("kr_init: setsockopt"); /* not fatal */ + if (env->sc_rtfilter && setsockopt(kr_state.ks_fd, PF_ROUTE, + ROUTE_MSGFILTER, &env->sc_rtfilter, sizeof(env->sc_rtfilter)) == -1) + log_warn("kr_init: setsockopt(ROUTE_MSGFILTER)"); + /* grow receive buffer, don't wanna miss messages */ optlen = sizeof(default_rcvbuf); if (getsockopt(kr_state.ks_fd, SOL_SOCKET, SO_RCVBUF, |