summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-04-19 07:55:24 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-04-19 17:11:02 +0200
commit70be2c8b18a2b87ab8e880d8269b25ca71574997 (patch)
tree6a724756b5eed163f3fba27f55d69e374af7ec73 /app
parent6b5b945304b36263a2bbc54706575c445c88a5f3 (diff)
Work around go fd closing limitation and version bump
Diffstat (limited to 'app')
-rw-r--r--app/build.gradle2
-rw-r--r--app/tools/libwg-go/api-android.go19
m---------app/tools/wireguard-go0
3 files changed, 17 insertions, 4 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 18710cc0..fbc74ca4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,7 +20,7 @@ android {
applicationId 'com.wireguard.android'
minSdkVersion 21
targetSdkVersion 27
- versionCode 402
+ versionCode 403
versionName '0.4.0'
}
externalNativeBuild {
diff --git a/app/tools/libwg-go/api-android.go b/app/tools/libwg-go/api-android.go
index 6b864bce..af64f51f 100644
--- a/app/tools/libwg-go/api-android.go
+++ b/app/tools/libwg-go/api-android.go
@@ -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)
diff --git a/app/tools/wireguard-go b/app/tools/wireguard-go
-Subproject ac9912345b4da5034ea93f5f245ea2ce04815bd
+Subproject ec28113c7eebd93c87964a3509460fd150ad5ac