]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
tun: remove nonblock hack for linux
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 6 Dec 2018 16:17:51 +0000 (17:17 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 6 Dec 2018 16:17:51 +0000 (17:17 +0100)
This is no longer necessary and actually breaks things

Reported-by: Chris Branch <cbranch@cloudflare.com>
tun/tun_linux.go

index bb6bede948215b6db1d5a5db46b4beff40b1f1a0..6f91cfd72e70bfdb890c82650635e42dfc53cea3 100644 (file)
@@ -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