summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_carp.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2012-09-29 05:52:19 +0000
committerglebius <glebius@FreeBSD.org>2012-09-29 05:52:19 +0000
commita16cfb34638e2570daa4d1d19c1ba218fc8aae99 (patch)
tree283bd2eb7a21132d328c4f1f3c9ce88996f5a2a2 /sys/netinet/ip_carp.c
parente094bc67f532bc4f9b7a97479288f80cab564f2e (diff)
downloadFreeBSD-src-a16cfb34638e2570daa4d1d19c1ba218fc8aae99.zip
FreeBSD-src-a16cfb34638e2570daa4d1d19c1ba218fc8aae99.tar.gz
carp_send_ad() should never return without rescheduling next run.
Diffstat (limited to 'sys/netinet/ip_carp.c')
-rw-r--r--sys/netinet/ip_carp.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index bc1cc30..a5e766a 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -771,10 +771,7 @@ carp_send_ad_locked(struct carp_softc *sc)
MGETHDR(m, M_NOWAIT, MT_HEADER);
if (m == NULL) {
CARPSTATS_INC(carps_onomem);
- /* XXX maybe less ? */
- callout_reset(&sc->sc_ad_tmo, tvtohz(&tv),
- carp_send_ad, sc);
- return;
+ goto resched;
}
len = sizeof(*ip) + sizeof(ch);
m->m_pkthdr.len = len;
@@ -807,7 +804,7 @@ carp_send_ad_locked(struct carp_softc *sc)
ch_ptr = (struct carp_header *)(&ip[1]);
bcopy(&ch, ch_ptr, sizeof(ch));
if (carp_prepare_ad(m, sc, ch_ptr))
- return;
+ goto resched;
m->m_data += sizeof(*ip);
ch_ptr->carp_cksum = carp_cksum(m, len - sizeof(*ip));
@@ -842,10 +839,7 @@ carp_send_ad_locked(struct carp_softc *sc)
MGETHDR(m, M_NOWAIT, MT_HEADER);
if (m == NULL) {
CARPSTATS_INC(carps_onomem);
- /* XXX maybe less ? */
- callout_reset(&sc->sc_ad_tmo, tvtohz(&tv),
- carp_send_ad, sc);
- return;
+ goto resched;
}
len = sizeof(*ip6) + sizeof(ch);
m->m_pkthdr.len = len;
@@ -877,13 +871,13 @@ carp_send_ad_locked(struct carp_softc *sc)
if (in6_setscope(&ip6->ip6_dst, sc->sc_carpdev, NULL) != 0) {
m_freem(m);
CARP_DEBUG("%s: in6_setscope failed\n", __func__);
- return;
+ goto resched;
}
ch_ptr = (struct carp_header *)(&ip6[1]);
bcopy(&ch, ch_ptr, sizeof(ch));
if (carp_prepare_ad(m, sc, ch_ptr))
- return;
+ goto resched;
m->m_data += sizeof(*ip6);
ch_ptr->carp_cksum = carp_cksum(m, len - sizeof(*ip6));
@@ -913,6 +907,7 @@ carp_send_ad_locked(struct carp_softc *sc)
}
#endif /* INET6 */
+resched:
callout_reset(&sc->sc_ad_tmo, tvtohz(&tv), carp_send_ad, sc);
}
OpenPOWER on IntegriCloud