From 7972c979c5c2885a94e5e0a488ec1edf23ecd457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=C3=A7i?= Date: Mon, 14 Jul 2008 20:11:51 +0000 Subject: [PATCH] Fix carp(4) panics that can occur during carp interface configuration. Approved by: mlaier (mentor) Reported by: Scott Ullrich MFC after: 1 week --- sys/netinet/ip_carp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index ecfe53149b02..69fea3f5c0e6 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1464,7 +1464,11 @@ carp_set_addr(struct carp_softc *sc, struct sockaddr_in *sin) carp_set_state(sc, INIT); if (sc->sc_naddrs) SC2IFP(sc)->if_flags |= IFF_UP; + if (sc->sc_carpdev) + CARP_SCLOCK(sc); carp_setrun(sc, 0); + if (sc->sc_carpdev) + CARP_SCUNLOCK(sc); return (0); } @@ -1625,7 +1629,11 @@ carp_set_addr6(struct carp_softc *sc, struct sockaddr_in6 *sin6) carp_set_state(sc, INIT); if (sc->sc_naddrs6) SC2IFP(sc)->if_flags |= IFF_UP; + if (sc->sc_carpdev) + CARP_SCLOCK(sc); carp_setrun(sc, 0); + if (sc->sc_carpdev) + CARP_SCUNLOCK(sc); return (0); }