[PATCH 7/7] tun_darwin: adapt to TUNDevice interface change
Simon Ruderich
simon at ruderich.org
Sun Dec 31 17:16:54 CET 2017
Broken in 996c7c4 ("Removed IFF_NO_PI from TUN linux", 2017-12-04).
Untested!
---
src/tun_windows.go | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/tun_windows.go b/src/tun_windows.go
index 0711032..8bb8a66 100644
--- a/src/tun_windows.go
+++ b/src/tun_windows.go
@@ -123,7 +123,9 @@ func (f *NativeTUN) Close() error {
return windows.Close(f.fd)
}
-func (f *NativeTUN) Write(b []byte) (int, error) {
+func (f *NativeTUN) Write(b []byte, offset int) (int, error) {
+ b := b[offset:]
+
f.wl.Lock()
defer f.wl.Unlock()
@@ -138,7 +140,9 @@ func (f *NativeTUN) Write(b []byte) (int, error) {
return getOverlappedResult(f.fd, f.wo)
}
-func (f *NativeTUN) Read(b []byte) (int, error) {
+func (f *NativeTUN) Read(b []byte, offset int) (int, error) {
+ b := b[offset:]
+
f.rl.Lock()
defer f.rl.Unlock()
--
2.15.1
More information about the WireGuard
mailing list