Skip to contentSkip to conversation

Also restore/save route-gatreway options in reconnects

PATCH In review Arne Schwabe 2 participants 2 messages Apr 16, 2021 – Apr 17, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Also restore/save route-gatreway options in reconnects

---
 src/openvpn/options.c | 6 ++++++
 src/openvpn/options.h | 3 +++
 2 files changed, 9 insertions(+)
src/openvpn/options.c +6 -0
index 5934b0b84..10078a4d6 100644
@@ -3571,6 +3571,9 @@ pre_connect_save(struct options *o)
         o->pre_connect->client_nat_defined = true;
     }
 
+    o->pre_connect->route_default_gateway = o->route_default_gateway;
+    o->pre_connect->route_ipv6_default_gateway = o->route_ipv6_default_gateway;
+
     /* NCP related options that can be overwritten by a push */
     o->pre_connect->ciphername = o->ciphername;
     o->pre_connect->authname = o->authname;
@@ -3619,6 +3622,9 @@ pre_connect_restore(struct options *o, struct gc_arena *gc)
             o->routes_ipv6 = NULL;
         }
 
+        o->route_default_gateway = pp->route_default_gateway;
+        o->route_ipv6_default_gateway = pp->route_ipv6_default_gateway;
+
         if (pp->client_nat_defined)
         {
             cnol_check_alloc(o);
src/openvpn/options.h +3 -0
index ee3fd7e50..ef59f0a99 100644
@@ -70,6 +70,9 @@ struct options_pre_connect
     bool routes_ipv6_defined;
     struct route_ipv6_option_list *routes_ipv6;
 
+    const char *route_default_gateway;
+    const char *route_ipv6_default_gateway;
+
     bool client_nat_defined;
     struct client_nat_option_list *client_nat;
 
Signature · 1 line
2.31.1
Acked-by on v1 1/1
#1 lore raw

Stared-at-code (looks good) and subjected to the test rig that breaks (server with topology subnet, pushing route-gateway, SIGUSR1, advance to server that uses top net30, stuck route-gateway breaks route installation). Good :-)

Backport to 2.5 was fairly trivial (rename pre_connect to pre_pull and adjust indent) - tested there as well, fixes that as well.

Your patch has been applied to the master branch and release/2.5.

commit 57c8d220aab14b661bafd4fafc40c195326b8d8f (master) commit 7b594d4980f696583397a3b87e5c928acba17081 (release/2.5)

Author: Arne Schwabe
Date:   Fri Apr 16 15:35:12 2021 +0200
     Also restore/save route-gateway options on SIGUSR1 reconnects

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg22132.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering