From patchwork Wed Dec 9 03:20:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1545 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director12.mail.ord1d.rsapps.net ([172.27.255.51]) by backend30.mail.ord1d.rsapps.net with LMTP id kNX+GITd0F/tQgAAIUCqbw (envelope-from ) for ; Wed, 09 Dec 2020 09:21:56 -0500 Received: from proxy13.mail.iad3a.rsapps.net ([172.27.255.51]) by director12.mail.ord1d.rsapps.net with LMTP id 8ORnGITd0F8aIwAAIasKDg (envelope-from ) for ; Wed, 09 Dec 2020 09:21:56 -0500 Received: from smtp10.gate.iad3a ([172.27.255.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy13.mail.iad3a.rsapps.net with LMTPS id 8M2GEITd0F84FQAAwhxzoA (envelope-from ) for ; Wed, 09 Dec 2020 09:21:56 -0500 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.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; dmarc=none (p=nil; dis=none) header.from=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: e3661d48-3a29-11eb-9e7c-525400a8203f-1-1 Received: from [216.105.38.7] ([216.105.38.7:49332] helo=lists.sourceforge.net) by smtp10.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 75/63-26703-38DD0DF5; Wed, 09 Dec 2020 09:21:55 -0500 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 1kn0Kw-0001MH-Ng; Wed, 09 Dec 2020 14:20:58 +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 1kn0Kv-0001Lt-E7 for openvpn-devel@lists.sourceforge.net; Wed, 09 Dec 2020 14:20:57 +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=rZo/L2DzBD1c9OcYCL7TSFWEucrW+H1rFHrUMINkSZI=; b=F9Zv7jyIwvJcgJQaeXax9QGQZy 3nTvjEq3eMUJWUbJKcjBbbhxcLDZLU6aPHq1tR7opXAUFZA8hdov+qTY6v/kgGVICp/THI6fn9ViQ aIinpBQR9qQCZ8nSfclK27OsP3SOL2aCE7zQZExeowja7iULlFx9RM5nJM1wpjY3+BNw=; 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=rZo/L2DzBD1c9OcYCL7TSFWEucrW+H1rFHrUMINkSZI=; b=k8OIoFqK1T3wc5IVfCI1Vbijpl DwIyhjMzTiweIM15Xgcy2TnWGRHgHRXrOeajz6t9QFlpg3lqV04AWwf5tVBoBa/r9uH0wsWC6zknQ C2f3F4udOTPLuNviumMgbZOShMv1jHQKCC1loLwvrFCpIrJ4VORbP7HJk3DmmpvWjsh8=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1kn0Kq-007oZg-Tp for openvpn-devel@lists.sourceforge.net; Wed, 09 Dec 2020 14:20:57 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.94 (FreeBSD)) (envelope-from ) id 1kn0Kj-000E0X-M1 for openvpn-devel@lists.sourceforge.net; Wed, 09 Dec 2020 15:20:45 +0100 Received: (nullmailer pid 4534 invoked by uid 10006); Wed, 09 Dec 2020 14:20:45 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Wed, 9 Dec 2020 15:20:43 +0100 Message-Id: <20201209142045.4489-1-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: rfc2549.org] 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1kn0Kq-007oZg-Tp Subject: [Openvpn-devel] [PATCH 1/3] Move restoring pr pull options to initialising of c2 context 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 We currently delay restoring these options until we actually must restore them. Since there is no reason to do so apart from the very minor saving to not have to execute that code when a connection fails, move them it into the general context_2 initialisation. Signed-off-by: Arne Schwabe --- src/openvpn/init.c | 5 +++++ src/openvpn/openvpn.h | 1 - src/openvpn/push.c | 5 ----- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/openvpn/init.c b/src/openvpn/init.c index c3493c42..2f44befe 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -4184,6 +4184,11 @@ init_instance(struct context *c, const struct env_set *env, const unsigned int f } } + if (c->options.pull) + { + pre_pull_restore(&c->options, &c->c2.gc); + } + /* map in current connection entry */ next_connection_entry(c); diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h index 4ca89ba9..ece85e88 100644 --- a/src/openvpn/openvpn.h +++ b/src/openvpn/openvpn.h @@ -463,7 +463,6 @@ struct context_2 struct event_timeout push_request_interval; int n_sent_push_requests; - bool did_pre_pull_restore; /* hash of pulled options, so we can compare when options change */ bool pulled_options_digest_init_done; diff --git a/src/openvpn/push.c b/src/openvpn/push.c index 26a6201f..95c28ff1 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -812,11 +812,6 @@ process_incoming_push_reply(struct context *c, md_ctx_init(c->c2.pulled_options_state, md_kt_get("SHA256")); c->c2.pulled_options_digest_init_done = true; } - if (!c->c2.did_pre_pull_restore) - { - pre_pull_restore(&c->options, &c->c2.gc); - c->c2.did_pre_pull_restore = true; - } if (apply_push_options(&c->options, buf, permission_mask,