aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-22 19:42:12 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-22 23:28:54 +0200
commit5028aa76a89e0c1a2428f482b4ddc248878d15c6 (patch)
treece4a97fd37db227d1e41d41bcea2c1d8f124c6de
parentFix hang and version bump (diff)
downloadwireguard-android-5028aa76a89e0c1a2428f482b4ddc248878d15c6.tar.xz
wireguard-android-5028aa76a89e0c1a2428f482b4ddc248878d15c6.zip
libwg-go: No sticky sockets with VPNService.java
-rw-r--r--app/tools/libwg-go/api-android.go26
m---------app/tools/wireguard-go0
2 files changed, 24 insertions, 2 deletions
diff --git a/app/tools/libwg-go/api-android.go b/app/tools/libwg-go/api-android.go
index a609ec4..faf718a 100644
--- a/app/tools/libwg-go/api-android.go
+++ b/app/tools/libwg-go/api-android.go
@@ -133,7 +133,18 @@ func wgGetSocketV4(tunnelHandle int32) int32 {
if !ok {
return -1
}
- return int32(native.sock4)
+ fd := int32(-1)
+ conn, err := native.ipv4.SyscallConn()
+ if err != nil {
+ return -1
+ }
+ err = conn.Control(func(f uintptr) {
+ fd = int32(f)
+ })
+ if err != nil {
+ return -1
+ }
+ return fd
}
//export wgGetSocketV6
@@ -146,7 +157,18 @@ func wgGetSocketV6(tunnelHandle int32) int32 {
if !ok {
return -1
}
- return int32(native.sock6)
+ fd := int32(-1)
+ conn, err := native.ipv6.SyscallConn()
+ if err != nil {
+ return -1
+ }
+ err = conn.Control(func(f uintptr) {
+ fd = int32(f)
+ })
+ if err != nil {
+ return -1
+ }
+ return fd
}
func main() {}
diff --git a/app/tools/wireguard-go b/app/tools/wireguard-go
-Subproject 837a12c84151968fac6477f75d6bcb52e7ae64d
+Subproject 65a74f3175855dc41b49332103ada6bb2773329