summaryrefslogtreecommitdiff
path: root/openvpn
diff options
context:
space:
mode:
Diffstat (limited to 'openvpn')
-rw-r--r--openvpn/src/openvpn/jniglue.c18
-rw-r--r--openvpn/src/openvpn/jniglue.h3
-rw-r--r--openvpn/src/openvpn/options.c6
-rw-r--r--openvpn/src/openvpn/tun.c7
-rw-r--r--openvpn/src/openvpn/tun.h3
5 files changed, 35 insertions, 2 deletions
diff --git a/openvpn/src/openvpn/jniglue.c b/openvpn/src/openvpn/jniglue.c
index 2d529365..686092bc 100644
--- a/openvpn/src/openvpn/jniglue.c
+++ b/openvpn/src/openvpn/jniglue.c
@@ -143,6 +143,24 @@ int android_open_tun () {
}
+void android_set_dns(const char* dns) {
+ jmethodID aMethodID = (*openvpnjenv)->GetStaticMethodID(openvpnjenv, openvpnclass, "addDns",
+ "(Ljava/lang/String;)V");
+ jstring jdns = (*openvpnjenv)->NewStringUTF(openvpnjenv,dns);
+ (*openvpnjenv)->CallStaticVoidMethod(openvpnjenv,openvpnclass,aMethodID,jdns);
+
+
+}
+
+void android_set_domain(const char* domain) {
+ jmethodID aMethodID = (*openvpnjenv)->GetStaticMethodID(openvpnjenv, openvpnclass, "addDomain",
+ "(Ljava/lang/String;)V");
+ jstring jdomain = (*openvpnjenv)->NewStringUTF(openvpnjenv,domain);
+ (*openvpnjenv)->CallStaticVoidMethod(openvpnjenv,openvpnclass,aMethodID,jdomain);
+
+
+}
+
void addRouteInformation(const char* dest, const char* mask, const char* gw) {
jstring jmask = (*openvpnjenv)->NewStringUTF(openvpnjenv, mask);
diff --git a/openvpn/src/openvpn/jniglue.h b/openvpn/src/openvpn/jniglue.h
index cb3ae410..7c723ef5 100644
--- a/openvpn/src/openvpn/jniglue.h
+++ b/openvpn/src/openvpn/jniglue.h
@@ -14,6 +14,7 @@ void addRouteInformation(const char* dest, const char* mask, const char* gw);
void addInterfaceInformation(int mtu,const char* ifconfig_local, const char* ifconfig_remote);
void android_openvpn_log(int level,const char* prefix,const char* prefix_sep,const char* m1);
void android_openvpn_exit(int status);
-
+void android_set_dns(const char* dns);
+void android_set_domain(const char* domain);
#endif
diff --git a/openvpn/src/openvpn/options.c b/openvpn/src/openvpn/options.c
index fcf436c4..b74e559b 100644
--- a/openvpn/src/openvpn/options.c
+++ b/openvpn/src/openvpn/options.c
@@ -1134,7 +1134,9 @@ show_tuntap_options (const struct tuntap_options *o)
}
#endif
+#endif
+#if defined(WIN32) || defined(TARGET_ANDROID)
static void
dhcp_option_address_parse (const char *name, const char *parm, in_addr_t *array, int *len, int msglevel)
{
@@ -5999,6 +6001,8 @@ add_option (struct options *options,
to->ip_win32_type = index;
to->ip_win32_defined = true;
}
+#endif
+#if defined(WIN32) || defined(TARGET_ANDROID)
else if (streq (p[0], "dhcp-option") && p[1])
{
struct tuntap_options *o = &options->tuntap_options;
@@ -6050,6 +6054,8 @@ add_option (struct options *options,
}
o->dhcp_options = true;
}
+#endif
+#ifdef WIN32
else if (streq (p[0], "show-adapters"))
{
VERIFY_PERMISSION (OPT_P_GENERAL);
diff --git a/openvpn/src/openvpn/tun.c b/openvpn/src/openvpn/tun.c
index db8104d4..58e9bc53 100644
--- a/openvpn/src/openvpn/tun.c
+++ b/openvpn/src/openvpn/tun.c
@@ -1378,6 +1378,13 @@ close_tun_generic (struct tuntap *tt)
void
open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt)
{
+ struct gc_arena gc = gc_new ();
+ int i;
+ for (i = 0; i < tt->options.dns_len; ++i) {
+ android_set_dns(print_in_addr_t(tt->options.dns[i], 0, &gc));
+ }
+ if(tt->options.domain)
+ android_set_domain(tt->options.domain);
tt->fd = android_open_tun();
}
diff --git a/openvpn/src/openvpn/tun.h b/openvpn/src/openvpn/tun.h
index 63ab8721..6754c726 100644
--- a/openvpn/src/openvpn/tun.h
+++ b/openvpn/src/openvpn/tun.h
@@ -38,7 +38,7 @@
#include "proto.h"
#include "misc.h"
-#ifdef WIN32
+#if defined(WIN32) || defined(TARGET_ANDROID)
#define TUN_ADAPTER_INDEX_INVALID ((DWORD)-1)
@@ -76,6 +76,7 @@ struct tuntap_options {
int netbios_node_type; /* NBT 1,2,4,8 (46) */
+
#define N_DHCP_ADDR 4 /* Max # of addresses allowed for
DNS, WINS, etc. */