From: "cron2 (Code Review)" Date: Mon, 29 Dec 2025 16:09:31 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <6e0919efb81a2a4e45749c03d09a10c96e3779a4-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="3UH1lv72+3o="; 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: plaisthos , flichtenheld Cc: openvpn-devel --3UH1lv72+3o= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#6) to the change originally created by= plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/894?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 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 Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/894 Message-Id: <20251219134706.164040-1-frank@...2641...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 156.html Signed-off-by: Gert Doering --- 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/6 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: 6 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel --3UH1lv72+3o= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #6 to the change originally created by plaisthos.<= /p>

Vie= w Change

The following approvals got outdated and were removed: Code-Review+2 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...>
Acked-by: Frank Lichtenheld <frank@...1186...= .2641...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/894
M= essage-Id: <20251219134706.164040-1-frank@...2641...>
URL: https:/= /www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35156.html
= Signed-off-by: Gert Doering <gert@...1296...>
---
M .github/wor= kflows/build.yaml
M src/openvpn/route.c
M src/openvpn/tun.c
3 file= s changed, 13 insertions(+), 9 deletions(-)

git =
pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/94/894/6
d= iff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index ce730f6..11c2d65 100644
--- a/.github/wo= rkflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -58,7 +58,7 @@
-DCMAKE_SYSTEM_NA= ME=3DAndroid -DCMAKE_SYSTEM_VERSION=3D28 \
-DC= MAKE_ANDROID_ARCH_ABI=3D${{ matrix.abi }} \
-D= OPENSSL_ROOT_DIR=3D${VCPKG_INSTALLED_DIR}/${{ matrix.vcpkg_triplet }} \
- -DENABLE_PKCS= 11=3Dfalse -DBUILD_TESTING=3Dtrue -DENABLE_LZO=3Dfalse -DUSE_WERROR=3Dno
+ -DENABLE_P= KCS11=3Dfalse -DBUILD_TESTING=3Dtrue -DENABLE_LZO=3Dfalse
= - 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 77= 0300a..222a0fa 100644
--- a/src/openvpn/route.c
<= span>+++ 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_add= ress(struct route_bypass *rb, const in_addr_t a)
{<= br>@@ -123,6 +124,7 @@
return false;<= br> }
}
+#endif

struct route_optio= n_list *
new_route_option_list(struct gc_arena *a)<= br>@@ -2035,9 +2037,7 @@
#if !defined(TARGET_AIX)
const char *netmask;
#endif
<= span style=3D"color: hsl(0, 100%, 40%);">-#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);<= br> #endif
-#if != defined(TARGET_ANDROID)
gateway =3D print_in_addr_t(r-= >gateway, 0, &gc);
#endif
-#endif

i= s_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(&a= rgv, es, 0, "ERROR: OpenBSD/NetBSD route delete command failed");=

#elif defined(TARGET_ANDROID)+ /* Avoids the unused vari= ables 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 an= d will clean up automatically.");
+ "on connect only and will cl= ean up automatically. "
+ "Tried to delete route %s netmask %s g= ateway %s",
+ = network, netmask, gateway);
#elif defined(TARGET_AIX)=

{
@@ -2349,7 +2351,= 10 @@
#elif defined(TARGET_ANDROID)
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 %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/openvpn/tun.c
index 409cecb..263c965 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.= c
@@ -1806,7 +1806,7 @@
#endif
<= span>


+#if !(defined(_WI= N32) || defined(TARGET_LINUX) || defined(TARGET_SOLARIS) || defined(TARGET_= ANDROID))
static void
open_tun_generic(co= nst char *dev, const char *dev_type, const char *dev_node, struct tuntap *t= t)
{
@@ -1973,7 +1973,6 @@
openvpn_net_ctx_t *ctx)

{
#def= ine ANDROID_TUNNAME "vpnservice-tun"
- struct user_pass up;
stru= ct gc_arena gc =3D gc_new();
bool opentun;
<= span>


To view, visit change 894. To unsubsc= ribe, 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: 6
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --3UH1lv72+3o=--