From: "plaisthos (Code Review)" Date: Thu, 13 Feb 2025 15:25:07 +0000 References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="EXSA7728tv0="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Fix warnings on Android about unused variables/methods List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: openvpn-devel --EXSA7728tv0= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=3Demail 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 --- 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 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)) !=3D (RT_DEFINED|RT_ADDED)) @@ -2204,7 +2210,7 @@ struct gc_arena gc =3D gc_new(); struct argv argv =3D argv_new(); -#if !defined(TARGET_LINUX) +#if !defined(TARGET_LINUX) && !defined(TARGET_ANDROID) network =3D print_in_addr_t(r->network, 0, &gc); #if !defined(TARGET_AIX) netmask =3D 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 =3D false; const char *device =3D tt->actual_name; if (r6->iface !=3D NULL) /* vpn server special route */ @@ -2421,7 +2427,7 @@ struct argv argv =3D argv_new(); network =3D print_in6_addr( r6->network, 0, &gc); -#if !defined(TARGET_LINUX) && !defined(_WIN32) +#if !defined(TARGET_LINUX) && !defined(_WIN32) && !defined(TARGET_ANDROID) gateway =3D 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_no= de, 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 =3D gc_new(); bool opentun; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/894?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I33d1d04b59c62e87ab61d768a7201124ccdabd07 Gerrit-Change-Number: 894 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --EXSA7728tv0= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld.

plaisthos would like flichtenheld to review this change.

Vi= ew Change

Fix warnings on Android about unused variables/methods
The changes to route.c are a bit messy but they mostly modify already
e= xisting ifdefs

Change-Id: I33d1d04b59c62e87ab61d768a7201124ccdabd07<= br>Signed-off-by: Arne Schwabe <arne@...1227...>
---
M src/open= vpn/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
diff --git a/src/openvpn/route.c b/src/openvpn/ro=
ute.c
index d895e1c..1601275 100644
--- a/s= rc/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -104,6 +104,7 @@
#define RTA_SUCCESS 1 /* route add= ition succeeded */
#define RTA_EEXIST 2 /* route not ad= ded as it already exists */

+#ifndef TARGET_ANDROID
static bo= ol
add_bypass_address(struct route_bypass *rb, const in_ad= dr_t a)
{
@@ -125,6 +126,7 @@
return false;
}
}=
+#endif /* ifndef TARGET_AN= DROID */

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
rout= e_ipv6_match_host( const struct route_ipv6 *r6,
= const struct in6_addr *host )
@@ -785,6 +788,7= @@

return false;
}=
+#endif /* ifndef TA= RGET_ANDROID */

bool
in= it_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 *netw= ork;
#if !defined(TARGET_AIX)
const c= har *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 !def= ined(TARGET_ANDROID)
int metric;
#end= if
+#endif
= int is_local_route;

if ((= r->flags & (RT_DEFINED|RT_ADDED)) !=3D (RT_DEFINED|RT_ADDED))=
@@ -2204,7 +2210,7 @@
struct gc_arena gc =3D= gc_new();
struct argv argv =3D argv_new();
=
-#if !defined(T= ARGET_LINUX)
+#if !de= fined(TARGET_LINUX) && !defined(TARGET_ANDROID)
= network =3D print_in_addr_t(r->network, 0, &gc);
= #if !defined(TARGET_AIX)
netmask =3D 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(TARG= ET_ANDROID)
bool gateway_needed =3D false;
<= span> const char *device =3D tt->actual_name;

i= f (r6->iface !=3D NULL) /* vpn server special route */
@@ -2421,7 +2427,7 @@
struct argv argv =3D= argv_new();

network =3D print_in6_a= ddr( r6->network, 0, &gc);
-#if !defined(TARGET_LINUX) && !defined(_WIN32)+#if !defined(TARGET_LINUX) &= amp;& !defined(_WIN32) && !defined(TARGET_ANDROID)
gateway =3D print_in6_addr( r6->gateway, 0, &gc);
#endif

diff --git a/src/openvpn/t= un.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(_WIN= 32) || defined(TARGET_LINUX) || defined(TARGET_SOLARIS) || defined(TARGET_A= NDROID))
static void
open_tun_generic(con= st char *dev, const char *dev_type, const char *dev_node,
= struct tuntap *tt)
@@ -2062,7 +2062,6 @@
openvpn_net_ctx_t *ctx)
{<= br> #define ANDROID_TUNNAME "vpnservice-tun"
- struct user_pass up;

<= span> struct gc_arena gc =3D gc_new();

bool opentu= n;


To view, visit change 894. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I33d1d04b59c62e87ab61d768a72= 01124ccdabd07
Gerrit-Change-Number: 894
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--EXSA7728tv0=--