summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-05-13 08:21:19 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-05-13 08:21:19 +0000
commitc1d2bb97d91dc81b490fc206d5c4462da6dd50cf (patch)
treea86edaa3a841da690f067312d14480da32d87b7f /sys
parent5b33e46b44f72af3ea7fa9557fd0a98cc74328ca (diff)
Act like our advskew is 240 when receiving packets as well as sending if
we're backing off. Makes the backoff actually work like it's supposed to instead of flip-flopping. Problem pointed out by ho@ and jakob@
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_carp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 873f4e65993..a84692b7adc 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.49 2004/05/13 05:49:06 mcbride Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.50 2004/05/13 08:21:18 mcbride Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -519,7 +519,10 @@ carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af)
sc_tv.tv_sec = sc->sc_advbase;
- sc_tv.tv_usec = sc->sc_advskew * 1000000 / 256;
+ if (carp_suppress_preempt && sc->sc_advskew < 240)
+ sc_tv.tv_usec = 240 * 1000000 / 256;
+ else
+ sc_tv.tv_usec = sc->sc_advskew * 1000000 / 256;
ch_tv.tv_sec = ch->carp_advbase;
ch_tv.tv_usec = ch->carp_advskew * 1000000 / 256;
@@ -544,8 +547,7 @@ carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af)
* If we're pre-empting masters who advertise slower than us,
* and this one claims to be slower, treat him as down.
*/
- if (carp_opts[CARPCTL_PREEMPT] && !carp_suppress_preempt
- && timercmp(&sc_tv, &ch_tv, <)) {
+ if (carp_opts[CARPCTL_PREEMPT] && timercmp(&sc_tv, &ch_tv, <)) {
carp_master_down(sc);
break;
}