From: "plaisthos (Code Review)" Date: Fri, 14 Feb 2025 15:32:47 +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="T9a61sMeG+4="; 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 --T9a61sMeG+4= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld. Hello flichtenheld,=20 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 (#4). 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 .github/workflows/build.yaml M src/openvpn/route.c M src/openvpn/tun.c 3 files changed, 14 insertions(+), 9 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/94/894/4 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b1af7ec..ce0fb74 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -61,7 +61,7 @@ - name: Install dependencies run: ${VCPKG_ROOT}/vcpkg install openssl lz4 cmocka - name: configure OpenVPN with cmake - run: cmake -S . -B openvpn-build -DUNSUPPORTED_BUILDS=3Dyes -DCMAK= E_SYSTEM_NAME=3DAndroid -DOPENSSL_ROOT_DIR=3D${VCPKG_INSTALLED_DIR}/${{ mat= rix.vcpkg_triplet }} -DENABLE_PKCS11=3Dfalse -DBUILD_TESTING=3Dtrue -DCMAKE= _ANDROID_ARCH_ABI=3D${{ matrix.abi }} -DENABLE_LZO=3Dfalse -DUSE_WERROR=3Dno + run: cmake -S . -B openvpn-build -DUNSUPPORTED_BUILDS=3Dyes -DCMAK= E_SYSTEM_NAME=3DAndroid -DOPENSSL_ROOT_DIR=3D${VCPKG_INSTALLED_DIR}/${{ mat= rix.vcpkg_triplet }} -DENABLE_PKCS11=3Dfalse -DBUILD_TESTING=3Dtrue -DCMAKE= _ANDROID_ARCH_ABI=3D${{ matrix.abi }} -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 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: 4 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-MessageType: newpatchset --T9a61sMeG+4= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld.

plaisthos uploaded patch set #4 to this change.

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

Fix warnings on Android about unused variables/methods

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

Change-Id: I33d1d04b59c62e87ab61d768a7201124ccdabd07
Signe= d-off-by: Arne Schwabe <arne@...1227...>
---
M .github/workflow= s/build.yaml
M src/openvpn/route.c
M src/openvpn/tun.c
3 files cha= nged, 14 insertions(+), 9 deletions(-)

git pull ssh://gerrit.open=
vpn.net:29418/openvpn refs/changes/94/894/4
diff --git a/.github/wo=
rkflows/build.yaml b/.github/workflows/build.yaml
index b1a= f7ec..ce0fb74 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -61,7 +6= 1,7 @@
- name: Install dependencies
= run: ${VCPKG_ROOT}/vcpkg install openssl lz4 cmocka
- name: configure OpenVPN with cmake

- run: cmake -S . -B openvpn-build -DUNSUPPOR= TED_BUILDS=3Dyes -DCMAKE_SYSTEM_NAME=3DAndroid -DOPENSSL_ROOT_DIR=3D${VCPKG= _INSTALLED_DIR}/${{ matrix.vcpkg_triplet }} -DENABLE_PKCS11=3Dfalse -DBUILD= _TESTING=3Dtrue -DCMAKE_ANDROID_ARCH_ABI=3D${{ matrix.abi }} -DENABLE_LZO= =3Dfalse -DUSE_WERROR=3Dno
+ run: cmake -S . -B openvpn-build -DUNSUPPORTED_BUILDS=3Dyes = -DCMAKE_SYSTEM_NAME=3DAndroid -DOPENSSL_ROOT_DIR=3D${VCPKG_INSTALLED_DIR}/$= {{ matrix.vcpkg_triplet }} -DENABLE_PKCS11=3Dfalse -DBUILD_TESTING=3Dtrue -= DCMAKE_ANDROID_ARCH_ABI=3D${{ matrix.abi }} -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
i= ndex 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 exist= s */

+#endif /* ifndef TARGET_ANDROID */

struct route_option_list *
new_route_= option_list(struct gc_arena *a)
@@ -750,6 +752,7 @@<= br> * (not the most beautiful implementation in the world, but porta= ble and
* "good enough")
*/
+#ifndef TARGET_ANDROI= D
static bool
route_ipv6_match_host( cons= t struct route_ipv6 *r6,
const stru= ct in6_addr *host )
@@ -785,6 +788,7 @@

return false;
}
+#endif /* ifndef TARGET_ANDROID */=

bool
init_route_ipv6_list(str= uct route_ipv6_list *rl6,
@@ -2183,7 +2187,7 @@
<= span> 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<= br>-#else /* if !defined(TARGET_= LINUX) */
+#else /* = if !defined(TARGET_LINUX) && !defined(TARGET_ANDROID) */
= +#if !defined(TARGET_ANDROID)
int metric;
#endif
+#endif
int is_loca= l_route;

if ((r->flags & (RT_= DEFINED|RT_ADDED)) !=3D (RT_DEFINED|RT_ADDED))
@@ -2204,7 += 2210,7 @@
struct gc_arena gc =3D gc_new();
<= span> struct argv argv =3D argv_new();


-#if !defined(TARGET_LINUX)
+#if !defined(TARGET_LINUX) &a= mp;& !defined(TARGET_ANDROID)
network =3D print_in= _addr_t(r->network, 0, &gc);
#if !defined(TARGET_AI= X)
netmask =3D print_in_addr_t(r->netmask, 0, &= gc);
@@ -2394,10 +2400,10 @@
}<= br>
#if !defined(_WIN32)
-#if !defined(TARGET_LINUX)
+#if !defined(TARGET_LINUX) && !de= fined(TARGET_ANDROID)
const char *gateway;
<= span> #endif

-#if !defi= ned(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 N= ULL) /* vpn server special route */
@@ -2421,7= +2427,7 @@
struct argv argv =3D argv_new();
network =3D print_in6_addr( r6->network, 0= , &gc);
-#if !defin= ed(TARGET_LINUX) && !defined(_WIN32)
+#if !defined(TARGET_LINUX) && !defined(_WI= N32) && !defined(TARGET_ANDROID)
gateway =3D p= rint_in6_addr( r6->gateway, 0, &gc);
#endif<= br>
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
@@ -1= 888,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 ch= ar *dev_type, const char *dev_node,
struc= t tuntap *tt)
@@ -2062,7 +2062,6 @@
= openvpn_net_ctx_t *ctx)
{
#define ANDR= OID_TUNNAME "vpnservice-tun"
- struct user_pass up;
struct gc_ar= ena gc =3D gc_new();
bool opentun;


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

<= /div>
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I33d1d04b59c62e87ab61d768a72= 01124ccdabd07
Gerrit-Change-Number: 894
Gerrit-PatchSet: 4
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: newpatchset
--T9a61sMeG+4=--