From fde0a9525ae5be7f6356a410f1bfc52ecc720f85 Mon Sep 17 00:00:00 2001 From: Colin Adler Date: Mon, 12 Sep 2022 22:03:55 -0500 Subject: tun/netstack: ensure `(*netTun).incomingPacket` chan is closed Without this, `device.Close()` will deadlock. Signed-off-by: Colin Adler Signed-off-by: Jason A. Donenfeld --- tun/netstack/tun.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tun/netstack/tun.go b/tun/netstack/tun.go index b0e7b70..f232ca3 100644 --- a/tun/netstack/tun.go +++ b/tun/netstack/tun.go @@ -164,6 +164,10 @@ func (tun *netTun) Close() error { tun.ep.Close() + if tun.incomingPacket != nil { + close(tun.incomingPacket) + } + return nil } -- cgit v1.2.3