diff options
Diffstat (limited to 'openvpn')
-rw-r--r-- | openvpn/src/openvpn/jniglue.c | 17 | ||||
-rw-r--r-- | openvpn/src/openvpn/jniglue.h | 3 | ||||
-rw-r--r-- | openvpn/src/openvpn/route.c | 9 | ||||
-rw-r--r-- | openvpn/src/openvpn/socket.c | 2 | ||||
-rw-r--r-- | openvpn/src/openvpn/tun.c | 29 |
5 files changed, 30 insertions, 30 deletions
diff --git a/openvpn/src/openvpn/jniglue.c b/openvpn/src/openvpn/jniglue.c index d49fe353..e11cabd4 100644 --- a/openvpn/src/openvpn/jniglue.c +++ b/openvpn/src/openvpn/jniglue.c @@ -23,14 +23,6 @@ void android_openvpn_exit(int status) { } -void testmsg(char* m1, ...) { - va_list arglist; - va_start(arglist,m1); - // vsnprintf(m1, 100, "foo bbaz",arglist); - __android_log_vprint(ANDROID_LOG_DEBUG, "openvpn",m1, arglist); - va_end(arglist); -} - // Store env and class, we allow only one instance // so make these variables global for now jclass openvpnclass; @@ -137,15 +129,6 @@ 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 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 ea60a718..236c0323 100644 --- a/openvpn/src/openvpn/jniglue.h +++ b/openvpn/src/openvpn/jniglue.h @@ -9,10 +9,7 @@ #ifndef xcopenvpn_jniglue_h #define xcopenvpn_jniglue_h -void testmsg(char* m1, ...); -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); #endif diff --git a/openvpn/src/openvpn/route.c b/openvpn/src/openvpn/route.c index 6c3ad904..a73bbc4c 100644 --- a/openvpn/src/openvpn/route.c +++ b/openvpn/src/openvpn/route.c @@ -1347,7 +1347,14 @@ add_route (struct route *r, #elif defined (TARGET_ANDROID) #include "jniglue.h" - addRouteInformation(network, netmask, gateway); + struct user_pass up; + struct buffer out = alloc_buf_gc (64, &gc); + + buf_printf (&out, "%s %s", network, netmask); + + strcpy(up.username, buf_bptr(&out)); + management_query_user_pass(management, &up , "ROUTE", GET_USER_PASS_NEED_OK,(void*) 0); + #elif defined (WIN32) { diff --git a/openvpn/src/openvpn/socket.c b/openvpn/src/openvpn/socket.c index 524343b5..756627fe 100644 --- a/openvpn/src/openvpn/socket.c +++ b/openvpn/src/openvpn/socket.c @@ -380,7 +380,7 @@ getaddr6 (unsigned int flags, /* * Resolve hostname - */ + */ while (true) { /* try hostname lookup */ diff --git a/openvpn/src/openvpn/tun.c b/openvpn/src/openvpn/tun.c index 844d596e..66a09ea0 100644 --- a/openvpn/src/openvpn/tun.c +++ b/openvpn/src/openvpn/tun.c @@ -46,8 +46,8 @@ #include "manage.h" #include "route.h" #include "win32.h" - #include "memdbg.h" +#include <string.h> #ifdef TARGET_ANDROID #include "jniglue.h" @@ -774,7 +774,16 @@ do_ifconfig (struct tuntap *tt, #endif /*ENABLE_IPROUTE*/ #elif defined(TARGET_ANDROID) - addInterfaceInformation(tun_mtu,ifconfig_local, ifconfig_remote_netmask); + + struct user_pass up; + struct buffer out = alloc_buf_gc (64, &gc); + + buf_printf (&out, "%s %s %d", ifconfig_local, ifconfig_remote_netmask, tun_mtu); + + strcpy(up.username, buf_bptr(&out)); + management_query_user_pass(management, &up , "IFCONFIG", GET_USER_PASS_NEED_OK,(void*) 0); + + #elif defined(TARGET_SOLARIS) /* Solaris 2.6 (and 7?) cannot set all parameters in one go... @@ -1378,20 +1387,24 @@ 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; + struct user_pass up; + struct gc_arena gc = gc_new (); + for (i = 0; i < tt->options.dns_len; ++i) { - android_set_dns(print_in_addr_t(tt->options.dns[i], 0, &gc)); + strcpy(up.username, print_in_addr_t(tt->options.dns[i], 0, &gc)); + management_query_user_pass(management, &up , "DNSSERVER", GET_USER_PASS_NEED_OK,(void*) 0); } - - - if(tt->options.domain) + if(tt->options.domain) { + strcpy(up.username , tt->options.domain); management_query_user_pass(management, &up , "DNSDOMAIN", GET_USER_PASS_NEED_OK,(void*) 0); - + } + if((tt->fd = android_open_tun())< 0){ msg (M_ERR, "ERROR: Cannot open TUN"); } + gc_free (&gc); } #else |