diff options
-rw-r--r-- | openvpn/Android.mk | 22 | ||||
-rw-r--r-- | openvpn/src/openvpn/jniglue.c | 4 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/OpenVpnManagementThread.java | 13 |
3 files changed, 36 insertions, 3 deletions
diff --git a/openvpn/Android.mk b/openvpn/Android.mk index 78849702..ca15c711 100644 --- a/openvpn/Android.mk +++ b/openvpn/Android.mk @@ -88,5 +88,25 @@ LOCAL_SRC_FILES:= src/openvpn/jniglue.c \ src/openvpn/status.c \ src/openvpn/tun.c -#include $(BUILD_SHARED_LIBRARY) +include $(BUILD_SHARED_LIBRARY) +#include $(BUILD_EXECUTABLE) + + +include $(CLEAR_VARS) + +LOCAL_LDLIBS := -llog +LOCAL_SRC_FILES:= src/openvpn/jniglue.c +LOCAL_MODULE = opvpnutil +include $(BUILD_SHARED_LIBRARY) + + +include $(CLEAR_VARS) + + +LOCAL_LDLIBS := -llog +LOCAL_SRC_FILES:= src/openvpn/testmain.c +LOCAL_MODULE = minivpn +LOCAL_SHARED_LIBRARIES=openvpn include $(BUILD_EXECUTABLE) + + diff --git a/openvpn/src/openvpn/jniglue.c b/openvpn/src/openvpn/jniglue.c index c79272d7..b28acba5 100644 --- a/openvpn/src/openvpn/jniglue.c +++ b/openvpn/src/openvpn/jniglue.c @@ -16,3 +16,7 @@ void android_openvpn_log(int level,const char* prefix,const char* prefix_sep,con __android_log_print(ANDROID_LOG_DEBUG,"openvpn","%s%s%s",prefix,prefix_sep,m1); } +void Java_de_blinkt_openvpn_OpenVpnManagementThread_jniclose(JNIEnv *env,jobject jo, jint fd) { + int ret = close(fd); + __android_log_print(ANDROID_LOG_DEBUG,"openvpn","fd close %d %d",fd,ret); +} diff --git a/src/de/blinkt/openvpn/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/OpenVpnManagementThread.java index 31ea49e8..fb08898b 100644 --- a/src/de/blinkt/openvpn/OpenVpnManagementThread.java +++ b/src/de/blinkt/openvpn/OpenVpnManagementThread.java @@ -28,6 +28,9 @@ public class OpenVpnManagementThread implements Runnable { mOpenVPNService = openVpnService;
}
+ static {
+ System.loadLibrary("opvpnutil");
+ }
public void managmentCommand(String cmd) {
Log.d("openvpn", "mgmt cmd" + mSocket + " " +cmd + " " );
@@ -100,10 +103,11 @@ public class OpenVpnManagementThread implements Runnable { Log.d("Openvpn", "Got FD from socket: " + fd + " " + fdint);
- mOpenVPNService.protect(fdint);
+ //mOpenVPNService.protect(fdint);
//ParcelFileDescriptor pfd = ParcelFileDescriptor.fromFd(fdint);
//pfd.close();
+ jniclose(fdint);
return;
} catch (NoSuchMethodException e) {
e.printStackTrace();
@@ -237,7 +241,8 @@ public class OpenVpnManagementThread implements Runnable { // Set the FileDescriptor to null to stop this mad behavior
mSocket.setFileDescriptorsForSend(null);
- pfd.close();
+
+ pfd.close();
return true;
} catch (NoSuchMethodException e) {
@@ -255,6 +260,10 @@ public class OpenVpnManagementThread implements Runnable { }
+ private native void jniclose(int fdint);
+
+
+
private void processPWCommand(String argument) {
//argument has the form Need 'Private Key' password
int p1 =argument.indexOf('\'');
|