mirror of
https://github.com/slackhq/nebula.git
synced 2025-11-08 23:43:57 +01:00
Fix a hang when shutting down Android (#772)
This commit is contained in:
parent
9af242dc47
commit
85f5849d0b
@ -28,11 +28,13 @@ func newTunFromFd(l *logrus.Logger, deviceFd int, cidr *net.IPNet, _ int, routes
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX Android returns an fd in non-blocking mode which is necessary for shutdown to work properly.
|
||||||
|
// Be sure not to call file.Fd() as it will set the fd to blocking mode.
|
||||||
file := os.NewFile(uintptr(deviceFd), "/dev/net/tun")
|
file := os.NewFile(uintptr(deviceFd), "/dev/net/tun")
|
||||||
|
|
||||||
return &tun{
|
return &tun{
|
||||||
ReadWriteCloser: file,
|
ReadWriteCloser: file,
|
||||||
fd: int(file.Fd()),
|
fd: deviceFd,
|
||||||
cidr: cidr,
|
cidr: cidr,
|
||||||
l: l,
|
l: l,
|
||||||
routeTree: routeTree,
|
routeTree: routeTree,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user