summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/bgpd/bgpd.811
-rw-r--r--usr.sbin/bgpd/carp.c7
2 files changed, 13 insertions, 5 deletions
diff --git a/usr.sbin/bgpd/bgpd.8 b/usr.sbin/bgpd/bgpd.8
index e4e08d5f582..a4b83e5a28e 100644
--- a/usr.sbin/bgpd/bgpd.8
+++ b/usr.sbin/bgpd/bgpd.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: bgpd.8,v 1.19 2006/06/17 14:06:09 henning Exp $
+.\" $OpenBSD: bgpd.8,v 1.20 2006/06/19 12:06:24 henning Exp $
.\"
.\" Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
.\"
@@ -77,13 +77,16 @@ Force
.Nm
to do
.Xr carp 4
-demotion when the
+demotion at startup when the
.Em demote
functionality is used.
Normally,
.Nm
-will only do demotion when the demotion counter for the group in question
-is already greater than 0.
+will only do demotion at startup when the demotion counter for the group
+in question is already greater than 0.
+.Nm
+will start handling demotion after all sessions with demotion configured for
+the given group have been successfully established.
At system startup,
.Xr rc 8
has the demotion counter for the group
diff --git a/usr.sbin/bgpd/carp.c b/usr.sbin/bgpd/carp.c
index 70ec4de5d6e..7d619547bff 100644
--- a/usr.sbin/bgpd/carp.c
+++ b/usr.sbin/bgpd/carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: carp.c,v 1.2 2006/06/17 15:54:32 henning Exp $ */
+/* $OpenBSD: carp.c,v 1.3 2006/06/19 12:06:24 henning Exp $ */
/*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@@ -145,6 +145,11 @@ carp_demote_set(char *group, int demote)
return (-1);
c->changed_by += demote;
+
+ /* enable demotion when we return to 0, i. e. all sessions up */
+ if (demote < 0 && c->changed_by == 0)
+ c->do_demote = 1;
+
return (0);
}