]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
tun/netstack: ensure `(*netTun).incomingPacket` chan is closed
authorColin Adler <colin1adler@gmail.com>
Tue, 13 Sep 2022 03:03:55 +0000 (22:03 -0500)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 20 Sep 2022 15:17:29 +0000 (17:17 +0200)
Without this, `device.Close()` will deadlock.

Signed-off-by: Colin Adler <colin1adler@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
tun/netstack/tun.go

index b0e7b70d60c149b34c994f735395d3bb2b275ea9..f232ca3337e5b0d49e765477307a946f56ae4efa 100644 (file)
@@ -164,6 +164,10 @@ func (tun *netTun) Close() error {
 
        tun.ep.Close()
 
+       if tun.incomingPacket != nil {
+               close(tun.incomingPacket)
+       }
+
        return nil
 }