[Openvpn-devel,S] Change in openvpn[master]: Fix warnings on Android about unused variables/methods

Message ID eafe408ad49c84f86ff6a0c02d53b5f6ab662e74-HTML@gerrit.openvpn.net
State New
Headers show
Series [Openvpn-devel,S] Change in openvpn[master]: Fix warnings on Android about unused variables/methods | expand

Commit Message

stipa (Code Review) Feb. 13, 2025, 3:25 p.m. UTC
Attention is currently required from: flichtenheld.

Hello flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/894?usp=email

to review the following change.


Change subject: Fix warnings on Android about unused variables/methods
......................................................................

Fix warnings on Android about unused variables/methods

The changes to route.c are a bit messy but they mostly modify already
existing ifdefs

Change-Id: I33d1d04b59c62e87ab61d768a7201124ccdabd07
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
M src/openvpn/route.c
M src/openvpn/tun.c
2 files changed, 13 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/94/894/1

Patch

diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index d895e1c..1601275 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -104,6 +104,7 @@ 
 #define RTA_SUCCESS 1   /* route addition succeeded */
 #define RTA_EEXIST  2   /* route not added as it already exists */
 
+#ifndef TARGET_ANDROID
 static bool
 add_bypass_address(struct route_bypass *rb, const in_addr_t a)
 {
@@ -125,6 +126,7 @@ 
         return false;
     }
 }
+#endif /* ifndef TARGET_ANDROID */
 
 struct route_option_list *
 new_route_option_list(struct gc_arena *a)
@@ -750,6 +752,7 @@ 
  * (not the most beautiful implementation in the world, but portable and
  * "good enough")
  */
+#ifndef TARGET_ANDROID
 static bool
 route_ipv6_match_host( const struct route_ipv6 *r6,
                        const struct in6_addr *host )
@@ -785,6 +788,7 @@ 
 
     return false;
 }
+#endif /* ifndef TARGET_ANDROID */
 
 bool
 init_route_ipv6_list(struct route_ipv6_list *rl6,
@@ -2183,7 +2187,7 @@ 
              const struct env_set *es,
              openvpn_net_ctx_t *ctx)
 {
-#if !defined(TARGET_LINUX)
+#if !defined(TARGET_LINUX) && !defined(TARGET_ANDROID)
     const char *network;
 #if !defined(TARGET_AIX)
     const char *netmask;
@@ -2191,9 +2195,11 @@ 
 #if !defined(TARGET_ANDROID)
     const char *gateway;
 #endif
-#else  /* if !defined(TARGET_LINUX) */
+#else  /* if !defined(TARGET_LINUX) && !defined(TARGET_ANDROID) */
+#if !defined(TARGET_ANDROID)
     int metric;
 #endif
+#endif
     int is_local_route;
 
     if ((r->flags & (RT_DEFINED|RT_ADDED)) != (RT_DEFINED|RT_ADDED))
@@ -2204,7 +2210,7 @@ 
     struct gc_arena gc = gc_new();
     struct argv argv = argv_new();
 
-#if !defined(TARGET_LINUX)
+#if !defined(TARGET_LINUX) && !defined(TARGET_ANDROID)
     network = print_in_addr_t(r->network, 0, &gc);
 #if !defined(TARGET_AIX)
     netmask = print_in_addr_t(r->netmask, 0, &gc);
@@ -2394,10 +2400,10 @@ 
     }
 
 #if !defined(_WIN32)
-#if !defined(TARGET_LINUX)
+#if !defined(TARGET_LINUX) && !defined(TARGET_ANDROID)
     const char *gateway;
 #endif
-#if !defined(TARGET_SOLARIS)
+#if !defined(TARGET_SOLARIS) && !defined(TARGET_ANDROID)
     bool gateway_needed = false;
     const char *device = tt->actual_name;
     if (r6->iface != NULL)              /* vpn server special route */
@@ -2421,7 +2427,7 @@ 
     struct argv argv = argv_new();
 
     network = print_in6_addr( r6->network, 0, &gc);
-#if !defined(TARGET_LINUX) && !defined(_WIN32)
+#if !defined(TARGET_LINUX) && !defined(_WIN32) && !defined(TARGET_ANDROID)
     gateway = print_in6_addr( r6->gateway, 0, &gc);
 #endif
 
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 80f5dff..d2c5191 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -1888,7 +1888,7 @@ 
 #endif
 
 
-#if !(defined(_WIN32) || defined(TARGET_LINUX) || defined(TARGET_SOLARIS))
+#if !(defined(_WIN32) || defined(TARGET_LINUX) || defined(TARGET_SOLARIS) || defined(TARGET_ANDROID))
 static void
 open_tun_generic(const char *dev, const char *dev_type, const char *dev_node,
                  struct tuntap *tt)
@@ -2062,7 +2062,6 @@ 
          openvpn_net_ctx_t *ctx)
 {
 #define ANDROID_TUNNAME "vpnservice-tun"
-    struct user_pass up;
     struct gc_arena gc = gc_new();
     bool opentun;