[Openvpn-devel] Ignore Ipv6 route delete request on Android and set ipv4 verbosity to 7

Message ID 20230712094620.569273-1-arne@rfc2549.org
State Accepted
Headers show
Series [Openvpn-devel] Ignore Ipv6 route delete request on Android and set ipv4 verbosity to 7 | expand

Commit Message

Arne Schwabe July 12, 2023, 9:46 a.m. UTC
Android has no facility nor need one to delete routes as routes are
automatically cleaned up when the tun interface is closed. Also adjust
the IPv4 message to be only shown and verb 7 and rephrase the message.

Change-Id: If8f920d378c31e9ea773ce1f56f3df50f1ec36cd
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
 src/openvpn/route.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Gert Doering July 17, 2023, 5 p.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

"because it makes sense"

Not tested beyond stare-at-code and have GHA do a test build, because
this is all #ifdef TARGET_ANDROID, and "only msg() calls" at that.

Uncrustify complains about indentation, so whitespace adjusted accordingly.

Your patch has been applied to the master and release/2.6 branch (one
could argue that branch, but it's "fix a misleading error message" so
it qualifies as a mini bugfix).  Not applying to 2.5 or 2.4 :-)

commit ab01eaf49fa9341ff647206bd6e3017770cc0674 (master)
commit 4ed7d7f72515c7df34edf617cb0bb8f2ac533e48 (release/2.6)
Author: Arne Schwabe
Date:   Wed Jul 12 11:46:20 2023 +0200

     Ignore Ipv6 route delete request on Android and set ipv4 verbosity to 7

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20230712094620.569273-1-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26848.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index 0b369da44..6028de9c2 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -2302,8 +2302,9 @@  delete_route(struct route_ipv4 *r,
     openvpn_execve_check(&argv, es, 0, "ERROR: OpenBSD/NetBSD route delete command failed");
 
 #elif defined(TARGET_ANDROID)
-    msg(M_NONFATAL, "Sorry, deleting routes on Android is not possible. The VpnService API allows routes to be set on connect only.");
-
+    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.");
 #elif defined(TARGET_AIX)
 
     {
@@ -2490,7 +2491,10 @@  delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,
                 network, r6->netbits, gateway);
     argv_msg(D_ROUTE, &argv);
     openvpn_execve_check(&argv, es, 0, "ERROR: AIX route add command failed");
-
+#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.");
 #else  /* if defined(TARGET_LINUX) */
     msg(M_FATAL, "Sorry, but I don't know how to do 'route ipv6' commands on this operating system.  Try putting your routes in a --route-down script");
 #endif /* if defined(TARGET_LINUX) */