From: "flichtenheld (Code Review)" Date: Fri, 30 Jan 2026 16:11:14 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="+KJtD3VpzGs="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: route: Fix type of rgi_needed variables List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --+KJtD3VpzGs= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1505?usp=3Demail to review the following change. Change subject: route: Fix type of rgi_needed variables ...................................................................... route: Fix type of rgi_needed variables To avoid unneccesary sign-compare warnings. Change-Id: I2b2a931e13670d753aa9570efe498647ba1a4a7f Signed-off-by: Frank Lichtenheld --- M src/openvpn/route.c 1 file changed, 2 insertions(+), 20 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/05/1505/1 diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 329f3b0..b196713 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -570,11 +570,6 @@ } } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif - static void add_block_local_routes(struct route_list *rl) { @@ -602,15 +597,11 @@ bool block_local_needed(const struct route_list *rl) { - const int rgi_needed =3D (RGI_ADDR_DEFINED | RGI_NETMASK_DEFINED); + const unsigned int rgi_needed =3D (RGI_ADDR_DEFINED | RGI_NETMASK_DEFI= NED); return (rl->flags & RG_BLOCK_LOCAL) && (rl->rgi.flags & rgi_needed) = =3D=3D rgi_needed && (rl->spec.flags & RTSA_REMOTE_ENDPOINT) && rl->spec.remote_h= ost_local !=3D TLA_LOCAL; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - bool init_route_list(struct route_list *rl, const struct route_option_list *opt, const char *remote_endpoint, int default_metric, in_addr_t= remote_host, @@ -1445,17 +1436,12 @@ #define LR_MATCH 1 /* route is local */ #define LR_ERROR 2 /* caller should abort adding route */ -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif - static int local_route(in_addr_t network, in_addr_t netmask, in_addr_t gateway, const struct route_gateway_info *rgi) { /* set LR_MATCH on local host routes */ - const int rgi_needed =3D (RGI_ADDR_DEFINED | RGI_NETMASK_DEFINED | RGI= _IFACE_DEFINED); + const unsigned int rgi_needed =3D (RGI_ADDR_DEFINED | RGI_NETMASK_DEFI= NED | RGI_IFACE_DEFINED); if (rgi && (rgi->flags & rgi_needed) =3D=3D rgi_needed && gateway =3D= =3D rgi->gateway.addr && netmask =3D=3D 0xFFFFFFFF) { @@ -1479,10 +1465,6 @@ return LR_NOMATCH; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - /* Return true if the "on-link" form of the route should be used. This is= when the gateway for * a route is specified as an interface rather than an address. */ #if defined(TARGET_LINUX) || defined(_WIN32) || defined(TARGET_DARWIN) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1505?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I2b2a931e13670d753aa9570efe498647ba1a4a7f Gerrit-Change-Number: 1505 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --+KJtD3VpzGs= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

V= iew Change

route: Fix type of rgi_needed variables
=
To avoid unneccesary sign-compare warnings.

Change-Id: I2b2a931e= 13670d753aa9570efe498647ba1a4a7f
Signed-off-by: Frank Lichtenheld <fr= ank@...2641...>
---
M src/openvpn/route.c
1 file changed, 2 ins= ertions(+), 20 deletions(-)

git pull ssh://gerri=
t.openvpn.net:29418/openvpn refs/changes/05/1505/1
diff --git a/src=
/openvpn/route.c b/src/openvpn/route.c
index 329f3b0..b1967= 13 100644
--- a/src/openvpn/route.c
+++ b/s= rc/openvpn/route.c
@@ -570,11 +570,6 @@
= }
}

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push=
-#pragma GCC diagnostic ignor= ed "-Wsign-compare"
-#endif
-=
static void
add_block_local_routes(struct route= _list *rl)
{
@@ -602,15 +597,11 @@<= br> bool
block_local_needed(const struct route_list = *rl)
{
- const int rgi_needed =3D (RGI_ADDR_DEFINED | RGI_NETMASK_DEFINED);

+ const unsigned int= rgi_needed =3D (RGI_ADDR_DEFINED | RGI_NETMASK_DEFINED);
= return (rl->flags & RG_BLOCK_LOCAL) && (rl->rgi.flags= & rgi_needed) =3D=3D rgi_needed
&&= (rl->spec.flags & RTSA_REMOTE_ENDPOINT) && rl->spec.remo= te_host_local !=3D TLA_LOCAL;
}
-#if defined(__GNUC__) || defin= ed(__clang__)
-#pragma = GCC diagnostic pop
-#en= dif
-
= bool
init_route_list(struct route_list *rl, const struct r= oute_option_list *opt,
const char *remote_= endpoint, int default_metric, in_addr_t remote_host,
@@ -14= 45,17 +1436,12 @@
#define LR_MATCH 1 /* route is local *= /
#define LR_ERROR 2 /* caller should abort adding route= */

-= #if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-com= pare"
-#endif
-
static i= nt
local_route(in_addr_t network, in_addr_t netmask, in_ad= dr_t gateway,
const struct route_gateway_info = *rgi)
{
/* set LR_MATCH on local host= routes */
- const i= nt rgi_needed =3D (RGI_ADDR_DEFINED | RGI_NETMASK_DEFINED | RGI_IFACE_DEFIN= ED);
+ const unsig= ned int rgi_needed =3D (RGI_ADDR_DEFINED | RGI_NETMASK_DEFINED | RGI_IFACE_= DEFINED);
if (rgi && (rgi->flags & rgi_= needed) =3D=3D rgi_needed && gateway =3D=3D rgi->gateway.addr
&& netmask =3D=3D 0xFFFFFFFF)
{

@@ -1479,10 +1465,6 @@
return= LR_NOMATCH;
}

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic po= p
-#endif
-

/* Return true if= the "on-link" form of the route should be used. This is when th= e gateway for
* a route is specified as an interface rath= er than an address. */
#if defined(TARGET_LINUX) || define= d(_WIN32) || defined(TARGET_DARWIN)

To = view, visit change 1505. To unsubscribe, or for help writing mail filters, visi= t settings.<= /p>

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2b2a931e13670d753aa9570efe4= 98647ba1a4a7f
Gerrit-Change-Number: 1505
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --+KJtD3VpzGs=--