From patchwork Mon Mar 19 18:03:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 274 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net (Dovecot) with LMTP id 66lHNX2WsFrOdQAAIUCqbw for ; Tue, 20 Mar 2018 01:05:01 -0400 Received: from proxy3.mail.ord1d.rsapps.net ([172.30.191.6]) by director9.mail.ord1d.rsapps.net (Dovecot) with LMTP id j6AlBX2WsFoDVgAAalYnBA ; Tue, 20 Mar 2018 01:05:01 -0400 Received: from smtp10.gate.ord1c ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy3.mail.ord1d.rsapps.net with LMTP id KNgGNX2WsFpJNwAA7WKfLA ; Tue, 20 Mar 2018 01:05:01 -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: smtp10.gate.ord1c.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: 3e1ddad0-2bfc-11e8-8809-0026b954785f-1-1 Received: from [216.105.38.7] ([216.105.38.7:60510] helo=lists.sourceforge.net) by smtp10.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id E8/50-25765-D7690BA5; Tue, 20 Mar 2018 01:05:01 -0400 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1ey9RL-0001An-B9; Tue, 20 Mar 2018 05:04:03 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ey9RK-0001Ah-0K for openvpn-devel@lists.sourceforge.net; Tue, 20 Mar 2018 05:04:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=8oGpJPiXPu2OlryrmPr249ITGxgtqwcIApCSkFsVH6g=; b=LRceLAmGxLRhXlW4f7whCbrSOw 7eet+VJFndGON0jRUVdDukXE+k62sv1Hksn0Yv5RMuuKL8MG0zKmgVWLlth7y7WpAzo/TDBY2nDT4 YP3CutAtdKNQF1vTm4rULPV7kuoA5F1jV/tlfP1OzuS/EwyeaJRmM2p8uLnIxlP7u+oE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To :MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=8oGpJPiXPu2OlryrmPr249ITGxgtqwcIApCSkFsVH6g=; b=BDzMrYoVuXvA+JHMMrNSokjXRz 2NfynmgJtLwZ4liWWF44RsPw7U0VA/2omBC0jwxlP8tXD60NIsUKQb+8sTt/T2TIGda9/PHaoVQ/L Mw13kqBBwj+vF35RhscTaAC8nMpwadUQoSOHqEJk+Z2wusJ4mE1qqrQp9Nu75T7d+FiY=; Received: from sfi-lb-mx.v20.lw.sourceforge.com ([172.30.20.201] helo=mail-it0-f65.google.com) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) id 1ey9RI-000jp4-Hg for openvpn-devel@lists.sourceforge.net; Tue, 20 Mar 2018 05:04:01 +0000 Received: by mail-it0-f65.google.com with SMTP id d13-v6so747117itf.0 for ; Mon, 19 Mar 2018 22:04:00 -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:in-reply-to:references; bh=8oGpJPiXPu2OlryrmPr249ITGxgtqwcIApCSkFsVH6g=; b=qQTohgMMN8ypiVQgQmwebfA5CcjOJk8qUrBYCirddaPRKZED0ZPTvGv670g/3AEQCE C/uerjZcpMDhrmIPF6xWCgxQA7G1Pinn1OE9aRXXuYpDfyATfV2b692Yfs7nsGdSADZv ukIDEeP9iCCTFE9KcOrlrCVEte5r45MYYV3koSNWUITKR2zSRYH7JiV6wDOb9ckVmF+S W52hTlHjo6aVJ6QJbYngEXR98wMRIPM3Xv/QGO2T65LR/p+uYTKVnPhqYrIe/ywuw8Zf mkDxTuq70DWD5ZXpsV+1AKZgSD1PDacBK1Wikc1rmRSCc/N39GBCheGXR4l9llHttrbs QF2w== 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:in-reply-to :references; bh=8oGpJPiXPu2OlryrmPr249ITGxgtqwcIApCSkFsVH6g=; b=tiQ/yVCjoLIAlN1DZr40DismGFEmTxtC73q9/7zrna8L5nQfrQn9YpOArlJ1IXS8X1 rd3naYcJLkU3vAEa484X5IZ5tJbXR3fMWJsXQA4sfgP97SQO9h4m/9UPxgWWcGq8BWGh qPc1Qx6UreXiuCW4yfO4vQDoA21ainA7Re0tYg0IuZ1xG53OXZMM6K1EPRc84rBexQgw STHnCzHhS1qbYbL7qpk+FA3vcVhl4QYv6/E/rP4pMZ26vEjcCOTpSDoFtmAtp1rDmfbQ luYJ2ugoBPOVkFysgbS4zM3tAflGsOe4dMtOss01n1qu4Gqj2VD1R2BoQzqhoK+Je3o0 pDKw== X-Gm-Message-State: AElRT7EecEL/2zQpLBaToozq3fGHLiqnC+PAgmIvG/3pGhMqDknyh350 QFgJx+DANX0HmFaKOiCVfJSZD8VT X-Google-Smtp-Source: AG47ELv8Don2/BGevuSvkTFTJeHd80SSgTbXMKYcqCueBJ9hC4iuNMh+sMoen40tAZW/9juNKwJxaQ== X-Received: by 2002:a24:41cd:: with SMTP id b74-v6mr1239712itd.27.1521522234857; Mon, 19 Mar 2018 22:03:54 -0700 (PDT) Received: from saturn.home.sansel.ca (CPE40167ea0e1c2-CM788df74daaa0.cpe.net.cable.rogers.com. [99.228.215.92]) by smtp.gmail.com with ESMTPSA id m67sm430417iod.74.2018.03.19.22.03.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Mar 2018 22:03:54 -0700 (PDT) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Tue, 20 Mar 2018 01:03:44 -0400 Message-Id: <1521522224-18829-2-git-send-email-selva.nair@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1521522224-18829-1-git-send-email-selva.nair@gmail.com> References: <1521522224-18829-1-git-send-email-selva.nair@gmail.com> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 3.6 RCVD_IN_PBL RBL: Received via a relay in Spamhaus PBL [99.228.215.92 listed in zen.spamhaus.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (selva.nair[at]gmail.com) 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1ey9RI-000jp4-Hg Subject: [Openvpn-devel] [PATCH 2/2] Allow repeated cycles through remotes when management-query-remote is in use 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: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Selva Nair (i) Let the management-client predictably cycle through remote entries. This is done by not aborting after two cycles. The client can abort or restart the connection using signals (USR/HUP/TERM) as necessary. In the current behaviour, the daemon can unexpectedly exit when the last remote is skipped. When management-query-remote is not in use, the behaviour is unchanged. (ii) Do not count skipping a remote as an unsuccessful connection attempt. As the latter count is used for backoff it should count only failed attempts. Signed-off-by: Selva Nair --- src/openvpn/init.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 413563a..c63dc67 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -468,14 +468,6 @@ next_connection_entry(struct context *c) c->c1.link_socket_addr.remote_list; } - /* - * Increase the number of connection attempts - * If this is connect-retry-max * size(l) - * OpenVPN will quit - */ - - c->options.unsuccessful_attempts++; - if (++l->current >= l->len) { @@ -501,6 +493,9 @@ next_connection_entry(struct context *c) { /* allow management interface to override connection entry details */ ce_defined = ce_management_query_remote(c); + + /* ignore cycles when management-query-remote is in use */ + n_cycles = 0; if (IS_SIG(c)) { break; @@ -517,6 +512,7 @@ next_connection_entry(struct context *c) #endif } while (!ce_defined); + c->options.unsuccessful_attempts++; /* Check if this connection attempt would bring us over the limit */ if (c->options.connect_retry_max > 0 && c->options.unsuccessful_attempts > (l->len * c->options.connect_retry_max))