libwg-go: No sticky sockets with VPNService.java

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2018-05-22 19:42:12 +02:00
parent 52d90724bc
commit a533be82e8
2 changed files with 25 additions and 3 deletions

View File

@ -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() {}

@ -1 +1 @@
Subproject commit 837a12c84151968fac6477f75d6bcb52e7ae64db
Subproject commit 65a74f3175855dc41b49332103ada6bb27733291