summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-22 01:26:47 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-22 01:26:47 +0200
commitb8c9e13c6e0db93133dc302b40e25b615fece9b8 (patch)
treeb25643408634b2a146ddb7610707c4a5aa2fff5a
parentbc05eb1c3c39609f9c76696d7db4f40da36b4817 (diff)
Call shutdown on route socket on freebsd
-rw-r--r--tun_freebsd.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/tun_freebsd.go b/tun_freebsd.go
index e2ec511..f738c7f 100644
--- a/tun_freebsd.go
+++ b/tun_freebsd.go
@@ -441,8 +441,7 @@ func (tun *NativeTun) Close() error {
err2 := tun.fd.Close()
err3 := tunDestroy(tun.name)
if tun.routeSocket != -1 {
- // Surprisingly, on FreeBSD, simply closing a route socket is enough to unblock it.
- // We don't even need to call shutdown, or use a rwcancel. TODO: CONFIRM THIS CLAIM. IT WAS TRUE ON DARWIN BUT...
+ unix.Shutdown(tun.routeSocket, unix.SHUT_RDWR)
err4 = unix.Close(tun.routeSocket)
tun.routeSocket = -1
} else if tun.events != nil {