From: "cron2 (Code Review)" Date: Tue, 17 Sep 2024 10:40:44 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., gianmarco@...2726..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <4cc89578cc616a5526fab920e0872fddae02549d-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="x4wtGYqZRyU="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: Route: remove incorrect routes on exit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: its_Giaan Cc: flichtenheld , plaisthos , openvpn-devel --x4wtGYqZRyU= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/52= 2?usp=3Demail ) Change subject: Route: remove incorrect routes on exit ...................................................................... Route: remove incorrect 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. Trac: #1457 Change-Id: I8a67b82eb4afdc8d82c5a879c18457b41e77cbe7 Signed-off-by: Gianmarco De Gregori Acked-by: Frank Lichtenheld Message-Id: <20240221111814.942965-1-frank@...2641...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28= 290.html Signed-off-by: Gert Doering --- M src/openvpn/route.c 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 91f2032..2e584c7 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -1060,7 +1060,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: 3 Gerrit-Owner: its_Giaan Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --x4wtGYqZRyU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

Route: remove incorrect routes on exit

= Implemented a safeguard to verify the returned value
from add_route3() w= hen the default gateway is not a local
remote host.

Prior to this= implementation, RT_DID_LOCAL flag was
erroneously set even in case of a= dd_route3() failure.
This problem typically occurs when there's no d= efault
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 valu= e.

Trac: #1457
Change-Id: I8a67b82eb4afdc8d82c5a879c18457b41e77cb= e7
Signed-off-by: Gianmarco De Gregori <gianmarco@...2726...>
A= cked-by: Frank Lichtenheld <frank@...2641...>
Message-Id: <2024= 0221111814.942965-1-frank@...2641...>
URL: https://www.mail-archive.c= om/openvpn-devel@lists.sourceforge.net/msg28290.html
Signed-off-by: Gert= Doering <gert@...1296...>
---
M src/openvpn/route.c
1 file = changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/openvpn/route.c b/src/openvpn/route.c
i= ndex 91f2032..2e584c7 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -1060,7 +1060,10 @= @
ret =3D add_route3(rl->spec.remot= e_host, IPV4_NETMASK_HOST,
= rl->rgi.gateway.addr, tt, flags | ROUTE_REF_GW,
= &rl->rgi, es, ctx);
- rl->iflags = |=3D RL_DID_LOCAL;

+ = if (ret)
+ {
+ rl->iflags |=3D RL_DID_LOCAL;+ }=
}
else {

To view, vis= it change= 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: 3
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-MessageType: merged
--x4wtGYqZRyU=--