[Openvpn-devel,XS] Change in openvpn[master]: route: Fix overriding return value of add_route3

Message ID 60951251cdb2f39b20cfc86130c2dc0570ba0363-HTML@gerrit.openvpn.net
State Not Applicable
Headers show
Series [Openvpn-devel,XS] Change in openvpn[master]: route: Fix overriding return value of add_route3 | expand

Commit Message

ordex (Code Review) July 28, 2023, 1:03 p.m. UTC
flichtenheld has uploaded this change for review. ( http://gerrit.openvpn.net/c/openvpn/+/319?usp=email )


Change subject: route: Fix overriding return value of add_route3
......................................................................

route: Fix overriding return value of add_route3

The return value of add_bypass_routes overwrites
the return value of add_route3 instead of combining
them.

Coverity: CID 1539180 (#1 of 1): Unused value (UNUSED_VALUE)

Change-Id: I78f92f363fe203af5661c6958b2417ea30f7055c
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
---
M src/openvpn/route.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/19/319/1

Comments

Gert Doering Aug. 11, 2023, 4:39 p.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

Yep, Coverity is right :-) - silly code.  Fix is in the same style we
use elsewhere, so fine.

(The whole error handling on route addition is a bit wonky, but even
then we should not forget about errors)

Test compiled on Linux, just to be sure I did not overlook anything.

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

commit 8067cc8d1b384d3eb0fc9000992710b02951b266 (master)
commit 09e2360a163077001fd33f2f338cf337b45b9ab6 (release/2.6)
Author: Frank Lichtenheld
Date:   Fri Jul 28 14:47:12 2023 +0200

     route: Fix overriding return value of add_route3

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <60951251cdb2f39b20cfc86130c2dc0570ba0363-HTML@gerrit.openvpn.net>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26900.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index 90e981e..9212186 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -1062,7 +1062,7 @@ 
 
             /* route DHCP/DNS server traffic through original default gateway */
             ret = add_bypass_routes(&rl->spec.bypass, rl->rgi.gateway.addr, tt, flags,
-                                    &rl->rgi, es, ctx);
+                                    &rl->rgi, es, ctx) && ret;
 
             if (rl->flags & RG_REROUTE_GW)
             {