[Openvpn-devel,2/3] Also restore/save compress related options in reconnects

Message ID 20210408120029.19438-2-arne@rfc2549.org
State Accepted
Delegated to: Gert Doering
Headers show
  • [Openvpn-devel,1/3] Always save/restore pull options
Related show

Commit Message

Arne Schwabe April 8, 2021, noon
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
 src/openvpn/options.c | 11 +++++++++++
 src/openvpn/options.h |  3 +++
 2 files changed, 14 insertions(+)


Gert Doering April 17, 2021, 8:44 a.m. | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

Stared-at-code (looks good), client side tested with the usual parcours
(good), and also tested with my two known-weird/broken test cases 
for "compress not restored" (fixed!).

Your patch has been applied to the master branch.

I tried to apply it to release/2.5, but the resulting binary did not
behave - I can see that it restored the comp settings, but it does so
*after* OCC handshake (so the OCC warning is still there) *and* it does
not re-init compression - so the case "config has comp-lzo, server A
pushes compress lz4, server B pushes nothing" (so it should do LZO)
still fails.  I think I need one of the other patches that changes
the "when are options saved/restored" as prerequisite here.

Will come back...

commit 2a414c3c79bba089183a517a2d355b5aaae0b4a4 (master)
Author: Arne Schwabe
Date:   Thu Apr 8 14:00:28 2021 +0200

     Also restore/save compress related options in reconnects

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20210408120029.19438-2-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22078.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>

kind regards,

Gert Doering


diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index a72e1b9ae..00ad98f15 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -3595,9 +3595,15 @@  pre_connect_save(struct options *o)
     o->pre_connect->authname = o->authname;
     /* Ping related options should be reset to the config values on reconnect */
     o->pre_connect->ping_rec_timeout = o->ping_rec_timeout;
     o->pre_connect->ping_rec_timeout_action = o->ping_rec_timeout_action;
     o->pre_connect->ping_send_timeout = o->ping_send_timeout;
+    /* Miscellaneous Options */
+#ifdef USE_COMP
+    o->pre_connect->comp = o->comp;
@@ -3650,6 +3656,11 @@  pre_connect_restore(struct options *o, struct gc_arena *gc)
         o->ping_rec_timeout = pp->ping_rec_timeout;
         o->ping_rec_timeout_action = pp->ping_rec_timeout_action;
         o->ping_send_timeout = pp->ping_send_timeout;
+        /* Miscellaneous Options */
+#ifdef USE_COMP
+        o->comp = pp->comp;
     o->push_continuation = 0;
diff --git a/src/openvpn/options.h b/src/openvpn/options.h
index 078bed75b..f52768680 100644
--- a/src/openvpn/options.h
+++ b/src/openvpn/options.h
@@ -81,6 +81,9 @@  struct options_pre_connect
     int ping_rec_timeout_action;
     int foreign_option_index;
+#ifdef USE_COMP
+    struct compress_options comp;