Work around go fd closing limitation and version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
e7c6e487ea
commit
32fcb3fccf
@ -20,7 +20,7 @@ android {
|
||||
applicationId 'com.wireguard.android'
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 27
|
||||
versionCode 402
|
||||
versionCode 403
|
||||
versionName '0.4.0'
|
||||
}
|
||||
externalNativeBuild {
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"math"
|
||||
"os"
|
||||
"strings"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
type AndroidLogger struct {
|
||||
@ -42,15 +43,27 @@ func wgTurnOn(ifnameRef string, tun_fd int32, settings string) int32 {
|
||||
logger.Debug.Println("Debug log enabled")
|
||||
|
||||
tun := &NativeTun{
|
||||
fd: os.NewFile(uintptr(tun_fd), ""),
|
||||
fd: os.NewFile(uintptr(tun_fd), "/dev/tun"),
|
||||
events: make(chan TUNEvent, 5),
|
||||
errors: make(chan error, 5),
|
||||
nopi: true,
|
||||
}
|
||||
var err error
|
||||
|
||||
err = syscall.SetNonblock(int(tun_fd), true)
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
return -1
|
||||
}
|
||||
tun.closingReader, tun.closingWriter, err = os.Pipe()
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
return -1
|
||||
}
|
||||
name, err := tun.Name()
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
return -1
|
||||
logger.Error.Println(err)
|
||||
return -1
|
||||
}
|
||||
logger.Info.Println("Attaching to interface", name)
|
||||
device := NewDevice(tun, logger)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit ac9912345b4da5034ea93f5f245ea2ce04815bd5
|
||||
Subproject commit ec28113c7eebd93c87964a3509460fd150ad5ac7
|
Loading…
Reference in New Issue
Block a user