diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-05-22 00:28:14 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-05-22 00:28:14 +0200 |
commit | 05eb2d3d4de5be9159270c5742a5e0c0a5a8591c (patch) | |
tree | 43b59eb8a96a3b797e1157f7e08688af5e3ae54f /tunnel | |
parent | 9ac518380cdd92abb7e3d75efae67079f0de1aa2 (diff) |
WIP IPv4/IPv6 fixesbuild16
Diffstat (limited to 'tunnel')
-rw-r--r-- | tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java | 8 | ||||
-rw-r--r-- | tunnel/src/main/java/com/wireguard/util/Resolver.java | 2 | ||||
-rw-r--r-- | tunnel/tools/libwg-go/jni.c | 2 |
3 files changed, 7 insertions, 5 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 481ef8ae..23ea0e1e 100644 --- a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java +++ b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java @@ -323,10 +323,10 @@ public final class GoBackend implements Backend { Log.w(TAG, "Wg user string: " + goConfig); LibwgGrpc.LibwgBlockingStub stub = LibwgGrpc.newBlockingStub(channel); - TunnelHandle handle = TunnelHandle.newBuilder().setHandle(currentTunnelHandle).build(); + // TunnelHandle handle = TunnelHandle.newBuilder().setHandle(currentTunnelHandle).build(); // IpcSetRequest request = IpcSetRequest.newBuilder().setTunnel(handle).setConfig(goConfig).build(); // IpcSetResponse resp = stub.ipcSet(request); - wgSetConfig(handle, request); + wgSetConfig(currentTunnelHandle, goConfig); } private static String downloadPacFile(Network network, Uri pacFileUrl) { @@ -877,10 +877,10 @@ public final class GoBackend implements Backend { Log.w(TAG, "is default network, config:" + goConfig); LibwgGrpc.LibwgBlockingStub stub = LibwgGrpc.newBlockingStub(channel); - TunnelHandle tunnel = TunnelHandle.newBuilder().setHandle(currentTunnelHandle).build(); + // TunnelHandle tunnel = TunnelHandle.newBuilder().setHandle(currentTunnelHandle).build(); // IpcSetRequest request = IpcSetRequest.newBuilder().setTunnel(tunnel).setConfig(goConfig).build(); // IpcSetResponse resp = stub.ipcSet(request); - wgSetConfig(handle, request); + wgSetConfig(currentTunnelHandle, goConfig); } } } diff --git a/tunnel/src/main/java/com/wireguard/util/Resolver.java b/tunnel/src/main/java/com/wireguard/util/Resolver.java index 654e01f5..24f5ab88 100644 --- a/tunnel/src/main/java/com/wireguard/util/Resolver.java +++ b/tunnel/src/main/java/com/wireguard/util/Resolver.java @@ -111,6 +111,7 @@ public class Resolver { if (sock.getLocalAddress().isAnyLocalAddress()) { // Connect didn't find a local address. Log.w(TAG, "No local address"); + sock.close(); continue; } @@ -119,6 +120,7 @@ public class Resolver { if (candidate instanceof Inet4Address) { // Accept IPv4 as preferred address. address = candidate; + sock.close(); break; } diff --git a/tunnel/tools/libwg-go/jni.c b/tunnel/tools/libwg-go/jni.c index 7d6ee8a8..443848e8 100644 --- a/tunnel/tools/libwg-go/jni.c +++ b/tunnel/tools/libwg-go/jni.c @@ -73,7 +73,7 @@ JNIEXPORT jstring JNICALL Java_com_wireguard_android_backend_GoBackend_wgVersion return ret; } -JNIEXPORT jint JNICALL Java_com_wireguard_android_backend_GoBackend_wgSetConfig(JNIEnv *env, jclass c, jstring handle, jstring settings) +JNIEXPORT jint JNICALL Java_com_wireguard_android_backend_GoBackend_wgSetConfig(JNIEnv *env, jclass c, jint handle, jstring settings) { const char *settings_str = (*env)->GetStringUTFChars(env, settings, 0); size_t settings_len = (*env)->GetStringUTFLength(env, settings); |