From: "cron2 (Code Review)" Date: Thu, 9 Oct 2025 17:19:01 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="hfGD/xE69PA="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: Preserve ifconfig(_ipv6)_local across reconnect List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: stipa , plaisthos , flichtenheld Cc: openvpn-devel --hfGD/xE69PA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: cron2, flichtenheld, plaisthos, stipa. cron2 has uploaded a new patch set (#2) to the change originally created by= stipa. ( http://gerrit.openvpn.net/c/openvpn/+/1248?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 The change is no longer submittable: Code-Review and checks~ChecksSubmitRul= e are unsatisfied now. Change subject: Preserve ifconfig(_ipv6)_local across reconnect ...................................................................... Preserve ifconfig(_ipv6)_local across reconnect Turns out that ifconfig_(ipv6)_local options are set once and are not reset on a reconnect. Consider following scenario: - connect first time, server pushes ifconfig-ipv6 - add a ipv6 network route because ifconfig_ipv6_local is set - reconnect, server doesn't push ifconfig-ipv6 Because of ifconfig_ipv6_local is not reset and holds the value set by the first connect, client adds a ipv6 network route - but this is wrong, since ipv6 wasn't pushed this time by the server. Fix by saving/restoring ifconfig(_ipv6)_local in a struct options_pre_connect along with other options which preserves the initial values until --pull modifications are applied. Github: OpenVPN/openvpn#850 Change-Id: I9b099924286f9bccb6833e1e40606abe72714bbb Signed-off-by: Lev Stipakov --- M src/openvpn/options.c M src/openvpn/options.h 2 files changed, 9 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/48/1248/2 diff --git a/src/openvpn/options.c b/src/openvpn/options.c index f35738d..d1ce551 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -3143,6 +3143,9 @@ o->pre_connect->client_nat_defined =3D true; } + o->pre_connect->ifconfig_local =3D o->ifconfig_local; + o->pre_connect->ifconfig_ipv6_local =3D o->ifconfig_ipv6_local; + o->pre_connect->route_default_gateway =3D o->route_default_gateway; o->pre_connect->route_ipv6_default_gateway =3D o->route_ipv6_default_g= ateway; @@ -3193,6 +3196,9 @@ o->routes_ipv6 =3D NULL; } + o->ifconfig_local =3D pp->ifconfig_local; + o->ifconfig_ipv6_local =3D pp->ifconfig_ipv6_local; + o->route_default_gateway =3D pp->route_default_gateway; o->route_ipv6_default_gateway =3D pp->route_ipv6_default_gateway; diff --git a/src/openvpn/options.h b/src/openvpn/options.h index b033068..445fd25 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -64,6 +64,9 @@ bool tuntap_options_defined; struct tuntap_options tuntap_options; + const char *ifconfig_local; + const char *ifconfig_ipv6_local; + bool routes_defined; struct route_option_list *routes; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1248?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I9b099924286f9bccb6833e1e40606abe72714bbb Gerrit-Change-Number: 1248 Gerrit-PatchSet: 2 Gerrit-Owner: stipa Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: cron2 Gerrit-Attention: flichtenheld Gerrit-Attention: stipa --hfGD/xE69PA= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: cron2, flichtenheld, plaisthos, stipa.

cron2 uploaded patch set #2 to the change originally cr= eated by stipa.

View Change

The following approvals got outdated an= d were removed: Code-Review+2 by cron2

The change is no longer submittable: Code-Revi= ew and checks~ChecksSubmitRule are unsatisfied now.

Preser=
ve ifconfig(_ipv6)_local across reconnect

Turns out that ifconfig_(i= pv6)_local options are set once
and are not reset on a reconnect.
Consider following scenario:

- connect first time, server pushes i= fconfig-ipv6
- add a ipv6 network route because ifconfig_ipv6_local is = set
- reconnect, server doesn't push ifconfig-ipv6

Because o= f ifconfig_ipv6_local is not reset and holds the value
set by the first = connect, client adds a ipv6 network route -
but this is wrong, since ipv= 6 wasn't pushed this time by the server.

Fix by saving/restoring= ifconfig(_ipv6)_local in a
struct options_pre_connect along with other = options which
preserves the initial values until --pull modificationsare applied.

Github: OpenVPN/openvpn#850
Change-Id: I9b099924286= f9bccb6833e1e40606abe72714bbb
Signed-off-by: Lev Stipakov <lev@...2146...= ...>
---
M src/openvpn/options.c
M src/openvpn/options.h
2 f= iles changed, 9 insertions(+), 0 deletions(-)

gi=
t pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/48/1248/2
<= pre style=3D"font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index f35738d..d1ce551 100644
--- a/src/openvpn/options.c=
+++ b/src/openvpn/options.c
@@ -3143,6 +31= 43,9 @@
o->pre_connect->client_nat_defined = =3D true;
}

+ o->pre_connect->ifconfig_local =3D= o->ifconfig_local;
+
o->pre_connect->route_default_gateway =3D o->route_default_= gateway;
o->pre_connect->route_ipv6_default_gate= way =3D o->route_ipv6_default_gateway;

@@ -3193,6 +3196,9 @@
o->routes_ipv6 =3D N= ULL;
}

+ o->ifconfig_local =3D pp->ifcon= fig_local;
+ o= ->ifconfig_ipv6_local =3D pp->ifconfig_ipv6_local;
+
o->route_= default_gateway =3D pp->route_default_gateway;
= o->route_ipv6_default_gateway =3D pp->route_ipv6_default_gateway;

diff --git a/src/openvpn/options.h b/src/ope= nvpn/options.h
index b033068..445fd25 100644
--- a/src/openvpn/options.h

+++ b/src/openvpn/options.h
@@ -64,6 +64,9 @@
bool tuntap_options_d= efined;
struct tuntap_options tuntap_options;
+ const = char *ifconfig_local;
+ const char *ifconfig_ipv6_local;
+
bool routes_defined;
struct route_option_list *routes;



To view, visit change 1248. To unsubscribe, or for help wr= iting mail filters, visit settings.

=
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9b099924286f9bccb6833e1e406= 06abe72714bbb
Gerrit-Change-Number: 1248
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <lstipakov@...277...>= ;
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: cron2 <gert@...1296...>= ;
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-Attention: stipa <lstipakov@...1663...= .>
= --hfGD/xE69PA=--