diff --git a/app/tools/libwg-go/Makefile b/app/tools/libwg-go/Makefile index 8826b0b3..d07b313f 100644 --- a/app/tools/libwg-go/Makefile +++ b/app/tools/libwg-go/Makefile @@ -27,7 +27,7 @@ default: $(DESTDIR)/libwg-go.so GOBUILDARCH := $(NDK_GO_ARCH_MAP_$(shell uname -m)) GOBUILDOS := $(shell uname -s | tr '[:upper:]' '[:lower:]') -GOBUILDVERSION := 1.11.4 +GOBUILDVERSION := 1.12 GOBUILDTARBALL := https://dl.google.com/go/go$(GOBUILDVERSION).$(GOBUILDOS)-$(GOBUILDARCH).tar.gz GOBUILDVERSION_NEEDED := go version go$(GOBUILDVERSION) $(GOBUILDOS)/$(GOBUILDARCH) export GOROOT := $(BUILDDIR)/goroot @@ -41,7 +41,7 @@ $(GOROOT)/bin/go: rm -rf "$(GOROOT)" mkdir -p "$(GOROOT)" curl "$(GOBUILDTARBALL)" | tar -C "$(GOROOT)" --strip-components=1 -xzf - || { rm -rf "$(GOROOT)"; exit 1; } - cat goruntime-*.diff | patch -p1 -f -N -r- -d "$(GOROOT)" || { rm -rf "$(GOROOT)"; exit 1; } + patch -p1 -f -N -r- -d "$(GOROOT)" < goruntime-boottime-over-monotonic.diff || { rm -rf "$(GOROOT)"; exit 1; } $(shell test "$$(cat .gobuildversion 2>/dev/null)" = "$(GOBUILDVERSION_CURRENT)" || rm -f "$(DESTDIR)/libwg-go.so") diff --git a/app/tools/libwg-go/goruntime-boottime-over-monotonic.diff b/app/tools/libwg-go/goruntime-boottime-over-monotonic.diff index a58c1ce0..e5c668bd 100644 --- a/app/tools/libwg-go/goruntime-boottime-over-monotonic.diff +++ b/app/tools/libwg-go/goruntime-boottime-over-monotonic.diff @@ -1,6 +1,6 @@ -From 6f345a38d9533db388009d91d29981673dcf95b4 Mon Sep 17 00:00:00 2001 -From: Jason A. Donenfeld -Date: Fri, 04 May 2018 03:48:23 +0200 +From 6998a7866b8428fd49c31506795c9f8154826d13 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Wed, 27 Feb 2019 05:05:44 +0100 Subject: [PATCH] runtime: use CLOCK_BOOTTIME in nanotime on Linux This makes timers account for having expired while a computer was @@ -17,12 +17,21 @@ Fixes #24595 Change-Id: I7b2a6ca0c5bc5fce57ec0eeafe7b68270b429321 --- + src/runtime/sys_linux_386.s | 4 ++-- + src/runtime/sys_linux_amd64.s | 2 +- + src/runtime/sys_linux_arm.s | 4 ++-- + src/runtime/sys_linux_arm64.s | 4 ++-- + src/runtime/sys_linux_mips64x.s | 2 +- + src/runtime/sys_linux_mipsx.s | 2 +- + src/runtime/sys_linux_ppc64x.s | 2 +- + src/runtime/sys_linux_s390x.s | 2 +- + 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/runtime/sys_linux_386.s b/src/runtime/sys_linux_386.s -index 8d5a4ff..bfad064 100644 +index 40b55a67eb..6105780ff4 100644 --- a/src/runtime/sys_linux_386.s +++ b/src/runtime/sys_linux_386.s -@@ -285,13 +285,13 @@ +@@ -288,13 +288,13 @@ noswitch: LEAL 8(SP), BX // &ts (struct timespec) MOVL BX, 4(SP) @@ -39,10 +48,10 @@ index 8d5a4ff..bfad064 100644 INVOKE_SYSCALL diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s -index 62d8024..8510be4 100644 +index b709f77060..18a1f1d43a 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s -@@ -257,7 +257,7 @@ +@@ -261,7 +261,7 @@ noswitch: MOVQ runtime·vdsoClockgettimeSym(SB), AX CMPQ AX, $0 JEQ fallback @@ -52,7 +61,7 @@ index 62d8024..8510be4 100644 CALL AX MOVQ 0(SP), AX // sec diff --git a/src/runtime/sys_linux_arm.s b/src/runtime/sys_linux_arm.s -index aa39732..d29cb88 100644 +index 43a58335c8..8b93635f4f 100644 --- a/src/runtime/sys_linux_arm.s +++ b/src/runtime/sys_linux_arm.s @@ -11,7 +11,7 @@ @@ -64,7 +73,7 @@ index aa39732..d29cb88 100644 // for EABI, as we don't support OABI #define SYS_BASE 0x0 -@@ -287,7 +287,7 @@ +@@ -291,7 +291,7 @@ noswitch: SUB $24, R13 // Space for results BIC $0x7, R13 // Align for C code @@ -74,7 +83,7 @@ index aa39732..d29cb88 100644 MOVW runtime·vdsoClockgettimeSym(SB), R11 CMP $0, R11 diff --git a/src/runtime/sys_linux_arm64.s b/src/runtime/sys_linux_arm64.s -index c6afd76..24294e8 100644 +index 8b344be8f8..daf142fba0 100644 --- a/src/runtime/sys_linux_arm64.s +++ b/src/runtime/sys_linux_arm64.s @@ -13,7 +13,7 @@ @@ -86,7 +95,7 @@ index c6afd76..24294e8 100644 #define SYS_exit 93 #define SYS_read 63 -@@ -243,7 +243,7 @@ +@@ -247,7 +247,7 @@ noswitch: BIC $15, R1 MOVD R1, RSP @@ -96,10 +105,10 @@ index c6afd76..24294e8 100644 CBZ R2, fallback BL (R2) diff --git a/src/runtime/sys_linux_mips64x.s b/src/runtime/sys_linux_mips64x.s -index 8e64f1c..521062f 100644 +index c45703d228..9842b596e7 100644 --- a/src/runtime/sys_linux_mips64x.s +++ b/src/runtime/sys_linux_mips64x.s -@@ -185,7 +185,7 @@ +@@ -189,7 +189,7 @@ TEXT runtime·walltime(SB),NOSPLIT,$16 RET TEXT runtime·nanotime(SB),NOSPLIT,$16 @@ -109,10 +118,10 @@ index 8e64f1c..521062f 100644 MOVV $SYS_clock_gettime, R2 SYSCALL diff --git a/src/runtime/sys_linux_mipsx.s b/src/runtime/sys_linux_mipsx.s -index a6bca3b..920ed9a 100644 +index f362b0f3f1..5ab866e047 100644 --- a/src/runtime/sys_linux_mipsx.s +++ b/src/runtime/sys_linux_mipsx.s -@@ -189,7 +189,7 @@ +@@ -193,7 +193,7 @@ TEXT runtime·walltime(SB),NOSPLIT,$8-12 RET TEXT runtime·nanotime(SB),NOSPLIT,$8-8 @@ -122,23 +131,23 @@ index a6bca3b..920ed9a 100644 MOVW $SYS_clock_gettime, R2 SYSCALL diff --git a/src/runtime/sys_linux_ppc64x.s b/src/runtime/sys_linux_ppc64x.s -index 483cb8e..11f3c49 100644 +index 6835f434de..46618b2d91 100644 --- a/src/runtime/sys_linux_ppc64x.s +++ b/src/runtime/sys_linux_ppc64x.s -@@ -164,7 +164,7 @@ - RET +@@ -204,7 +204,7 @@ fallback: + JMP finish TEXT runtime·nanotime(SB),NOSPLIT,$16 -- MOVW $1, R3 // CLOCK_MONOTONIC -+ MOVW $7, R3 // CLOCK_BOOTTIME - MOVD $0(R1), R4 - SYSCALL $SYS_clock_gettime - MOVD 0(R1), R3 // sec +- MOVD $1, R3 // CLOCK_MONOTONIC ++ MOVD $7, R3 // CLOCK_BOOTTIME + + MOVD R1, R15 // R15 is unchanged by C code + MOVD g_m(g), R21 // R21 = m diff --git a/src/runtime/sys_linux_s390x.s b/src/runtime/sys_linux_s390x.s -index 1ff110c..e9049e0 100644 +index c79ceea751..44e3258e60 100644 --- a/src/runtime/sys_linux_s390x.s +++ b/src/runtime/sys_linux_s390x.s -@@ -176,7 +176,7 @@ +@@ -180,7 +180,7 @@ TEXT runtime·walltime(SB),NOSPLIT,$16 RET TEXT runtime·nanotime(SB),NOSPLIT,$16 @@ -147,3 +156,6 @@ index 1ff110c..e9049e0 100644 MOVD $tp-16(SP), R3 MOVW $SYS_clock_gettime, R1 SYSCALL +-- +2.20.1 + diff --git a/app/tools/libwg-go/goruntime-fstatat-over-lstat.diff b/app/tools/libwg-go/goruntime-fstatat-over-lstat.diff deleted file mode 100644 index f90dce7c..00000000 --- a/app/tools/libwg-go/goruntime-fstatat-over-lstat.diff +++ /dev/null @@ -1,291 +0,0 @@ -diff --git a/src/syscall/syscall_linux_386.go b/src/syscall/syscall_linux_386.go -index 49db72450f..6e162ebb41 100644 ---- a/src/syscall/syscall_linux_386.go -+++ b/src/syscall/syscall_linux_386.go -@@ -62,8 +62,6 @@ func Pipe2(p []int, flags int) (err error) { - //sysnb InotifyInit() (fd int, err error) - //sys Ioperm(from int, num int, on int) (err error) - //sys Iopl(level int) (err error) --//sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32 --//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 - //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 - //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 - //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64 -@@ -74,7 +72,6 @@ func Pipe2(p []int, flags int) (err error) { - //sysnb Setresuid(ruid int, euid int, suid int) (err error) = SYS_SETRESUID32 - //sysnb Setreuid(ruid int, euid int) (err error) = SYS_SETREUID32 - //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) --//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 - //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) - //sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64 - //sysnb getgroups(n int, list *_Gid_t) (nn int, err error) = SYS_GETGROUPS32 -@@ -84,6 +81,18 @@ func Pipe2(p []int, flags int) (err error) { - //sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) - //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) - -+func Stat(path string, stat *Stat_t) (err error) { -+ return fstatat(_AT_FDCWD, path, stat, 0) -+} -+ -+func Lchown(path string, uid int, gid int) (err error) { -+ return Fchownat(_AT_FDCWD, path, uid, gid, _AT_SYMLINK_NOFOLLOW) -+} -+ -+func Lstat(path string, stat *Stat_t) (err error) { -+ return fstatat(_AT_FDCWD, path, stat, _AT_SYMLINK_NOFOLLOW) -+} -+ - func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { - page := uintptr(offset / 4096) - if offset != int64(page)*4096 { -diff --git a/src/syscall/syscall_linux_amd64.go b/src/syscall/syscall_linux_amd64.go -index 1a21d9db6f..f740ab4e72 100644 ---- a/src/syscall/syscall_linux_amd64.go -+++ b/src/syscall/syscall_linux_amd64.go -@@ -22,9 +22,7 @@ const ( - //sysnb InotifyInit() (fd int, err error) - //sys Ioperm(from int, num int, on int) (err error) - //sys Iopl(level int) (err error) --//sys Lchown(path string, uid int, gid int) (err error) - //sys Listen(s int, n int) (err error) --//sys Lstat(path string, stat *Stat_t) (err error) - //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 - //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 - //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK -@@ -66,6 +64,14 @@ func Stat(path string, stat *Stat_t) (err error) { - return fstatat(_AT_FDCWD, path, stat, 0) - } - -+func Lchown(path string, uid int, gid int) (err error) { -+ return Fchownat(_AT_FDCWD, path, uid, gid, _AT_SYMLINK_NOFOLLOW) -+} -+ -+func Lstat(path string, stat *Stat_t) (err error) { -+ return fstatat(_AT_FDCWD, path, stat, _AT_SYMLINK_NOFOLLOW) -+} -+ - //go:noescape - func gettimeofday(tv *Timeval) (err Errno) - -diff --git a/src/syscall/syscall_linux_arm.go b/src/syscall/syscall_linux_arm.go -index b0c0ac7c4f..65543193e1 100644 ---- a/src/syscall/syscall_linux_arm.go -+++ b/src/syscall/syscall_linux_arm.go -@@ -83,9 +83,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - //sysnb Getgid() (gid int) = SYS_GETGID32 - //sysnb Getuid() (uid int) = SYS_GETUID32 - //sysnb InotifyInit() (fd int, err error) --//sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32 - //sys Listen(s int, n int) (err error) --//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 - //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64 - //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT - //sys Setfsgid(gid int) (err error) = SYS_SETFSGID32 -@@ -96,7 +94,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - //sysnb Setreuid(ruid int, euid int) (err error) = SYS_SETREUID32 - //sys Shutdown(fd int, how int) (err error) - //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) --//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 - - // Vsyscalls on amd64. - //sysnb Gettimeofday(tv *Timeval) (err error) -@@ -110,6 +107,18 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - //sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) - //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) - -+func Stat(path string, stat *Stat_t) (err error) { -+ return fstatat(_AT_FDCWD, path, stat, 0) -+} -+ -+func Lchown(path string, uid int, gid int) (err error) { -+ return Fchownat(_AT_FDCWD, path, uid, gid, _AT_SYMLINK_NOFOLLOW) -+} -+ -+func Lstat(path string, stat *Stat_t) (err error) { -+ return fstatat(_AT_FDCWD, path, stat, _AT_SYMLINK_NOFOLLOW) -+} -+ - func Fstatfs(fd int, buf *Statfs_t) (err error) { - _, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf))) - if e != 0 { -diff --git a/src/syscall/zsyscall_linux_386.go b/src/syscall/zsyscall_linux_386.go -index 62827f16dc..0882494c47 100644 ---- a/src/syscall/zsyscall_linux_386.go -+++ b/src/syscall/zsyscall_linux_386.go -@@ -1276,36 +1276,6 @@ func Iopl(level int) (err error) { - - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - --func Lchown(path string, uid int, gid int) (err error) { -- var _p0 *byte -- _p0, err = BytePtrFromString(path) -- if err != nil { -- return -- } -- _, _, e1 := Syscall(SYS_LCHOWN32, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) -- if e1 != 0 { -- err = errnoErr(e1) -- } -- return --} -- --// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -- --func Lstat(path string, stat *Stat_t) (err error) { -- var _p0 *byte -- _p0, err = BytePtrFromString(path) -- if err != nil { -- return -- } -- _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) -- if e1 != 0 { -- err = errnoErr(e1) -- } -- return --} -- --// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -- - func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { -@@ -1422,21 +1392,6 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i - - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - --func Stat(path string, stat *Stat_t) (err error) { -- var _p0 *byte -- _p0, err = BytePtrFromString(path) -- if err != nil { -- return -- } -- _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) -- if e1 != 0 { -- err = errnoErr(e1) -- } -- return --} -- --// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -- - func SyncFileRange(fd int, off int64, n int64, flags int) (err error) { - _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE, uintptr(fd), uintptr(off), uintptr(off>>32), uintptr(n), uintptr(n>>32), uintptr(flags)) - if e1 != 0 { -diff --git a/src/syscall/zsyscall_linux_amd64.go b/src/syscall/zsyscall_linux_amd64.go -index b6638269be..9f2046bf93 100644 ---- a/src/syscall/zsyscall_linux_amd64.go -+++ b/src/syscall/zsyscall_linux_amd64.go -@@ -1261,21 +1261,6 @@ func Iopl(level int) (err error) { - - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - --func Lchown(path string, uid int, gid int) (err error) { -- var _p0 *byte -- _p0, err = BytePtrFromString(path) -- if err != nil { -- return -- } -- _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) -- if e1 != 0 { -- err = errnoErr(e1) -- } -- return --} -- --// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -- - func Listen(s int, n int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0) - if e1 != 0 { -@@ -1286,21 +1271,6 @@ func Listen(s int, n int) (err error) { - - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - --func Lstat(path string, stat *Stat_t) (err error) { -- var _p0 *byte -- _p0, err = BytePtrFromString(path) -- if err != nil { -- return -- } -- _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) -- if e1 != 0 { -- err = errnoErr(e1) -- } -- return --} -- --// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -- - func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { -diff --git a/src/syscall/zsyscall_linux_arm.go b/src/syscall/zsyscall_linux_arm.go -index bb20d6e946..3d099aa16d 100644 ---- a/src/syscall/zsyscall_linux_arm.go -+++ b/src/syscall/zsyscall_linux_arm.go -@@ -1415,21 +1415,6 @@ func InotifyInit() (fd int, err error) { - - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - --func Lchown(path string, uid int, gid int) (err error) { -- var _p0 *byte -- _p0, err = BytePtrFromString(path) -- if err != nil { -- return -- } -- _, _, e1 := Syscall(SYS_LCHOWN32, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) -- if e1 != 0 { -- err = errnoErr(e1) -- } -- return --} -- --// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -- - func Listen(s int, n int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0) - if e1 != 0 { -@@ -1440,21 +1425,6 @@ func Listen(s int, n int) (err error) { - - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - --func Lstat(path string, stat *Stat_t) (err error) { -- var _p0 *byte -- _p0, err = BytePtrFromString(path) -- if err != nil { -- return -- } -- _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) -- if e1 != 0 { -- err = errnoErr(e1) -- } -- return --} -- --// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -- - func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - r0, _, e1 := Syscall6(SYS_SENDFILE64, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) - written = int(r0) -@@ -1558,21 +1528,6 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i - - // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - --func Stat(path string, stat *Stat_t) (err error) { -- var _p0 *byte -- _p0, err = BytePtrFromString(path) -- if err != nil { -- return -- } -- _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) -- if e1 != 0 { -- err = errnoErr(e1) -- } -- return --} -- --// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -- - func Gettimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) - if e1 != 0 { diff --git a/app/tools/libwg-go/src/api-android.go b/app/tools/libwg-go/src/api-android.go index 2c28fc76..ddf175ab 100644 --- a/app/tools/libwg-go/src/api-android.go +++ b/app/tools/libwg-go/src/api-android.go @@ -11,8 +11,8 @@ import "C" import ( "bufio" - "git.zx2c4.com/wireguard-go/tun" "golang.org/x/sys/unix" + "golang.zx2c4.com/wireguard/tun" "log" "math" "net" @@ -52,7 +52,7 @@ func init() { case <-signals: n := runtime.Stack(buf, true) buf[n] = 0 - C.__android_log_write(C.ANDROID_LOG_ERROR, C.CString("WireGuard/GoBackend/Stacktrace"), (*_Ctype_char)(unsafe.Pointer(&buf[0]))) + C.__android_log_write(C.ANDROID_LOG_ERROR, C.CString("WireGuard/GoBackend/Stacktrace"), (*C.char)(unsafe.Pointer(&buf[0]))) } } }() @@ -89,7 +89,7 @@ func wgTurnOn(ifnameRef string, tunFd int32, settings string) int32 { return -1 } - var uapi net.Listener; + var uapi net.Listener uapiFile, err := UAPIOpen(name) if err != nil { diff --git a/app/tools/libwg-go/src/queueconstants.go b/app/tools/libwg-go/src/queueconstants.go index 59dec481..dd11bf10 100644 --- a/app/tools/libwg-go/src/queueconstants.go +++ b/app/tools/libwg-go/src/queueconstants.go @@ -8,9 +8,9 @@ package main /* Reduce memory consumption for Android */ const ( - QueueOutboundSize = 1024 - QueueInboundSize = 1024 - QueueHandshakeSize = 1024 - MaxSegmentSize = 2200 - PreallocatedBuffersPerPool = 4096 + QueueOutboundSize = 1024 + QueueInboundSize = 1024 + QueueHandshakeSize = 1024 + MaxSegmentSize = 2200 + PreallocatedBuffersPerPool = 4096 ) diff --git a/app/tools/libwg-go/src/tun/api-android.go b/app/tools/libwg-go/src/tun/api-android.go index a5d6b092..75e80c5a 100644 --- a/app/tools/libwg-go/src/tun/api-android.go +++ b/app/tools/libwg-go/src/tun/api-android.go @@ -6,7 +6,7 @@ package tun import ( - "git.zx2c4.com/wireguard-go/rwcancel" + "golang.zx2c4.com/wireguard/rwcancel" "os" ) @@ -20,7 +20,7 @@ func CreateTUNFromFD(tunFd int) (TUNDevice, string, error) { nopi: true, } var err error - tun.fdCancel, err = rwcancel.NewRWCancel(tunFd) + tun.fdCancel, err = rwcancel.NewRWCancel(int(tun.fd)) if err != nil { return nil, "", err } diff --git a/app/tools/wireguard-go b/app/tools/wireguard-go index f7170e5d..88ff67fb 160000 --- a/app/tools/wireguard-go +++ b/app/tools/wireguard-go @@ -1 +1 @@ -Subproject commit f7170e5de2065f37bac647484b34711db4797394 +Subproject commit 88ff67fb6f55456e46877b71aa5d33060468f95e