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)
This commit is contained in:
glebius 2005-02-24 09:05:28 +00:00
parent ba363997fb
commit 64091a686c

View File

@ -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);