Module Name: src
Committed By: christos
Date: Wed May 27 21:32:31 UTC 2009
Modified Files:
src/sys/netinet: ip_carp.c
Log Message:
PR/38260: Brian Seklecki: Improve carp logging.
To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/netinet/ip_carp.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/netinet/ip_carp.c
diff -u src/sys/netinet/ip_carp.c:1.36 src/sys/netinet/ip_carp.c:1.37
--- src/sys/netinet/ip_carp.c:1.36 Tue May 12 18:01:20 2009
+++ src/sys/netinet/ip_carp.c Wed May 27 17:32:31 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_carp.c,v 1.36 2009/05/12 22:01:20 elad Exp $ */
+/* $NetBSD: ip_carp.c,v 1.37 2009/05/27 21:32:31 christos Exp $ */
/* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */
/*
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.36 2009/05/12 22:01:20 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.37 2009/05/27 21:32:31 christos Exp $");
/*
* TODO:
@@ -697,6 +697,7 @@
if (timercmp(&sc_tv, &ch_tv, >) ||
timercmp(&sc_tv, &ch_tv, ==)) {
callout_stop(&sc->sc_ad_tmo);
+ CARP_LOG(sc, "MASTER -> BACKUP (more frequent advertisement received)");
carp_set_state(sc, BACKUP);
carp_setrun(sc, 0);
carp_setroute(sc, RTM_DELETE);
@@ -708,6 +709,7 @@
* and this one claims to be slower, treat him as down.
*/
if (carp_opts[CARPCTL_PREEMPT] && timercmp(&sc_tv, &ch_tv, <)) {
+ CARP_LOG(sc, "BACKUP -> MASTER (preempting a slower master)");
carp_master_down(sc);
break;
}
@@ -719,6 +721,7 @@
*/
sc_tv.tv_sec = sc->sc_advbase * 3;
if (timercmp(&sc_tv, &ch_tv, <)) {
+ CARP_LOG(sc, "BACKUP -> MASTER (master timed out)")
carp_master_down(sc);
break;
}
@@ -1388,6 +1391,7 @@
case MASTER:
break;
case BACKUP:
+ CARP_LOG(sc, "INIT -> MASTER (preempting)");
carp_set_state(sc, MASTER);
carp_send_ad(sc);
carp_send_arp(sc);
@@ -2052,9 +2056,12 @@
void
carp_set_state(struct carp_softc *sc, int state)
{
+ static const char *carp_states[] = { CARP_STATES };
if (sc->sc_state == state)
return;
+ CARP_LOG(sc, ("state transition from: %s -> to: %s", carp_states[sc->sc_state], carp_states[state]));
+
sc->sc_state = state;
switch (state) {
case BACKUP: