From 8d7c240835cf116b0c3c0b8413af1f00ca51ba9a Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 10 Jun 2021 15:49:33 -0700 Subject: fail-open: Only fail open if we've been disconnected for at least 1 s. The 'last_disconn_secs' member determines whether we're currently in fail-open mode (see fail_open_is_active()), but before this commit, fail_open_run() could decide to enter fail-open mode even if that would set 'last_disconn_secs' to 0 (and thus not really enter it). This could lead to an endless stream of log messages about entering fail-open mode, none of which actually does anything. This fixes the problem. (This patch worries me because this functionality has been stable and unchanged for many years and I wonder how something so simple is broken.) Signed-off-by: Ben Pfaff Acked-by: Ilya Maximets --- ofproto/fail-open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ofproto') diff --git a/ofproto/fail-open.c b/ofproto/fail-open.c index 5b105ba88..34b398eca 100644 --- a/ofproto/fail-open.c +++ b/ofproto/fail-open.c @@ -180,7 +180,7 @@ fail_open_run(struct fail_open *fo) int disconn_secs = connmgr_failure_duration(fo->connmgr); /* Enter fail-open mode if 'fo' is not in it but should be. */ - if (disconn_secs >= trigger_duration(fo)) { + if (disconn_secs > 0 && disconn_secs >= trigger_duration(fo)) { if (!fail_open_is_active(fo)) { VLOG_WARN("Could not connect to controller (or switch failed " "controller's post-connection admission control " -- cgit v1.2.1