summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/parse.y
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2006-06-17 14:06:10 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2006-06-17 14:06:10 +0000
commit905f0a795ad4f269a1639ca6aa9185dca175073b (patch)
tree6997ab4cf67d0b1da3817b83b6c4ba381fa9047f /usr.sbin/bgpd/parse.y
parent86949d29b2fee4476d959b00a51c3d5438a33a4d (diff)
implement carp demotion control for bgpd.
sessions can be configured to modify the carp demotion counter for a given interface group (usually, "carp", which has all carp interfaces) when the session is not established. once the session is established for 60 seconds, the demotion is cleared. this, used correctly, can prevent a bgpd-box which lost all sessions (and thus has no routes) to be carp master, while the backup has sessions. thought through and partially hacked on a drive from calgary to vancouver with ryan, ok claudio
Diffstat (limited to 'usr.sbin/bgpd/parse.y')
-rw-r--r--usr.sbin/bgpd/parse.y23
1 files changed, 21 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index 23981247e33..f163bce7cbd 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.190 2006/05/31 02:16:25 pat Exp $ */
+/* $OpenBSD: parse.y,v 1.191 2006/06/17 14:06:09 henning Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -149,7 +149,7 @@ typedef struct {
%token AS ROUTERID HOLDTIME YMIN LISTEN ON FIBUPDATE
%token RDE EVALUATE IGNORE COMPARE
%token GROUP NEIGHBOR NETWORK
-%token REMOTEAS DESCR LOCALADDR MULTIHOP PASSIVE MAXPREFIX ANNOUNCE
+%token REMOTEAS DESCR LOCALADDR MULTIHOP PASSIVE MAXPREFIX ANNOUNCE DEMOTE
%token ENFORCE NEIGHBORAS CAPABILITIES REFLECTOR DEPEND DOWN SOFTRECONFIG
%token DUMP IN OUT
%token LOG ROUTECOLL TRANSPARENT
@@ -909,6 +909,24 @@ peeropts : REMOTEAS asnumber {
}
free($3);
}
+ | DEMOTE STRING {
+ if (strlcpy(curpeer->conf.demote_group, $2,
+ sizeof(curpeer->conf.demote_group)) >=
+ sizeof(curpeer->conf.demote_group)) {
+ yyerror("demote group name \"%s\" too long: "
+ "max %u", $2,
+ sizeof(curpeer->conf.demote_group) - 1);
+ free($2);
+ YYERROR;
+ }
+ free($2);
+ if (carp_demote_init(curpeer->conf.demote_group,
+ conf->opts & BGPD_OPT_FORCE_DEMOTE) == -1) {
+ yyerror("error initializing group \"%s\"",
+ curpeer->conf.demote_group);
+ YYERROR;
+ }
+ }
| SOFTRECONFIG inout yesno {
if ($2)
curpeer->conf.softreconfig_in = $3;
@@ -1558,6 +1576,7 @@ lookup(char *s)
{ "compare", COMPARE},
{ "connected", CONNECTED},
{ "delete", DELETE},
+ { "demote", DEMOTE},
{ "deny", DENY},
{ "depend", DEPEND},
{ "descr", DESCR},