Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153334639
D33536.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D33536.diff
View Options
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -854,6 +854,13 @@
carp_send_ad_error(struct carp_softc *sc, int error)
{
+ /*
+ * We track errors and successfull sends with this logic:
+ * - Any error resets success counter to 0.
+ * - MAX_ERRORS triggers demotion.
+ * - MIN_SUCCESS successes resets error counter to 0.
+ * - MIN_SUCCESS reverts demotion, if it was triggered before.
+ */
if (error) {
if (sc->sc_sendad_errors < INT_MAX)
sc->sc_sendad_errors++;
@@ -865,17 +872,17 @@
carp_demote_adj(V_carp_senderr_adj, msg);
}
sc->sc_sendad_success = 0;
- } else {
- if (sc->sc_sendad_errors >= CARP_SENDAD_MAX_ERRORS &&
- ++sc->sc_sendad_success >= CARP_SENDAD_MIN_SUCCESS) {
- static const char fmt[] = "send ok on %s";
- char msg[sizeof(fmt) + IFNAMSIZ];
-
- sprintf(msg, fmt, sc->sc_carpdev->if_xname);
- carp_demote_adj(-V_carp_senderr_adj, msg);
- sc->sc_sendad_errors = 0;
- } else
+ } else if (sc->sc_sendad_errors > 0) {
+ if (++sc->sc_sendad_success >= CARP_SENDAD_MIN_SUCCESS) {
+ if (sc->sc_sendad_errors >= CARP_SENDAD_MAX_ERRORS) {
+ static const char fmt[] = "send ok on %s";
+ char msg[sizeof(fmt) + IFNAMSIZ];
+
+ sprintf(msg, fmt, sc->sc_carpdev->if_xname);
+ carp_demote_adj(-V_carp_senderr_adj, msg);
+ }
sc->sc_sendad_errors = 0;
+ }
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 21, 1:31 PM (2 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31913143
Default Alt Text
D33536.diff (1 KB)
Attached To
Mode
D33536: Fix carp being unable to recover from demotion due to send errors
Attached
Detach File
Event Timeline
Log In to Comment