summaryrefslogtreecommitdiff
path: root/ofproto
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2021-06-10 15:49:33 -0700
committerBen Pfaff <blp@ovn.org>2021-07-02 10:59:40 -0700
commit8d7c240835cf116b0c3c0b8413af1f00ca51ba9a (patch)
treefc1f2cc51dcece8ab15c08babd424de63ca25586 /ofproto
parentf686957c9667ae962fb8fc003be2a5482e380d75 (diff)
downloadopenvswitch-8d7c240835cf116b0c3c0b8413af1f00ca51ba9a.tar.gz
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 <blp@ovn.org> Acked-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'ofproto')
-rw-r--r--ofproto/fail-open.c2
1 files changed, 1 insertions, 1 deletions
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 "