diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2006-06-19 12:06:25 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2006-06-19 12:06:25 +0000 |
commit | 64434f6fe01d61982eff402fff9b850e0db94452 (patch) | |
tree | b1d398a2ac5458fe02f2410092c9cc8ed4c8fc4e | |
parent | 80d52858b15b68a405dfc998c2b41ab54f538b8a (diff) |
if at startup a given group has carpdemote == 0, we don't do carp demotion.
now, once all sessions went to established, we start doing demotion, so
that when one drops and has dmeotion enabled, we actually demote.
ok claudio
-rw-r--r-- | usr.sbin/bgpd/bgpd.8 | 11 | ||||
-rw-r--r-- | usr.sbin/bgpd/carp.c | 7 |
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); } |