[Openvpn-devel,v2,4/4] Avoid unused function warning/error on FreeBSD (and potientially others)

Message ID 20230701202453.3517822-2-arne@rfc2549.org
State Accepted
Headers show
Series None | expand

Commit Message

Arne Schwabe July 1, 2023, 8:24 p.m. UTC
the funktion is_on_link is not used on FreeBSD and triggers a
warning/error (-Werror) on FreeBSD.

Patch v2: use actual platforms instead an ifndef FreeBSD

Change-Id: I6757d6509ff3ff522d6de417372a21e73ccca3ba
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
 src/openvpn/route.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Gert Doering July 2, 2023, 8:34 a.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

Checked route.c: is_on_link() shows up 4 times, Linux, WIN32 and 2x DARWIN,
so this should be fine.  Tested by pushing to buildbot and GHA.

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

commit 99035769233fb1186b72cd8e1e9966a0d077e53d (master)
commit 6cadac3cf86da918f1f83f77e9ab2129c7b60954 (release/2.6)
Author: Arne Schwabe
Date:   Sat Jul 1 22:24:53 2023 +0200

     Avoid unused function warning/error on FreeBSD (and potientially others)

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20230701202453.3517822-2-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26804.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 d18acd016..0d04a5a33 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -1541,13 +1541,15 @@  local_route(in_addr_t network,
     return LR_NOMATCH;
 }
 
-/* Return true if the "on-link" form of the route should be used.  This is when the gateway for a
+/* 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)
 static inline bool
 is_on_link(const int is_local_route, const unsigned int flags, const struct route_gateway_info *rgi)
 {
     return rgi && (is_local_route == LR_MATCH || ((flags & ROUTE_REF_GW) && (rgi->flags & RGI_ON_LINK)));
 }
+#endif
 
 bool
 add_route(struct route_ipv4 *r,