From: Jason A. Donenfeld Date: Thu, 6 Dec 2018 16:17:51 +0000 (+0100) Subject: tun: remove nonblock hack for linux X-Git-Tag: 0.0.20181222~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=651744561e9e31197d8ebb59f97ab3dae3c39687;p=thirdparty%2Fwireguard-go.git tun: remove nonblock hack for linux This is no longer necessary and actually breaks things Reported-by: Chris Branch --- diff --git a/tun/tun_linux.go b/tun/tun_linux.go index bb6bede..6f91cfd 100644 --- a/tun/tun_linux.go +++ b/tun/tun_linux.go @@ -368,21 +368,11 @@ func (tun *nativeTun) Close() error { } func CreateTUN(name string, mtu int) (TUNDevice, error) { - - // open clone device - - // HACK: we open it as a raw Fd first, so that f.nonblock=false - // when we make it into a file object. nfd, err := unix.Open(cloneDevicePath, os.O_RDWR, 0) if err != nil { return nil, err } - err = unix.SetNonblock(nfd, true) - if err != nil { - return nil, err - } - fd := os.NewFile(uintptr(nfd), cloneDevicePath) if err != nil { return nil, err