tun: remove nonblock hack for linux
This is no longer necessary and actually breaks things Reported-by: Chris Branch <cbranch@cloudflare.com>
This commit is contained in:
parent
4fd55daafe
commit
651744561e
@ -368,21 +368,11 @@ func (tun *nativeTun) Close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func CreateTUN(name string, mtu int) (TUNDevice, 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)
|
nfd, err := unix.Open(cloneDevicePath, os.O_RDWR, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = unix.SetNonblock(nfd, true)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
fd := os.NewFile(uintptr(nfd), cloneDevicePath)
|
fd := os.NewFile(uintptr(nfd), cloneDevicePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user