]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Remove workaround for Android 4.4
authorArne Schwabe <arne@rfc2549.org>
Wed, 4 May 2022 11:18:02 +0000 (13:18 +0200)
committerGert Doering <gert@greenie.muc.de>
Thu, 5 May 2022 14:05:17 +0000 (16:05 +0200)
Android 4.4 is now 9 years old and the main user of this API (OpenVPN
for Android) does not support this OS anymore. This workaround
is now safe to remove.

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

index 9b03b057584195d4b1fb051b45f5483e9dfe203a..e305e44221a99288e3b078fc6fe69bfc93ee27f9 100644 (file)
@@ -2140,10 +2140,6 @@ managment_android_persisttun_action(struct management *man)
     {
         return ANDROID_KEEP_OLD_TUN;
     }
-    else if (!strcmp("OPEN_AFTER_CLOSE", up.password))
-    {
-        return ANDROID_OPEN_AFTER_CLOSE;
-    }
     else if (!strcmp("OPEN_BEFORE_CLOSE", up.password))
     {
         return ANDROID_OPEN_BEFORE_CLOSE;
@@ -2154,7 +2150,7 @@ managment_android_persisttun_action(struct management *man)
     }
 
     ASSERT(0);
-    return ANDROID_OPEN_AFTER_CLOSE;
+    return ANDROID_OPEN_BEFORE_CLOSE;
 }
 
 
index 2c35183a8f248e1f5d72e328f8cc71d02a79dd78..44a5d964bf4bb9cdcd5ec52083166f4b571bacc8 100644 (file)
@@ -383,8 +383,7 @@ bool management_query_user_pass(struct management *man,
 bool management_android_control(struct management *man, const char *command, const char *msg);
 
 #define ANDROID_KEEP_OLD_TUN 1
-#define ANDROID_OPEN_AFTER_CLOSE 2
-#define ANDROID_OPEN_BEFORE_CLOSE 3
+#define ANDROID_OPEN_BEFORE_CLOSE 2
 int managment_android_persisttun_action(struct management *man);
 
 #endif
index 394b9364da7c47aa3f64ac27f244e594297dcc61..e12f0369dfb85bdc73d6bd820d93d016aa86e0a3 100644 (file)
@@ -1879,13 +1879,6 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun
 
     int android_method = managment_android_persisttun_action(management);
 
-    /* Android 4.4 workaround */
-    if (oldtunfd >=0 && android_method == ANDROID_OPEN_AFTER_CLOSE)
-    {
-        close(oldtunfd);
-        management_sleep(2);
-    }
-
     if (oldtunfd >=0  && android_method == ANDROID_KEEP_OLD_TUN)
     {
         /* keep the old fd */
@@ -1900,7 +1893,7 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun
         management->connection.lastfdreceived = -1;
     }
 
-    if (oldtunfd>=0 && android_method == ANDROID_OPEN_BEFORE_CLOSE)
+    if (oldtunfd >= 0 && android_method == ANDROID_OPEN_BEFORE_CLOSE)
     {
         close(oldtunfd);
     }