wireguard-go-bridge: update to Go 1.12
This commit is contained in:
parent
c33563f848
commit
06e4083347
|
@ -1 +1 @@
|
|||
Subproject commit f7170e5de2065f37bac647484b34711db4797394
|
||||
Subproject commit 88ff67fb6f55456e46877b71aa5d33060468f95e
|
|
@ -28,7 +28,7 @@ version-header: $(DESTDIR)/wireguard-go-version.h
|
|||
|
||||
GOBUILDARCH := $(GOARCH_$(shell uname -m))
|
||||
GOBUILDOS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
|
||||
GOBUILDVERSION := 1.11.5
|
||||
GOBUILDVERSION := 1.12
|
||||
GOBUILDTARBALL := go$(GOBUILDVERSION).$(GOBUILDOS)-$(GOBUILDARCH).tar.gz
|
||||
GOBUILDTARBALLURL := https://dl.google.com/go/$(GOBUILDTARBALL)
|
||||
GOBUILDVERSION_NEEDED := go version go$(GOBUILDVERSION) $(GOBUILDOS)/$(GOBUILDARCH)
|
||||
|
|
|
@ -1,55 +1,27 @@
|
|||
diff -r -u go/src/runtime/sys_darwin_386.s go-modified/src/runtime/sys_darwin_386.s
|
||||
--- go/src/runtime/sys_darwin_386.s 2018-10-01 23:02:54.000000000 +0200
|
||||
+++ go-modified/src/runtime/sys_darwin_386.s 2018-11-01 23:18:04.383055355 +0100
|
||||
@@ -184,7 +184,7 @@
|
||||
PUSHL BP
|
||||
MOVL SP, BP
|
||||
SUBL $8+(machTimebaseInfo__size+15)/16*16, SP
|
||||
- CALL libc_mach_absolute_time(SB)
|
||||
+ CALL libc_mach_continuous_time(SB)
|
||||
MOVL 16+(machTimebaseInfo__size+15)/16*16(SP), CX
|
||||
MOVL AX, 0(CX)
|
||||
MOVL DX, 4(CX)
|
||||
diff -r -u go/src/runtime/sys_darwin_amd64.s go-modified/src/runtime/sys_darwin_amd64.s
|
||||
--- go/src/runtime/sys_darwin_amd64.s 2018-10-01 23:02:54.000000000 +0200
|
||||
+++ go-modified/src/runtime/sys_darwin_amd64.s 2018-11-01 23:18:04.382055360 +0100
|
||||
@@ -85,7 +85,7 @@
|
||||
PUSHQ BP
|
||||
MOVQ SP, BP
|
||||
MOVQ DI, BX
|
||||
- CALL libc_mach_absolute_time(SB)
|
||||
+ CALL libc_mach_continuous_time(SB)
|
||||
MOVQ AX, 0(BX)
|
||||
MOVL timebase<>+machTimebaseInfo_numer(SB), SI
|
||||
MOVL timebase<>+machTimebaseInfo_denom(SB), DI // atomic read
|
||||
diff -r -u go/src/runtime/sys_darwin_arm64.s go-modified/src/runtime/sys_darwin_arm64.s
|
||||
--- go/src/runtime/sys_darwin_arm64.s 2018-10-01 23:02:54.000000000 +0200
|
||||
+++ go-modified/src/runtime/sys_darwin_arm64.s 2018-11-01 23:18:04.380055369 +0100
|
||||
@@ -110,7 +110,7 @@
|
||||
|
||||
TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$40
|
||||
MOVD R0, R19
|
||||
- BL libc_mach_absolute_time(SB)
|
||||
+ BL libc_mach_continuous_time(SB)
|
||||
MOVD R0, 0(R19)
|
||||
MOVW timebase<>+machTimebaseInfo_numer(SB), R20
|
||||
MOVD $timebase<>+machTimebaseInfo_denom(SB), R21
|
||||
diff -r -u go/src/runtime/sys_darwin_arm.s go-modified/src/runtime/sys_darwin_arm.s
|
||||
--- go/src/runtime/sys_darwin_arm.s 2018-10-01 23:02:54.000000000 +0200
|
||||
+++ go-modified/src/runtime/sys_darwin_arm.s 2018-11-01 23:18:04.381055364 +0100
|
||||
@@ -118,7 +118,7 @@
|
||||
|
||||
TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$0
|
||||
MOVW R0, R8
|
||||
- BL libc_mach_absolute_time(SB)
|
||||
+ BL libc_mach_continuous_time(SB)
|
||||
MOVW R0, 0(R8)
|
||||
MOVW R1, 4(R8)
|
||||
MOVW timebase<>+machTimebaseInfo_numer(SB), R6
|
||||
diff -r -u go/src/runtime/sys_darwin.go go-modified/src/runtime/sys_darwin.go
|
||||
--- go/src/runtime/sys_darwin.go 2018-10-01 23:02:54.000000000 +0200
|
||||
+++ go-modified/src/runtime/sys_darwin.go 2018-11-01 23:18:04.384055350 +0100
|
||||
@@ -348,7 +348,7 @@
|
||||
From 74523c5a12d37fa792e77a252bcc569484c3d41a Mon Sep 17 00:00:00 2001
|
||||
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
|
||||
Date: Wed, 27 Feb 2019 05:33:01 +0100
|
||||
Subject: [PATCH] runtime: use libc_mach_continuous_time in nanotime on Darwin
|
||||
|
||||
This makes timers account for having expired while a computer was
|
||||
asleep, which is quite common on mobile devices. Note that
|
||||
continuous_time absolute_time, except that it takes into account
|
||||
time spent in suspend.
|
||||
|
||||
Fixes #24595
|
||||
---
|
||||
src/runtime/sys_darwin.go | 2 +-
|
||||
src/runtime/sys_darwin_386.s | 2 +-
|
||||
src/runtime/sys_darwin_amd64.s | 2 +-
|
||||
src/runtime/sys_darwin_arm.s | 2 +-
|
||||
src/runtime/sys_darwin_arm64.s | 2 +-
|
||||
5 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/runtime/sys_darwin.go b/src/runtime/sys_darwin.go
|
||||
index f34ac88352..416fcb673f 100644
|
||||
--- a/src/runtime/sys_darwin.go
|
||||
+++ b/src/runtime/sys_darwin.go
|
||||
@@ -403,7 +403,7 @@ func closeonexec(fd int32) {
|
||||
//go:cgo_import_dynamic libc_usleep usleep "/usr/lib/libSystem.B.dylib"
|
||||
|
||||
//go:cgo_import_dynamic libc_mach_timebase_info mach_timebase_info "/usr/lib/libSystem.B.dylib"
|
||||
|
@ -58,3 +30,58 @@ diff -r -u go/src/runtime/sys_darwin.go go-modified/src/runtime/sys_darwin.go
|
|||
//go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib"
|
||||
//go:cgo_import_dynamic libc_sigaction sigaction "/usr/lib/libSystem.B.dylib"
|
||||
//go:cgo_import_dynamic libc_pthread_sigmask pthread_sigmask "/usr/lib/libSystem.B.dylib"
|
||||
diff --git a/src/runtime/sys_darwin_386.s b/src/runtime/sys_darwin_386.s
|
||||
index 1bc1a63c28..34a3561350 100644
|
||||
--- a/src/runtime/sys_darwin_386.s
|
||||
+++ b/src/runtime/sys_darwin_386.s
|
||||
@@ -184,7 +184,7 @@ TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$0
|
||||
PUSHL BP
|
||||
MOVL SP, BP
|
||||
SUBL $8+(machTimebaseInfo__size+15)/16*16, SP
|
||||
- CALL libc_mach_absolute_time(SB)
|
||||
+ CALL libc_mach_continuous_time(SB)
|
||||
MOVL 16+(machTimebaseInfo__size+15)/16*16(SP), CX
|
||||
MOVL AX, 0(CX)
|
||||
MOVL DX, 4(CX)
|
||||
diff --git a/src/runtime/sys_darwin_amd64.s b/src/runtime/sys_darwin_amd64.s
|
||||
index f99cb00ab8..8b99316983 100644
|
||||
--- a/src/runtime/sys_darwin_amd64.s
|
||||
+++ b/src/runtime/sys_darwin_amd64.s
|
||||
@@ -86,7 +86,7 @@ TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$0
|
||||
PUSHQ BP
|
||||
MOVQ SP, BP
|
||||
MOVQ DI, BX
|
||||
- CALL libc_mach_absolute_time(SB)
|
||||
+ CALL libc_mach_continuous_time(SB)
|
||||
MOVQ AX, 0(BX)
|
||||
MOVL timebase<>+machTimebaseInfo_numer(SB), SI
|
||||
MOVL timebase<>+machTimebaseInfo_denom(SB), DI // atomic read
|
||||
diff --git a/src/runtime/sys_darwin_arm.s b/src/runtime/sys_darwin_arm.s
|
||||
index 54c7afbf34..a4f06fdb85 100644
|
||||
--- a/src/runtime/sys_darwin_arm.s
|
||||
+++ b/src/runtime/sys_darwin_arm.s
|
||||
@@ -118,7 +118,7 @@ GLOBL timebase<>(SB),NOPTR,$(machTimebaseInfo__size)
|
||||
|
||||
TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$0
|
||||
MOVW R0, R8
|
||||
- BL libc_mach_absolute_time(SB)
|
||||
+ BL libc_mach_continuous_time(SB)
|
||||
MOVW R0, 0(R8)
|
||||
MOVW R1, 4(R8)
|
||||
MOVW timebase<>+machTimebaseInfo_numer(SB), R6
|
||||
diff --git a/src/runtime/sys_darwin_arm64.s b/src/runtime/sys_darwin_arm64.s
|
||||
index 29951d8ad7..cdaf0a630e 100644
|
||||
--- a/src/runtime/sys_darwin_arm64.s
|
||||
+++ b/src/runtime/sys_darwin_arm64.s
|
||||
@@ -113,7 +113,7 @@ GLOBL timebase<>(SB),NOPTR,$(machTimebaseInfo__size)
|
||||
|
||||
TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$40
|
||||
MOVD R0, R19
|
||||
- BL libc_mach_absolute_time(SB)
|
||||
+ BL libc_mach_continuous_time(SB)
|
||||
MOVD R0, 0(R19)
|
||||
MOVW timebase<>+machTimebaseInfo_numer(SB), R20
|
||||
MOVD $timebase<>+machTimebaseInfo_denom(SB), R21
|
||||
--
|
||||
2.20.1
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ import (
|
|||
"bufio"
|
||||
"bytes"
|
||||
"errors"
|
||||
"git.zx2c4.com/wireguard-go/tun"
|
||||
"golang.org/x/sys/unix"
|
||||
"golang.zx2c4.com/wireguard/tun"
|
||||
"log"
|
||||
"math"
|
||||
"os"
|
||||
|
@ -61,7 +61,7 @@ func init() {
|
|||
n := runtime.Stack(buf, true)
|
||||
buf[n] = 0
|
||||
if uintptr(loggerFunc) != 0 {
|
||||
C.callLogger(loggerFunc, 0, (*_Ctype_char)(unsafe.Pointer(&buf[0])))
|
||||
C.callLogger(loggerFunc, 0, (*C.char)(unsafe.Pointer(&buf[0])))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,28 +6,24 @@
|
|||
package tun
|
||||
|
||||
import (
|
||||
"git.zx2c4.com/wireguard-go/rwcancel"
|
||||
"golang.org/x/sys/unix"
|
||||
"net"
|
||||
"os"
|
||||
)
|
||||
|
||||
func CreateTUNFromFD(tunFd int) (TUNDevice, string, error) {
|
||||
file := os.NewFile(uintptr(tunFd), "/dev/tun")
|
||||
tun := &nativeTun{
|
||||
tunFile: file,
|
||||
fd: file.Fd(),
|
||||
events: make(chan TUNEvent, 5),
|
||||
errors: make(chan error, 5),
|
||||
}
|
||||
var err error
|
||||
tun.rwcancel, err = rwcancel.NewRWCancel(tunFd)
|
||||
err := unix.SetNonblock(tunFd, true)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
file := os.NewFile(uintptr(tunFd), "/dev/tun")
|
||||
tun := &nativeTun{
|
||||
tunFile: file,
|
||||
events: make(chan TUNEvent, 5),
|
||||
errors: make(chan error, 5),
|
||||
}
|
||||
name, err := tun.Name()
|
||||
if err != nil {
|
||||
tun.rwcancel.Cancel()
|
||||
return nil, "", err
|
||||
}
|
||||
tunIfindex, err := func() (int, error) {
|
||||
|
@ -38,12 +34,10 @@ func CreateTUNFromFD(tunFd int) (TUNDevice, string, error) {
|
|||
return iface.Index, nil
|
||||
}()
|
||||
if err != nil {
|
||||
tun.tunFile.Close()
|
||||
return nil, "", err
|
||||
}
|
||||
tun.routeSocket, err = unix.Socket(unix.AF_ROUTE, unix.SOCK_RAW, unix.AF_UNSPEC)
|
||||
if err != nil {
|
||||
tun.tunFile.Close()
|
||||
return nil, "", err
|
||||
}
|
||||
go tun.routineRouteListener(tunIfindex)
|
||||
|
|
Loading…
Reference in New Issue