]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
android: Don't use infinite keying tries on Android 5+
authorTobias Brunner <tobias@strongswan.org>
Fri, 29 Jun 2018 09:41:41 +0000 (11:41 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 3 Jul 2018 09:31:43 +0000 (11:31 +0200)
This way we get some feedback about the issue in the GUI (otherwise it
would just switch to connecting state) and also some delays between retries.

src/frontends/android/app/src/main/jni/libandroidbridge/android_jni.h
src/frontends/android/app/src/main/jni/libandroidbridge/backend/android_service.c

index aab12c4128a459d9a5a9866177ad9cbdb38ee4b5..918c14c5ef1ae4f43f44b06e50b892d438e5ee47 100644 (file)
@@ -57,6 +57,7 @@ typedef enum {
        ANDROID_JELLY_BEAN = 16,
        ANDROID_JELLY_BEAN_MR1 = 17,
        ANDROID_JELLY_BEAN_MR2 = 18,
+       ANDROID_LOLLIPOP = 21,
 } android_sdk_version_t;
 
 /**
index 599f61852ac49394838ac0c5dea6e34b580cb6e2..a1a51b7b52c5d8daff0728f5c8449aefa57664a7 100644 (file)
@@ -18,6 +18,7 @@
 #include <errno.h>
 #include <unistd.h>
 
+#include "android_jni.h"
 #include "android_service.h"
 #include "android_dns_proxy.h"
 #include "../charonservice.h"
@@ -761,6 +762,11 @@ static job_requeue_t initiate(private_android_service_t *this)
        int port;
        bool certreq;
 
+       if (android_sdk_version >= ANDROID_LOLLIPOP)
+       {   /* only try once and notify the GUI on Android 5+ where we have a blocking TUN device */
+               peer.keyingtries = 1;
+       }
+
        server = this->settings->get_str(this->settings, "connection.server", NULL);
        port = this->settings->get_int(this->settings, "connection.port",
                                                                   IKEV2_UDP_PORT);