summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2003-10-27 20:58:00 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2003-10-27 20:58:00 +0000
commitc4bb120d27c0dcb6d9a68fe02253400287f5dff4 (patch)
treebe60e2b17f829e327988ef461f32b0fadc498877 /sys
parent20f0612220e978b00cea0129c38f6cc83ccd80ed (diff)
Skew the advertisement interval correctly when we reschedule.
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_carp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 80bccfda4aa..42e0385a28b 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.10 2003/10/27 06:23:57 mcbride Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.11 2003/10/27 20:57:59 mcbride Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -527,6 +527,7 @@ carp_ifdetach(struct ifnet *ifp)
void
carp_send_ad(void *v)
{
+ struct timeval tv;
struct carp_softc *sc = v;
struct carp_header *ch;
struct mbuf *m;
@@ -542,6 +543,8 @@ carp_send_ad(void *v)
} else {
advbase = sc->sc_advbase;
advskew = sc->sc_advskew;
+ tv.tv_sec = advbase;
+ tv.tv_usec = advskew * 1000000 / 256;
}
carpstats.carps_opackets++;
@@ -553,7 +556,7 @@ carp_send_ad(void *v)
carpstats.carps_onomem++;
/* XXX maybe less ? */
if (advbase != 255 || advskew != 255)
- timeout_add(&sc->sc_ad_tmo, hz * sc->sc_advbase);
+ timeout_add(&sc->sc_ad_tmo, tvtohz(&tv));
return;
}
len = sizeof(*ip) + sizeof(*ch);
@@ -623,7 +626,7 @@ carp_send_ad(void *v)
sc->sc_ac.ac_if.if_oerrors++;
if (advbase != 255 || advskew != 255)
- timeout_add(&sc->sc_ad_tmo, hz * sc->sc_advbase);
+ timeout_add(&sc->sc_ad_tmo, tvtohz(&tv));
}
/*