diff options
author | Colin Adler <colin1adler@gmail.com> | 2022-09-12 22:03:55 -0500 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-09-20 17:17:29 +0200 |
commit | fde0a9525ae5be7f6356a410f1bfc52ecc720f85 (patch) | |
tree | acb5f8013fa6747c7489c64fac06087aa470f0a1 | |
parent | b51010ba13f0a3e59808fbdb1566cd2c6b834b95 (diff) |
tun/netstack: ensure `(*netTun).incomingPacket` chan is closed
Without this, `device.Close()` will deadlock.
Signed-off-by: Colin Adler <colin1adler@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | tun/netstack/tun.go | 4 |
1 files changed, 4 insertions, 0 deletions
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 } |