]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
Call shutdown on route socket on freebsd
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 21 May 2018 23:26:47 +0000 (01:26 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 21 May 2018 23:26:47 +0000 (01:26 +0200)
tun_freebsd.go

index e2ec5116337046ac05c69941179a58dce3354cd9..f738c7f79a4d3c5143f911d04ad10fc7f4bdb875 100644 (file)
@@ -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 {