android: Don't use infinite keying tries on Android 5+

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.
This commit is contained in:
Tobias Brunner
2018-07-03 11:31:43 +02:00
parent a2b3122865
commit ef0f0cc839
2 changed files with 7 additions and 0 deletions
@@ -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;
/**
@@ -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);