From patchwork Fri Oct 5 23:30:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lev Stipakov X-Patchwork-Id: 494 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director10.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id oJ5sLKCBuFtVAQAAIUCqbw for ; Sat, 06 Oct 2018 05:34:24 -0400 Received: from proxy11.mail.ord1d.rsapps.net ([172.30.191.6]) by director10.mail.ord1d.rsapps.net with LMTP id cMw8LKCBuFtAJwAApN4f7A ; Sat, 06 Oct 2018 05:34:24 -0400 Received: from smtp9.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy11.mail.ord1d.rsapps.net with LMTP id oAgILKCBuFu5JQAAgKDEHA ; Sat, 06 Oct 2018 05:34:24 -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: smtp9.gate.ord1d.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: 02b7c392-c94b-11e8-a455-525400bd3b1f-1-1 Received: from [216.105.38.7] ([216.105.38.7:48291] helo=lists.sourceforge.net) by smtp9.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 63/B8-29388-0A188BB5; Sat, 06 Oct 2018 05:34:24 -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 1g8ixw-0006mG-QF; Sat, 06 Oct 2018 09:33:40 +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 1g8ixu-0006m9-Tg for openvpn-devel@lists.sourceforge.net; Sat, 06 Oct 2018 09:33:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding: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=gA5hGPdHfBnQ1kghfvnJ21gM8v6q/NFTbgayLGaxUrY=; b=MCX345+yjkIxgeqDC3OVRlCjVo K0sUeyQPlaA/86YCk13mTk2IYxrdKFH6MIuQurFFeHhBFxQO4ENLjCOqnum1aFT2qFeOD08slODS1 wvK7fdqtAtYxHfR+VyguHHlmokgKoyiPlvAEZq2NseEjnHnRlp5jVtmyR8WDBPFCE9zI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version: Content-Type:Content-Transfer-Encoding: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=gA5hGPdHfBnQ1kghfvnJ21gM8v6q/NFTbgayLGaxUrY=; b=BslFZWMGuP9ITym4QWHw6qF/QK Joa9kD7dYiZFOzI495tG0qmJ+9ovScboUWaAuE1DBFOkchoPMYTF2F7CJktILJrVhcsQrqxcONzA8 Ysik5jgNB5jjZURcO+LpxrwDlHjsPmfiQC4BXc7VTHM3Wvz2xPwWbyTiuYbVj2H1TxSA=; Received: from mail-ed1-f66.google.com ([209.85.208.66]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) id 1g8ixt-001kCg-An for openvpn-devel@lists.sourceforge.net; Sat, 06 Oct 2018 09:33:38 +0000 Received: by mail-ed1-f66.google.com with SMTP id d15-v6so1435634edq.6 for ; Sat, 06 Oct 2018 02:33:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=gA5hGPdHfBnQ1kghfvnJ21gM8v6q/NFTbgayLGaxUrY=; b=N1hs5YVWRXqzdXn0blgdKh4oWL8eVS3sSqF3U9YGKFjGYwGvRLAbq8LHwdEB0qRsHP v0hmd77IzPI3UJLqLVV4uVhFkDSHYk5FIC2AfFyTRn48/ixeknpM8tYk1QbmRtKVmqLI ru8J2sZvuHlHUTY8TlgaNoXpyMQzkzNnMnwQeFijp1f32GhAVpt2oig+ifI0sNhlAWp3 lk7MiyT13LJ8NEyF+6SGNL4WmC1BoYMCEwQSqx6CcxibKBzhEBYJ38YlZXUrNeTmS9oZ jJq3vy9xx0tApfyJzEcU4oe4304KwnOLZ9qQRqgNa5UKebwsntXlbdEMcFiausK/zkSc zpqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=gA5hGPdHfBnQ1kghfvnJ21gM8v6q/NFTbgayLGaxUrY=; b=mSQLUfyeGXAOMLKqh4vxw3cNloTLo/KOKXeqiVj7x1SOyw1HKPr0asdwMDLOy9+F/T +gIz/DzXkw0MPMABmcJN99RqmcmwhgtqNJraMubyUJg4pRFpxuGNqEHESWHv1kNaWLqG fR9KDk4rup5iBFJb3Xv61R+/6v/sGOx2M0pLHNQ3jQikQeBx5sOs8d2UZ8imWRSTVNIv 0nYljCkMeu3AaEGJkNYpqUFklcBlDKw0vWi5hHNa4gZUVBEsFJJE1KZbIWN9SL27kG9l naBKQRQXC4zWzJLFqR4w0uSvdHRBD/GkbJqWsLVni3kF3cr2PPtRhE0GkbgayNq8OBrb Ua3g== X-Gm-Message-State: ABuFfohI7trZ4wKoFyMAIoWJZiZxBD/xZAOFH4mYP/bEJXYCq4w2fX1T mrRm8MYcSEpEkeSjbCrUSxWRU2k2AiA= X-Google-Smtp-Source: ACcGV626lDRi4JUsQeK0Q3dfFffANPMUzEQkqcK+uKq82fQxh2vRWQwZxGKXtUPiXqtFVsmoqxivyQ== X-Received: by 2002:a05:6402:786:: with SMTP id d6mr19239411edy.81.1538818409959; Sat, 06 Oct 2018 02:33:29 -0700 (PDT) Received: from stipakov.fi (stipakov.fi. [128.199.52.117]) by smtp.gmail.com with ESMTPSA id o38-v6sm1568267edo.40.2018.10.06.02.33.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 06 Oct 2018 02:33:28 -0700 (PDT) From: Lev Stipakov To: openvpn-devel@lists.sourceforge.net Date: Sat, 6 Oct 2018 12:30:19 +0300 Message-Id: <1538818219-18141-1-git-send-email-lstipakov@gmail.com> X-Mailer: git-send-email 2.7.4 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 http://www.dnswl.org/, no trust [209.85.208.66 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (lstipakov[at]gmail.com) -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.208.66 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches 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 0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1g8ixt-001kCg-An Subject: [Openvpn-devel] [PATCH] init.c: refine functions names and description 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: Lev Stipakov This patch provides better naming and description for functions which deal with backup/restore NCP-negotiable options. Signed-off-by: Lev Stipakov Acked-by: Gert Doering --- src/openvpn/init.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/openvpn/init.c b/src/openvpn/init.c index b2ab2a6..9172dbb 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -613,26 +613,20 @@ uninit_proxy(struct context *c) } /* - * Assign NCP-negotiable options to context->c1 - * from context->options (initially config values). - * They persist over sigusr1 restart. + * Saves the initial state of NCP-regotiable + * options into a storage which persists over SIGUSR1. */ static void -do_set_ncp_options(struct context *c) +save_ncp_options(struct context *c) { c->c1.ciphername = c->options.ciphername; c->c1.authname = c->options.authname; c->c1.keysize = c->options.keysize; } -/* - * Restore NCP-negotiable options from c->c1 to - * c->options. The latter ones can be altered by - * pushed options and therefore need to be restored - * to original values on sigusr1 restart. - */ +/* Restores NCP-negotiable options to original values */ static void -do_unset_ncp_options(struct context *c) +restore_ncp_options(struct context *c) { c->options.ciphername = c->c1.ciphername; c->options.authname = c->c1.authname; @@ -648,7 +642,7 @@ context_init_1(struct context *c) init_connection_list(c); - do_set_ncp_options(c); + save_ncp_options(c); #if defined(ENABLE_PKCS11) if (c->first_time) @@ -4320,7 +4314,7 @@ close_instance(struct context *c) /* free key schedules */ do_close_free_key_schedule(c, (c->mode == CM_P2P || c->mode == CM_TOP)); - do_unset_ncp_options(c); + restore_ncp_options(c); /* close TCP/UDP connection */ do_close_link_socket(c);