From 64091a686c4803e6b3afbd4ab844ed833ce82092 Mon Sep 17 00:00:00 2001 From: glebius Date: Thu, 24 Feb 2005 09:05:28 +0000 Subject: Fix problem when master comes up with one interface down, and preempts mastering on all other interfaces: - call carp_carpdev_state() on initialize instead of just setting to INIT - in carp_carpdev_state() check that interface is UP, instead of checking that it is not DOWN, because a rebooted machine may have interface in UNKNOWN state. Sponsored by: Rambler Obtained from: OpenBSD (partially) --- sys/netinet/ip_carp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/netinet') diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 8231f7f..2110a41 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1405,7 +1405,7 @@ carp_set_addr(struct carp_softc *sc, struct sockaddr_in *sin) sc->sc_if.if_flags |= IFF_UP; if (own) sc->sc_advskew = 0; - carp_set_state(sc, INIT); + carp_carpdev_state(cif); carp_setrun(sc, 0); return (0); @@ -1970,7 +1970,7 @@ carp_carpdev_state(void *v) CARP_LOCK(cif); TAILQ_FOREACH(sc, &cif->vhif_vrs, sc_list) { - if (sc->sc_ifp->if_link_state == LINK_STATE_DOWN || + if (sc->sc_ifp->if_link_state != LINK_STATE_UP || !(sc->sc_ifp->if_flags & IFF_UP)) { sc->sc_flags_backup = sc->sc_if.if_flags; sc->sc_if.if_flags &= ~(IFF_UP|IFF_RUNNING); -- cgit v1.1