]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
route: Fix type of rgi_needed variables
authorFrank Lichtenheld <frank@lichtenheld.com>
Thu, 5 Mar 2026 08:49:08 +0000 (09:49 +0100)
committerGert Doering <gert@greenie.muc.de>
Fri, 6 Mar 2026 16:19:01 +0000 (17:19 +0100)
To avoid unneccesary sign-compare warnings.

Change-Id: I2b2a931e13670d753aa9570efe498647ba1a4a7f
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1505
Message-Id: <20260305084914.1327-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35926.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/route.c

index 329f3b043e6750801ef25c5871c6ea1ec449d4f3..b1967133758aee768e39a1e2f30618b4885e7892 100644 (file)
@@ -570,11 +570,6 @@ add_block_local_item(struct route_list *rl, const struct route_gateway_address *
     }
 }
 
-#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 @@ add_block_local_routes(struct route_list *rl)
 bool
 block_local_needed(const struct route_list *rl)
 {
-    const int rgi_needed = (RGI_ADDR_DEFINED | RGI_NETMASK_DEFINED);
+    const unsigned int rgi_needed = (RGI_ADDR_DEFINED | RGI_NETMASK_DEFINED);
     return (rl->flags & RG_BLOCK_LOCAL) && (rl->rgi.flags & rgi_needed) == rgi_needed
            && (rl->spec.flags & RTSA_REMOTE_ENDPOINT) && rl->spec.remote_host_local != 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 @@ setenv_routes_ipv6(struct env_set *es, const struct route_ipv6_list *rl6)
 #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 = (RGI_ADDR_DEFINED | RGI_NETMASK_DEFINED | RGI_IFACE_DEFINED);
+    const unsigned int rgi_needed = (RGI_ADDR_DEFINED | RGI_NETMASK_DEFINED | RGI_IFACE_DEFINED);
     if (rgi && (rgi->flags & rgi_needed) == rgi_needed && gateway == rgi->gateway.addr
         && netmask == 0xFFFFFFFF)
     {
@@ -1479,10 +1465,6 @@ local_route(in_addr_t network, in_addr_t netmask, in_addr_t gateway,
     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)