summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sasyncd
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2009-06-25 18:50:22 +0000
committersthen <sthen@openbsd.org>2009-06-25 18:50:22 +0000
commit2fd832fa9c8801dce33b09b950d90ed16e553eee (patch)
treeb4ac3c4ee51fad4a2791bda4c313b152408538ba /usr.sbin/sasyncd
parentfix the function name in log_warn() text, it was borrowed from some (diff)
downloadwireguard-openbsd-2fd832fa9c8801dce33b09b950d90ed16e553eee.tar.xz
wireguard-openbsd-2fd832fa9c8801dce33b09b950d90ed16e553eee.zip
sasyncd isn't interested in messages on the routing socket other than
RTM_IFINFO to monitor the state of carp(4) interfaces; programme the filter on the socket accordingly so it doesn't have to handle other message types. ok henning@
Diffstat (limited to 'usr.sbin/sasyncd')
-rw-r--r--usr.sbin/sasyncd/carp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/sasyncd/carp.c b/usr.sbin/sasyncd/carp.c
index de876c0ea6f..980ee84e314 100644
--- a/usr.sbin/sasyncd/carp.c
+++ b/usr.sbin/sasyncd/carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: carp.c,v 1.8 2006/11/28 19:21:15 reyk Exp $ */
+/* $OpenBSD: carp.c,v 1.9 2009/06/25 18:50:22 sthen Exp $ */
/*
* Copyright (c) 2005 Håkan Olsson. All rights reserved.
@@ -225,6 +225,7 @@ int
carp_init(void)
{
cfgstate.route_socket = -1;
+ unsigned int rtfilter;
if (cfgstate.lockedstate != INIT) {
cfgstate.runstate = cfgstate.lockedstate;
@@ -250,6 +251,11 @@ carp_init(void)
return -1;
}
+ rtfilter = ROUTE_FILTER(RTM_IFINFO);
+ if (setsockopt(cfgstate.route_socket, PF_ROUTE, ROUTE_MSGFILTER,
+ &rtfilter, sizeof(rtfilter)) == -1) /* not fatal */
+ log_msg(2, "carp_init: setsockopt");
+
cfgstate.runstate = carp_get_state(cfgstate.carp_ifname);
if (cfgstate.runstate == FAIL) {
fprintf(stderr, "Failed to check interface \"%s\".\n",