[Openvpn-devel,4/4] Avoid unused function warning/error on FreeBSD

Message ID 20230629215611.3292788-6-arne@rfc2549.org
State Superseded
Headers show
Series Restore ability to compile on macOS/FreeBSD with Cmake | expand

Commit Message

Arne Schwabe June 29, 2023, 9:56 p.m. UTC
the funktion is_on_link is not used on FreeBSD and triggers a
warning/error (-Werror) on 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

Frank Lichtenheld June 30, 2023, 10:48 a.m. UTC | #1
On Thu, Jun 29, 2023 at 11:56:11PM +0200, Arne Schwabe wrote:
> the funktion is_on_link is not used on FreeBSD and triggers a
> warning/error (-Werror) on FreeBSD.
> 
> Change-Id: I6757d6509ff3ff522d6de417372a21e73ccca3ba
> Signed-off-by: Arne Schwabe <arne@rfc2549.org>
> ---
>  src/openvpn/route.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/openvpn/route.c b/src/openvpn/route.c
> index d18acd016..2180b7d1a 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. */
> +#ifndef TARGET_FREEBSD

The actual condition seems to be

#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,

Regards,

Patch

diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index d18acd016..2180b7d1a 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. */
+#ifndef TARGET_FREEBSD
 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,