From: "mrbff (Code Review)" Date: Wed, 24 Sep 2025 09:30:20 +0000 References: Reply-To: marco@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <72500ceaa163b4e9eef41a98c08683b33879f62a-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="+H7X6nZZ0Rw="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: redirect-gateway: Only redirect traffic through TUN if address famili... List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --+H7X6nZZ0Rw= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=3Demail to review the following change. Change subject: redirect-gateway: Only redirect traffic through TUN if addr= ess families match ...................................................................... redirect-gateway: Only redirect traffic through TUN if address families mat= ch Fixes an ifconfig push-reply bug where, if the remote is switched and the n= ew TUN has a different address family, the previous ifconfig options remain assigned to the new TUN. Adds a check in do_init_route_ipv6_list() to add default routes toward the = TUN only if the TUN has IPv6 addresses. Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c --- M src/openvpn/init.c M src/openvpn/options.c 2 files changed, 6 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/10/1210/1 diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 0d7a2ec..a5be243 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -1518,7 +1518,7 @@ /* redirect (IPv6) gateway to VPN? if yes, add a few more specifics */ - if (options->routes_ipv6->flags & RG_REROUTE_GW) + if (options->routes_ipv6->flags & RG_REROUTE_GW && options->ifconfig_i= pv6_local) { char *opt_list[] =3D { "::/3", "2000::/4", "3000::/4", "fc00::/7",= NULL }; int i; diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 151a016..5972cb9 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -5464,6 +5464,11 @@ const msglvl_t msglevel =3D D_PUSH_ERRORS | M_OPTERR; unsigned int update_options_found =3D 0; + options->ifconfig_local =3D NULL; + options->ifconfig_remote_netmask =3D NULL; + options->ifconfig_ipv6_local =3D NULL; + options->ifconfig_ipv6_netbits =3D 0; + options->ifconfig_ipv6_remote =3D NULL; while (buf_parse(buf, ',', line, sizeof(line))) { char *p[MAX_PARMS + 1]; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c Gerrit-Change-Number: 1210 Gerrit-PatchSet: 1 Gerrit-Owner: mrbff Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --+H7X6nZZ0Rw= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

mrbff would like plaisthos and flichtenheld to review t= his change.

V= iew Change

redirect-gateway: Only redirect traffic through TUN if addre=
ss families match

Fixes an ifconfig push-reply bug where, if the rem= ote is switched and the new
TUN has a different address family, the prev= ious ifconfig options remain
assigned to the new TUN.

Adds a chec= k in do_init_route_ipv6_list() to add default routes toward the TUN
only= if the TUN has IPv6 addresses.

Change-Id: Ib3458a9ed2eb38e00184c4a9= 2659b83b97fe476c
---
M src/openvpn/init.c
M src/openvpn/options.c<= br>2 files changed, 6 insertions(+), 1 deletion(-)

git pull ssh:=
//gerrit.openvpn.net:29418/openvpn refs/changes/10/1210/1
diff --=
git a/src/openvpn/init.c b/src/openvpn/init.c
index 0d7a2ec= ..a5be243 100644
--- a/src/openvpn/init.c
+= ++ b/src/openvpn/init.c
@@ -1518,7 +1518,7 @@

/* redirect (IPv6) gateway to VPN? if yes, add a= few more specifics
*/
- if (options->routes_ipv6->flags & RG_R= EROUTE_GW)
+ if (o= ptions->routes_ipv6->flags & RG_REROUTE_GW && options->= ;ifconfig_ipv6_local)
{
char = *opt_list[] =3D { "::/3", "2000::/4", "3000::/4&qu= ot;, "fc00::/7", NULL };
int i;diff --git a/src/openvpn/options.c b/src/openvpn/options.cindex 151a016..5972cb9 100644
--- a/src/openvpn/opt= ions.c
+++ b/src/openvpn/options.c
@@ -5464= ,6 +5464,11 @@
const msglvl_t msglevel =3D D_PUSH_ERRO= RS | M_OPTERR;
unsigned int update_options_found =3D 0= ;

+= options->ifconfig_local =3D NULL;
+ options->ifconfig_remote_netmask =3D NULL;
+ options->ifconfig= _ipv6_local =3D NULL;
+ options->ifconfig_ipv6_netbits =3D 0;
+ options->ifconfig_ipv6_remote =3D NULL;
while (buf_parse(buf, ',', line, sizeof(line)))=
{
char *p[MAX_PARMS + 1];

To view, visit change 1210. To unsubscribe, o= r for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a9265= 9b83b97fe476c
Gerrit-Change-Number: 1210
Gerrit-PatchSet: 1
Gerrit-Owner: mrbff <marco@...2726...> <= /div>
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: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--+H7X6nZZ0Rw=--