summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-10-05 18:08:42 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-10-05 18:08:42 +0000
commit1df6369c95b1125ca56d02e07cf19bc329471fee (patch)
tree8e4e5bb5350ed234cc7ada3350b98fa85860e2eb
parentc66403322a3dccd6703411483608df125263840f (diff)
Call ip_output at splsoftnet() when sending advertisements; also don't stop
sending advertisements if we can't tag the mbuf. Problem report and fix from Chris Pascoe, thanks. ok henning@
-rw-r--r--sys/netinet/ip_carp.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index f28eccd1ca3..5c620aae863 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.65 2004/09/18 16:15:53 mcbride Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.66 2004/10/05 18:08:41 mcbride Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -806,7 +806,9 @@ carp_send_ad(void *v)
struct carp_softc *sc = v;
struct carp_header *ch_ptr;
struct mbuf *m;
- int len, advbase, advskew;
+ int len, advbase, advskew, s;
+
+ s = splsoftnet();
/* bow out if we've lost our UPness or RUNNINGuiness */
if ((sc->sc_ac.ac_if.if_flags &
@@ -842,9 +844,7 @@ carp_send_ad(void *v)
sc->sc_ac.ac_if.if_oerrors++;
carpstats.carps_onomem++;
/* XXX maybe less ? */
- if (advbase != 255 || advskew != 255)
- timeout_add(&sc->sc_ad_tmo, tvtohz(&tv));
- return;
+ goto retry_later;
}
len = sizeof(*ip) + sizeof(ch);
m->m_pkthdr.len = len;
@@ -868,7 +868,7 @@ carp_send_ad(void *v)
ch_ptr = (void *)ip + sizeof(*ip);
bcopy(&ch, ch_ptr, sizeof(ch));
if (carp_prepare_ad(m, sc, ch_ptr))
- return;
+ goto retry_later;
m->m_data += sizeof(*ip);
ch_ptr->carp_cksum = carp_cksum(m, len - sizeof(*ip));
@@ -910,9 +910,7 @@ carp_send_ad(void *v)
sc->sc_ac.ac_if.if_oerrors++;
carpstats.carps_onomem++;
/* XXX maybe less ? */
- if (advbase != 255 || advskew != 255)
- timeout_add(&sc->sc_ad_tmo, tvtohz(&tv));
- return;
+ goto retry_later;
}
len = sizeof(*ip6) + sizeof(ch);
m->m_pkthdr.len = len;
@@ -936,7 +934,7 @@ carp_send_ad(void *v)
ch_ptr = (void *)ip6 + sizeof(*ip6);
bcopy(&ch, ch_ptr, sizeof(ch));
if (carp_prepare_ad(m, sc, ch_ptr))
- return;
+ goto retry_later;
m->m_data += sizeof(*ip6);
ch_ptr->carp_cksum = carp_cksum(m, len - sizeof(*ip6));
@@ -970,6 +968,8 @@ carp_send_ad(void *v)
}
#endif /* INET6 */
+retry_later:
+ splx(s);
if (advbase != 255 || advskew != 255)
timeout_add(&sc->sc_ad_tmo, tvtohz(&tv));
}