diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-03-12 00:02:06 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2022-03-18 23:32:05 +0100 |
commit | 66119086e8c227968509c1d880d3582b97cc2b46 (patch) | |
tree | 218c72056cbcad497af39dea2f490dc3c66882f3 | |
parent | 03744d37d3fb3dc3f63f9ecec3816efb2b8b7b1f (diff) |
WIP: add dhcp functionsgonet
-rw-r--r-- | tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java | 2 | ||||
-rw-r--r-- | tunnel/tools/libwg-go/api-android.go | 10 | ||||
-rw-r--r-- | tunnel/tools/libwg-go/jni.c | 5 |
3 files changed, 16 insertions, 1 deletions
diff --git a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java index 3d0886cf..b7f9d098 100644 --- a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java +++ b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java @@ -70,6 +70,8 @@ public final class GoBackend implements Backend { alwaysOnCallback = cb; } + private static native void wgDHCP(int handle); + @Nullable private static native String wgGetConfig(int handle); private static native int wgGetSocketV4(int handle); diff --git a/tunnel/tools/libwg-go/api-android.go b/tunnel/tools/libwg-go/api-android.go index 8e9b1545..3c946471 100644 --- a/tunnel/tools/libwg-go/api-android.go +++ b/tunnel/tools/libwg-go/api-android.go @@ -178,11 +178,19 @@ func wgTurnOn(interfaceName string, tunFd int32, settings string) int32 { handle.uapi = uapi tunnelHandles[i] = handle - go handle.startDHCPv6() +// go handle.startDHCPv6() return i } +func wgDHCP(tunnelHandles int32) { + handle, ok := tunnelHandles[tunnelHandle] + if !ok { + return + } + handle.startDHCPv6() +} + //export wgTurnOff func wgTurnOff(tunnelHandle int32) { handle, ok := tunnelHandles[tunnelHandle] diff --git a/tunnel/tools/libwg-go/jni.c b/tunnel/tools/libwg-go/jni.c index 7ad94d35..26a4b8e2 100644 --- a/tunnel/tools/libwg-go/jni.c +++ b/tunnel/tools/libwg-go/jni.c @@ -33,6 +33,11 @@ JNIEXPORT jint JNICALL Java_com_wireguard_android_backend_GoBackend_wgTurnOn(JNI return ret; } +JNIEXPORT void JNICALL Java_com_wireguard_android_backend_GoBackend_wgDHCP(JNIEnv *env, jclass c, jint handle) +{ + wgDHCP(handle); +} + JNIEXPORT void JNICALL Java_com_wireguard_android_backend_GoBackend_wgTurnOff(JNIEnv *env, jclass c, jint handle) { wgTurnOff(handle); |