]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Move restoring pre pull options to initialising of c2 context
authorArne Schwabe <arne@rfc2549.org>
Wed, 17 Mar 2021 16:00:36 +0000 (17:00 +0100)
committerGert Doering <gert@greenie.muc.de>
Tue, 23 Mar 2021 08:55:43 +0000 (09:55 +0100)
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 <arne@rfc2549.org>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20210317160038.25828-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21676.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/init.c
src/openvpn/openvpn.h
src/openvpn/push.c

index c56dac879a14406f529ee2c362cb319865daeb91..a07e7404c91ec5b29a43c5fd2c84648989f4277b 100644 (file)
@@ -4167,6 +4167,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);
 
index e9bc7dad124f4a9bb81d00ad401854069909055f..436c10eeb7eabbe47847d94267cc74fde8d30f78 100644 (file)
@@ -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;
index a651955746c09623fe378072b0ba5361366ff69b..18d7c1e00af119c093ef0cc8540e8d28f5ccb016 100644 (file)
@@ -930,11 +930,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,