From patchwork Thu Jun 10 22:49:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1490669 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G1K1C4JP5z9sVm for ; Fri, 11 Jun 2021 08:49:51 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 518A560AB2; Thu, 10 Jun 2021 22:49:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rSRIEuU-To21; Thu, 10 Jun 2021 22:49:46 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id CDEE0605CA; Thu, 10 Jun 2021 22:49:45 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 88460C000E; Thu, 10 Jun 2021 22:49:45 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id C8D20C000B for ; Thu, 10 Jun 2021 22:49:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id AB27D4041D for ; Thu, 10 Jun 2021 22:49:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GTcTcCXwT1AR for ; Thu, 10 Jun 2021 22:49:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by smtp2.osuosl.org (Postfix) with ESMTPS id 9176040202 for ; Thu, 10 Jun 2021 22:49:41 +0000 (UTC) Received: (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id DC91A40004; Thu, 10 Jun 2021 22:49:37 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 10 Jun 2021 15:49:33 -0700 Message-Id: <20210610224934.2200271-1-blp@ovn.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 1/2] fail-open: Only fail open if we've been disconnected for at least 1 s. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" 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(-) diff --git a/ofproto/fail-open.c b/ofproto/fail-open.c index 5b105ba880a3..34b398ecae30 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 " From patchwork Thu Jun 10 22:49:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1490670 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G1K1H1Zk6z9sVm for ; Fri, 11 Jun 2021 08:49:55 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id E69E54056B; Thu, 10 Jun 2021 22:49:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lgpb3U4euA7j; Thu, 10 Jun 2021 22:49:49 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 23D0C40522; Thu, 10 Jun 2021 22:49:48 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 72F5FC0027; Thu, 10 Jun 2021 22:49:46 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id C87AEC000B for ; Thu, 10 Jun 2021 22:49:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id AB6ED403FB for ; Thu, 10 Jun 2021 22:49:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id niFOVVe-Ls9h for ; Thu, 10 Jun 2021 22:49:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by smtp2.osuosl.org (Postfix) with ESMTPS id A4837403B0 for ; Thu, 10 Jun 2021 22:49:41 +0000 (UTC) Received: (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 381FB40002; Thu, 10 Jun 2021 22:49:38 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 10 Jun 2021 15:49:34 -0700 Message-Id: <20210610224934.2200271-2-blp@ovn.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610224934.2200271-1-blp@ovn.org> References: <20210610224934.2200271-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 2/2] bridge: Only an inactivity_probe of 0 should turn off inactivity probes. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The documentation for inactivity_probe says this: inactivity_probe: optional integer Maximum number of milliseconds of idle time on connec‐ tion to controller before sending an inactivity probe message. If Open vSwitch does not communicate with the controller for the specified number of seconds, it will send a probe. If a response is not received for the same additional amount of time, Open vSwitch assumes the con‐ nection has been broken and attempts to reconnect. De‐ fault is implementation-specific. A value of 0 disables inactivity probes. This means that a value of 0 should disable inactivity probes and any other value should be in milliseconds. The code in bridge.c was actually interpreting it as any value between 0 and 999 disabling inactivity probes. That was surprising when I accidentally configured it to 5 or to 10, not remembering that it was in milliseconds, and disabled them entirely. This fixes the problem. Signed-off-by: Ben Pfaff --- vswitchd/bridge.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 5ed7e8234354..9c1ee3cf06fe 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -3965,8 +3965,10 @@ bridge_configure_remotes(struct bridge *br, *oc = (struct ofproto_controller) { .type = get_controller_ofconn_type(c->target, c->type), .max_backoff = c->max_backoff ? *c->max_backoff / 1000 : 8, - .probe_interval = (c->inactivity_probe - ? *c->inactivity_probe / 1000 : 5), + .probe_interval = (!c->inactivity_probe ? 5 + : !*c->inactivity_probe ? 0 + : *c->inactivity_probe < 1000 ? 1 + : *c->inactivity_probe / 1000), .band = ((!c->connection_mode || !strcmp(c->connection_mode, "in-band")) && !disable_in_band