summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_carp.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2010-08-08 07:04:27 +0000
committerdelphij <delphij@FreeBSD.org>2010-08-08 07:04:27 +0000
commit12ac3fbc61fb79a7e4d969bf782c060cd52de965 (patch)
treebe6fb1246b9025781a0f9833699863f56a0ed8ca /sys/netinet/ip_carp.c
parent4ef889a3dccbe3e90b3031e74b9c7461c1b339ca (diff)
downloadFreeBSD-src-12ac3fbc61fb79a7e4d969bf782c060cd52de965.zip
FreeBSD-src-12ac3fbc61fb79a7e4d969bf782c060cd52de965.tar.gz
Address an edge condition that we found at work, where the carp(4)
interface goes to issue LINK_UP, then LINK_DOWN, then LINK_UP at cold boot. This behavior is not observed when carp(4) interface is created slightly later, when the underlying interface is fully up. Before this change what happen at boot is roughly: - ifconfig creates em0 interface; - ifconfig clones a carp device using em0; (em0's link state is DOWN at this point) - carp state: INIT -> BACKUP [*] - carp state: BACKUP -> MASTER - [Some negotiate between em0 and switch] - em0 kicks up link state change event (em0's link state is now up DOWN at this point) - do_link_state_change() -> carp_carpdev_state() - carp state: MASTER -> INIT (via carp_set_state(sc, INIT)) [+] - carp state: INIT -> BACKUP - carp state: BACKUP -> MASTER At the [*] stage, em0 did not received any broadcast message from other node, and assume our node is the master, thus carp(4) sets the link state to "UP" after becoming a master. At [+], the master status is forcely set to "INIT", then an election is casted, after which our node would actually become a master. We believe that at the [*] stage, the master status should remain as "INIT" since the underlying parent interface's link state is not up. Obtained from: iXsystems, Inc. Reported by: jpaetzel MFC after: 2 months
Diffstat (limited to 'sys/netinet/ip_carp.c')
-rw-r--r--sys/netinet/ip_carp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 433c0f0..743a901 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1369,7 +1369,8 @@ carp_setrun(struct carp_softc *sc, sa_family_t af)
CARP_SCLOCK_ASSERT(sc);
if (SC2IFP(sc)->if_flags & IFF_UP &&
- sc->sc_vhid > 0 && (sc->sc_naddrs || sc->sc_naddrs6))
+ sc->sc_vhid > 0 && (sc->sc_naddrs || sc->sc_naddrs6) &&
+ sc->sc_carpdev->if_link_state == LINK_STATE_UP)
SC2IFP(sc)->if_drv_flags |= IFF_DRV_RUNNING;
else {
SC2IFP(sc)->if_drv_flags &= ~IFF_DRV_RUNNING;
OpenPOWER on IntegriCloud