From: "plaisthos (Code Review)" Date: Thu, 18 Dec 2025 17:44:56 +0000 In-Reply-To: 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="xhJDTYk2YRo="; 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 --xhJDTYk2YRo= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello flichtenheld, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/894?usp=3Demail to look at the new patch set (#5). The following approvals got outdated and were removed: Code-Review-1 by flichtenheld Change subject: Fix warnings on Android about unused variables/methods ...................................................................... Fix warnings on Android about unused variables/methods Add the things we do not use to the print message to avoid ifdefs around the otherwise unused variables. Change-Id: I33d1d04b59c62e87ab61d768a7201124ccdabd07 Signed-off-by: Arne Schwabe --- M .github/workflows/build.yaml M src/openvpn/route.c M src/openvpn/tun.c 3 files changed, 13 insertions(+), 9 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/94/894/5 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ce730f6..11c2d65 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -58,7 +58,7 @@ -DCMAKE_SYSTEM_NAME=3DAndroid -DCMAKE_SYSTEM_VERSION=3D28 \ -DCMAKE_ANDROID_ARCH_ABI=3D${{ matrix.abi }} \ -DOPENSSL_ROOT_DIR=3D${VCPKG_INSTALLED_DIR}/${{ matrix.vcpkg_t= riplet }} \ - -DENABLE_PKCS11=3Dfalse -DBUILD_TESTING=3Dtrue -DENABLE_LZO=3D= false -DUSE_WERROR=3Dno + -DENABLE_PKCS11=3Dfalse -DBUILD_TESTING=3Dtrue -DENABLE_LZO=3D= false - name: Build OpenVPN Android binary with cmake run: cmake --build openvpn-build diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 770300a..222a0fa 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -102,6 +102,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) { @@ -123,6 +124,7 @@ return false; } } +#endif struct route_option_list * new_route_option_list(struct gc_arena *a) @@ -2035,9 +2037,7 @@ #if !defined(TARGET_AIX) const char *netmask; #endif -#if !defined(TARGET_ANDROID) const char *gateway; -#endif #else /* if !defined(TARGET_LINUX) */ int metric; #endif @@ -2056,10 +2056,8 @@ #if !defined(TARGET_AIX) netmask =3D print_in_addr_t(r->netmask, 0, &gc); #endif -#if !defined(TARGET_ANDROID) gateway =3D print_in_addr_t(r->gateway, 0, &gc); #endif -#endif is_local_route =3D local_route(r->network, r->netmask, r->gateway, rgi= ); if (is_local_route =3D=3D LR_ERROR) @@ -2165,9 +2163,13 @@ openvpn_execve_check(&argv, es, 0, "ERROR: OpenBSD/NetBSD route delete= command failed"); #elif defined(TARGET_ANDROID) + /* Avoids the unused variables warnings that all other platforms use + * by adding them to the error message. */ msg(D_ROUTE_DEBUG, "Deleting routes on Android is not possible/not " "needed. The VpnService API allows routes to be set= " - "on connect only and will clean up automatically."); + "on connect only and will clean up automatically. " + "Tried to delete route %s netmask %s gateway %s", + network, netmask, gateway); #elif defined(TARGET_AIX) { @@ -2349,7 +2351,10 @@ #elif defined(TARGET_ANDROID) msg(D_ROUTE_DEBUG, "Deleting routes on Android is not possible/not " "needed. The VpnService API allows routes to be set= " - "on connect only and will clean up automatically."); + "on connect only and will clean up automatically. " + "Tried to delete %s gateway %s", + network, + gateway_needed ? gateway : "(not needed)"); #elif defined(TARGET_HAIKU) /* ex: route delete /dev/net/ipro1000/0 inet6 :: gw beef::cafe prefixl= en 64 */ diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 409cecb..263c965 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -1806,7 +1806,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) { @@ -1973,7 +1973,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?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I33d1d04b59c62e87ab61d768a7201124ccdabd07 Gerrit-Change-Number: 894 Gerrit-PatchSet: 5 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld --xhJDTYk2YRo= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: flichtenheld, plaisthos.

plaisthos uploaded patch set #5 to this change.

<= a href=3D"http://gerrit.openvpn.net/c/openvpn/+/894?usp=3Demail">View Chang= e

The following approvals got outdated and were removed: Code-Review-1 by flichtenheld

Fix warnings on Android abou=
t unused variables/methods

Add the things we do not use to the print= message to
avoid ifdefs around the otherwise unused variables.

C= hange-Id: I33d1d04b59c62e87ab61d768a7201124ccdabd07
Signed-off-by: Arne = Schwabe <arne@...1227...>
---
M .github/workflows/build.yamlM src/openvpn/route.c
M src/openvpn/tun.c
3 files changed, 13 insert= ions(+), 9 deletions(-)

git pull ssh://gerrit.op=
envpn.net:29418/openvpn refs/changes/94/894/5
diff --git a/.github/=
workflows/build.yaml b/.github/workflows/build.yaml
index c= e730f6..11c2d65 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -58,7 = +58,7 @@
-DCMAKE_SYSTEM_NAME=3DAndroid -DCMAKE= _SYSTEM_VERSION=3D28 \
-DCMAKE_ANDROID_ARCH_AB= I=3D${{ matrix.abi }} \
-DOPENSSL_ROOT_DIR=3D$= {VCPKG_INSTALLED_DIR}/${{ matrix.vcpkg_triplet }} \
- -DENABLE_PKCS11=3Dfalse -DBUILD= _TESTING=3Dtrue -DENABLE_LZO=3Dfalse -DUSE_WERROR=3Dno
+ -DENABLE_PKCS11=3Dfalse -DBU= ILD_TESTING=3Dtrue -DENABLE_LZO=3Dfalse
- name: Buil= d OpenVPN Android binary with cmake
run: cmake --b= uild openvpn-build

diff --git a/src/openv= pn/route.c b/src/openvpn/route.c
index 770300a..222a0fa 100= 644
--- a/src/openvpn/route.c
+++ b/src/ope= nvpn/route.c
@@ -102,6 +102,7 @@
#define R= TA_SUCCESS 1 /* route addition succeeded */
#define RTA_EE= XIST 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)
{
@@ -123,6= +124,7 @@
return false;
}
}
+#en= dif

struct route_option_list * new_route_option_list(struct gc_arena *a)
@@ -2035,= 9 +2037,7 @@
#if !defined(TARGET_AIX)
= const char *netmask;
#endif
-#if !defined(TARGET_ANDROID)
c= onst char *gateway;
-#e= ndif
#else /* if !defined(TARGET_LINUX) */
int metric;

#endif
@@ -2056,10 +2056= ,8 @@
#if !defined(TARGET_AIX)
netmas= k =3D print_in_addr_t(r->netmask, 0, &gc);
#endif
-#if !defined(TARGET_AND= ROID)
gateway =3D print_in_addr_t(r->gateway, 0, &a= mp;gc);
#endif
-#endif

is_local_route =3D = local_route(r->network, r->netmask, r->gateway, rgi);
if (is_local_route =3D=3D LR_ERROR)

@@ -2165,9 +21= 63,13 @@
openvpn_execve_check(&argv, es, 0, "= ERROR: OpenBSD/NetBSD route delete command failed");
=
#elif defined(TARGET_ANDROID)
+ /* Avoids the unused variables warnings tha= t all other platforms use
+ * by adding them to the error message. */
m= sg(D_ROUTE_DEBUG, "Deleting routes on Android is not possible/not &quo= t;
"needed. The VpnService API= allows routes to be set "
- "on connect only and will clean up au= tomatically.");
= + "on connect only and will clean up automatical= ly. "
+ = "Tried to delete route %s netmask %s gateway %s",
+ network, netm= ask, gateway);
#elif defined(TARGET_AIX)
=
{
@@ -2349,7 +2351,10 @@
#elif defined(TARGET_ANDROID)

msg(D_ROUTE_DEBUG, = "Deleting routes on Android is not possible/not "
"needed. The VpnService API allows routes to = be set "

- = "on connect only and will clean up automatically."= );
+ = "on connect only and will clean up automatically. "<= br>+ &quo= t;Tried to delete %s gateway %s",
+ network,
+ gateway_needed ? gateway : "(not needed)"= );
#elif defined(TARGET_HAIKU)
/* ex: route delete /dev/net/ipro1000/0 inet6 :: gw beef::cafe = prefixlen 64 */
diff --git a/src/openvpn/tun.c b/src/openvp= n/tun.c
index 409cecb..263c965 100644
--- a= /src/openvpn/tun.c
+++ b/src/openvpn/tun.c
= @@ -1806,7 +1806,7 @@
#endif

<= span>

-#if !(defined(_= WIN32) || defined(TARGET_LINUX) || defined(TARGET_SOLARIS))
+#if !(defined(_WIN32) || defined(TA= RGET_LINUX) || defined(TARGET_SOLARIS) || defined(TARGET_ANDROID)) static void
open_tun_generic(const char *dev, con= st char *dev_type, const char *dev_node, struct tuntap *tt)
{
@@ -1973,7 +1973,6 @@
openvpn= _net_ctx_t *ctx)
{
#define ANDROID_TUNNAM= E "vpnservice-tun"
- struct user_pass up;
struct gc_arena gc =3D= gc_new();
bool opentun;

<= span>

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

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I33d1d04b59c62e87ab61d768a72= 01124ccdabd07
Gerrit-Change-Number: 894
Gerrit-PatchSet: 5
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: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
= --xhJDTYk2YRo=--