From patchwork Wed Jun 2 09:47:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 1844 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.27.255.51]) by backend30.mail.ord1d.rsapps.net with LMTP id 8AbHI7ngt2AXEwAAIUCqbw (envelope-from ) for ; Wed, 02 Jun 2021 15:49:13 -0400 Received: from proxy16.mail.iad3a.rsapps.net ([172.27.255.51]) by director8.mail.ord1d.rsapps.net with LMTP id gKSUI7ngt2AedwAAfY0hYg (envelope-from ) for ; Wed, 02 Jun 2021 15:49:13 -0400 Received: from smtp23.gate.iad3a ([172.27.255.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy16.mail.iad3a.rsapps.net with LMTPS id +LsZHrngt2AjFAAADc5QwQ (envelope-from ) for ; Wed, 02 Jun 2021 15:49:13 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp23.gate.iad3a.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dkim=fail (signature verification failed) header.d=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: 9aa16518-c3db-11eb-a92e-52540033eb40-1-1 Received: from [216.105.38.7] ([216.105.38.7:35064] helo=lists.sourceforge.net) by smtp23.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 58/6B-18044-9B0E7B06; Wed, 02 Jun 2021 15:49:13 -0400 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1loWqP-000095-0M; Wed, 02 Jun 2021 19:48:01 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1loWqN-00008r-3l for openvpn-devel@lists.sourceforge.net; Wed, 02 Jun 2021 19:47:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=5SSjhkPw8xL7bMp5tr0YqEE3RQBKLdqb5WoWnbaDWQM=; b=JWgU9dSWZIhewh15s0SDQNSsFs BCiukvGl254BdXaaNC7kP2iz++mHQBOamB0ZKMpbqj76rvL4DpIfrpykfHFM7yknXgunVS/gih9tk uT/ZFC1/WiRgbRXP9YB4bDrP5aqIBZ0fS8C0WQLW5yaN+4EOWSWS8v1Kd3kQtXheUD60=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=5SSjhkPw8xL7bMp5tr0YqEE3RQBKLdqb5WoWnbaDWQM=; b=K BVH6Rjxj5ScogdmdtwNEcjqnCDnU09UKQYa8kG0hnHZjpb4NIwuXXWCeyAAdlFrPiE7l7VHvXjHyI ceVnQmDWGg7EaWBFJG/hukeNXv8JTvht1BVXEMB3tRBdNffu/B5MxvR4Lh89jRnYwOwfX95+TsWNs nFE6P4zKjg1YG8xQ=; Received: from mail-il1-f175.google.com ([209.85.166.175]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.3) id 1loWqE-007oBp-Sz for openvpn-devel@lists.sourceforge.net; Wed, 02 Jun 2021 19:48:00 +0000 Received: by mail-il1-f175.google.com with SMTP id r6so3291483ilj.1 for ; Wed, 02 Jun 2021 12:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5SSjhkPw8xL7bMp5tr0YqEE3RQBKLdqb5WoWnbaDWQM=; b=a4M12pZim/ozIxZ5SoxPltpFx5P8iXaNGiyatOSf4vhiYLZxszcVyanm4lHw+C1bV/ Ysfm0MyKIXmepxk3q4cUvkB2OVGbBwO4ipjykbL7MZCQ93blSniIXhKjKVaidMBZyCuP d4jPySk3iCOQcMaXaaTgw8QYWH9EckGtQONHh81SWtddzC6dafHoukwtSyK6AbPZJBUY Qx/40xtZOOWqSrjRCqKWlje4k0y1MfwkAJClxzReAC3NcJ1hTF0T5dtod2S/aNRT+5Dj 1CnLh9a4odhA59G2hg8Oud66eoDihbauoGgGJR4hoi4OY4ppD0rgJXvqjyFAknK/PsJJ lrng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5SSjhkPw8xL7bMp5tr0YqEE3RQBKLdqb5WoWnbaDWQM=; b=jsEK9thtNzhya7buXfE/NpR0haa03OlzZX/kIFChB/RNvN0W5tiFg+EcQawlATzM2T NIAcrabgpFk+ogfaA6DlVWUDqQpSSoCCU8VQfbrza/JYFaoBDPD8ZnOmQ5vm5XyqI1Hb DMJytE7TprEqoFFRIdYoL0kiUK/lyEqxe08VqQzFX9v4usGt2z27ftiWrXDgGZg5k0vt 00SETELiu4tV5Q2Vn7iDFHoNh9c6eiyR1XE0vYbfp1K9PwzyPuJIBZ7QfIcI4rEAryTk Z0OoOYV0tjpCm6vr+9adxkEUXo0Q7dp1rSDwNDkUD0nKdT77NJF85aUI5+3c4mK5dqkQ nlpw== X-Gm-Message-State: AOAM530+83h1RRtt3IIS1fln8u7Ilw5d9FjYB59VA2tV5R8OsGWiRtxu dKh/Apxhn95vOHiE+cj74mecGRBMU6503Q== X-Google-Smtp-Source: ABdhPJwHma/6dRiB504v8WJv2mW9wFr0t7VLOw5JNc+CB690GlFBOoecdBg5sKPiBQ9R+Jmb0GtwfQ== X-Received: by 2002:a92:dd0c:: with SMTP id n12mr14723291ilm.236.1622663265029; Wed, 02 Jun 2021 12:47:45 -0700 (PDT) Received: from uranus.home.sansel.ca (bras-vprn-tnhlon4053w-lp130-01-70-51-222-236.dsl.bell.ca. [70.51.222.236]) by smtp.gmail.com with ESMTPSA id l10sm470322iom.47.2021.06.02.12.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 12:47:44 -0700 (PDT) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Wed, 2 Jun 2021 15:47:39 -0400 Message-Id: <20210602194739.29488-1-selva.nair@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.166.175 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (selva.nair[at]gmail.com) -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.166.175 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-Headers-End: 1loWqE-007oBp-Sz Subject: [Openvpn-devel] [PATCH] Apply the connect-retry backoff to only one side of a connection X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Selva Nair p2p connections with both ends backing off seldom succeed as their connection attempt durations becomes increasingly unlikely to overlap when the retry wait time is long. Avoid this by applying the backoff logic only on TCP clients or the tls_client side for UDP. Regression warning: shared secret setups are left out of the backoff logic. Trac #1010 Signed-off-by: Selva Nair Acked-by: Gert Doering --- src/openvpn/init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 49c74292..2889f355 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -2423,8 +2423,9 @@ socket_restart_pause(struct context *c) sec = 10; } - /* Slow down reconnection after 5 retries per remote -- for tcp only in client mode */ - if (c->options.ce.proto != PROTO_TCP_SERVER) + /* Slow down reconnection after 5 retries per remote -- for TCP client or UDP tls-client only */ + if (c->options.ce.proto == PROTO_TCP_CLIENT + || (c->options.ce.proto == PROTO_UDP && c->options.tls_client)) { backoff = (c->options.unsuccessful_attempts / c->options.connection_list->len) - 4; if (backoff > 0)