From patchwork Wed Mar 17 05:00:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1621 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director7.mail.ord1d.rsapps.net ([172.27.255.54]) by backend30.mail.ord1d.rsapps.net with LMTP id aNXLIxMoUmBxMgAAIUCqbw (envelope-from ) for ; Wed, 17 Mar 2021 12:02:27 -0400 Received: from proxy17.mail.iad3a.rsapps.net ([172.27.255.54]) by director7.mail.ord1d.rsapps.net with LMTP id IK2qIxMoUmCUawAAovjBpQ (envelope-from ) for ; Wed, 17 Mar 2021 12:02:27 -0400 Received: from smtp50.gate.iad3a ([172.27.255.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy17.mail.iad3a.rsapps.net with LMTPS id cFWtGRMoUmCNJQAAR4KW9A (envelope-from ) for ; Wed, 17 Mar 2021 12:02:27 -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: smtp50.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: 2a49ee76-873a-11eb-b4ba-525400c2fb51-1-1 Received: from [216.105.38.7] ([216.105.38.7:52786] helo=lists.sourceforge.net) by smtp50.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 5A/86-24917-11822506; Wed, 17 Mar 2021 12:02:26 -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 1lMYcH-0001BQ-R6; Wed, 17 Mar 2021 16:01:49 +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 1lMYbK-0000lr-Pu for openvpn-devel@lists.sourceforge.net; Wed, 17 Mar 2021 16:00:50 +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=+UYqGTgQdpjxSLYxp2wh00IuVcWBW2uyS4TT7KrAyr8=; b=Z4mgMgc6Wss+fCLqGgQGSOl+9K quZ/pf4nlL0wOj3JCrrodAkq/T9MS7iubtm+dyqiG3ztsfW1xkBsEsNs1iWHZePwU93J1TrHwp3n0 QkxaWSzhJ0v+G9biH86W8Cp4uWlzage2WkQy7QxzM4sSt93dDapfGmiufZVgUjdJzktk=; 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=+UYqGTgQdpjxSLYxp2wh00IuVcWBW2uyS4TT7KrAyr8=; b=Hj0J9Pc3769YAzicvPu1GoosAh 1FH+O6L5X+C7PL+Kd7IefPre1e/h+LYElL8nJo0DPXJSSd2NmdTu/+ZLEuWw+qEY4Zw1P0OwyS30T 7GAGFesyjRZx9H+x4OaarEV8ng0hnZdF0gFwjeJkr/bZ2dkw2w361TrjxbzltS9gjwLY=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1lMYbF-0004wL-Ps for openvpn-devel@lists.sourceforge.net; Wed, 17 Mar 2021 16:00:50 +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 1lMYb8-000GKU-Iu for openvpn-devel@lists.sourceforge.net; Wed, 17 Mar 2021 17:00:38 +0100 Received: (nullmailer pid 25872 invoked by uid 10006); Wed, 17 Mar 2021 16:00:38 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Wed, 17 Mar 2021 17:00:36 +0100 Message-Id: <20210317160038.25828-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: 1lMYbF-0004wL-Ps Subject: [Openvpn-devel] [PATCH v2 1/3] Move restoring pre 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. Patch V2: rebase on master. Signed-off-by: Arne Schwabe Acked-by: Antonio Quartulli --- 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 d234729c..81aaa6c9 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -4165,6 +4165,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 e9bc7dad..436c10ee 100644 --- a/src/openvpn/openvpn.h +++ b/src/openvpn/openvpn.h @@ -463,7 +463,6 @@ struct context_2 struct event_timeout push_request_interval; time_t push_request_timeout; - 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 320ad737..580c16bd 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -929,11 +929,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,