diff options
author | mcbride <mcbride@openbsd.org> | 2006-06-02 20:09:43 +0000 |
---|---|---|
committer | mcbride <mcbride@openbsd.org> | 2006-06-02 20:09:43 +0000 |
commit | 9945a12e699d4086ee532d8a97f7f43e818353e0 (patch) | |
tree | cf754656ca36fb048e71bc3bebbd37b5a4b5318c /usr.sbin/sasyncd/conf.y | |
parent | Implement power hook (without looking at the capabilities yet). (diff) | |
download | wireguard-openbsd-9945a12e699d4086ee532d8a97f7f43e818353e0.tar.xz wireguard-openbsd-9945a12e699d4086ee532d8a97f7f43e818353e0.zip |
Make sasyncd fail back correctly with carp preemption enabled.
Hold the carp demotion when booting, to prevent carp from preempting until
we've sync'd with our peers. This adds a new CTL_ENDSNAP message to the
exchange between the sasync daemons to indicate when the complete snapshot
has been sent. Undemote after 60 seconds, or when recieve a CTL_ENDSNAP from
all our peers.
Syntax is slightly changed, removing the 'carp' keyword (so do
"interface carp0" rather than "carp interface carp0". Adds 'group <ifgroup>',
defaults to the 'carp' group.
ok moritz@
Diffstat (limited to 'usr.sbin/sasyncd/conf.y')
-rw-r--r-- | usr.sbin/sasyncd/conf.y | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/usr.sbin/sasyncd/conf.y b/usr.sbin/sasyncd/conf.y index 51108fd5293..b8d6de3a418 100644 --- a/usr.sbin/sasyncd/conf.y +++ b/usr.sbin/sasyncd/conf.y @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.y,v 1.9 2006/06/01 22:43:12 mcbride Exp $ */ +/* $OpenBSD: conf.y,v 1.10 2006/06/02 20:09:43 mcbride Exp $ */ /* * Copyright (c) 2005 Håkan Olsson. All rights reserved. @@ -57,9 +57,9 @@ void yyerror(const char *); int val; } -%token MODE CARP INTERFACE INTERVAL LISTEN ON PORT PEER SHAREDKEY +%token MODE INTERFACE INTERVAL LISTEN ON PORT PEER SHAREDKEY %token Y_SLAVE Y_MASTER INET INET6 FLUSHMODE STARTUP NEVER SYNC -%token SKIPSLAVE +%token GROUP SKIPSLAVE %token <string> STRING %token <val> VALUE %type <val> af port mode flushmode @@ -102,12 +102,21 @@ flushmode : STARTUP { $$ = FM_STARTUP; } | SYNC { $$ = FM_SYNC; } ; -setting : CARP INTERFACE STRING +setting : INTERFACE STRING { if (cfgstate.carp_ifname) free(cfgstate.carp_ifname); - cfgstate.carp_ifname = $3; - log_msg(2, "config: carp interface %s", $3); + cfgstate.carp_ifname = $2; + log_msg(2, "config: interface %s", + cfgstate.carp_ifname); + } + | GROUP STRING + { + if (cfgstate.carp_ifgroup) + free(cfgstate.carp_ifgroup); + cfgstate.carp_ifgroup = $2; + log_msg(2, "config: group %s", + cfgstate.carp_ifgroup); } | FLUSHMODE flushmode { @@ -140,6 +149,7 @@ setting : CARP INTERFACE STRING peer->name = $2; } LIST_INSERT_HEAD(&cfgstate.peerlist, peer, link); + cfgstate.peercnt++; log_msg(2, "config: add peer %s", peer->name); } | LISTEN ON STRING af port @@ -193,8 +203,8 @@ match(char *token) { /* Sorted */ static const struct keyword keywords[] = { - { "carp", CARP }, { "flushmode", FLUSHMODE }, + { "group", GROUP }, { "inet", INET }, { "inet6", INET6 }, { "interface", INTERFACE }, @@ -322,6 +332,9 @@ conf_parse_file(char *cfgfile) r = yyparse(); free(buf); + if (!cfgstate.carp_ifgroup) + cfgstate.carp_ifgroup = strdup("carp"); + return r; bad: |