From: "its_Giaan (Code Review)" Date: Thu, 15 Feb 2024 08:48:55 +0000 References: Reply-To: gianmarco@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <06ebd3fab9ad0435f8b73ec15f89b60111da4228-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="lpbM8W7Lnbs="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: Route: remove uncorrect routes on exit. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --lpbM8W7Lnbs= 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/+/522?usp=3Demail to review the following change. Change subject: Route: remove uncorrect routes on exit. ...................................................................... Route: remove uncorrect routes on exit. Implemented a safeguard to verify the returned value from add_route3() when the default gateway is not a local remote host. Prior to this implementation, RT_DID_LOCAL flag was erroneously set even in case of add_route3() failure. This problem typically occurs when there's no default route and the --redirect-gateway def1 option is specified, and in case of reconnection makes it impossible for the client to reobtain the route to the server. This fix ensures OpenVPN accurately deletes the appropriate route on exit by properly handling add_route3() return value. Fixes: Trac #1457 Change-Id: I8a67b82eb4afdc8d82c5a879c18457b41e77cbe7 Signed-off-by: Gianmarco De Gregori --- M src/openvpn/route.c 1 file changed, 4 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/22/522/1 diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 6c027d9..6ab4392 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -1055,7 +1055,10 @@ ret =3D add_route3(rl->spec.remote_host, IPV4_NETMASK_= HOST, rl->rgi.gateway.addr, tt, flags | ROU= TE_REF_GW, &rl->rgi, es, ctx); - rl->iflags |=3D RL_DID_LOCAL; + if (ret) + { + rl->iflags |=3D RL_DID_LOCAL; + } } else { -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/522?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: I8a67b82eb4afdc8d82c5a879c18457b41e77cbe7 Gerrit-Change-Number: 522 Gerrit-PatchSet: 1 Gerrit-Owner: its_Giaan Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --lpbM8W7Lnbs= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

its_Giaan would like plaisthos and flichtenheld to review this change.

Vi= ew Change

Route: remove uncorrect routes on exit.

Implemented a = safeguard to verify the returned value
from add_route3() when the defaul= t gateway is not a local
remote host.

Prior to this implementatio= n, RT_DID_LOCAL flag was
erroneously set even in case of add_route3() fa= ilure.
This problem typically occurs when there's no default
rout= e and the --redirect-gateway def1 option is specified,
and in case of re= connection makes it impossible for the client
to reobtain the route to t= he server.
This fix ensures OpenVPN accurately deletes the appropriateroute on exit by properly handling add_route3() return value.

Fixe= s: Trac #1457
Change-Id: I8a67b82eb4afdc8d82c5a879c18457b41e77cbe7
Si= gned-off-by: Gianmarco De Gregori <gianmarco@...2726...>
---
M = src/openvpn/route.c
1 file changed, 4 insertions(+), 1 deletion(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/22/522/1<=
/pre>
-                    rl->if=
lags |=3D RL_DID_LOCAL;
+ if (ret)
+ {
+ rl->iflags |=3D RL_DID_LOCAL;
+ }
}
else
{

To view= , visit c= hange 522. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I8a67b82eb4afdc8d82c5a879c18= 457b41e77cbe7
Gerrit-Change-Number: 522
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <gianmarco@...2786...= ..>
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
--lpbM8W7Lnbs=--