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>
This commit is contained in:
Colin Adler 2022-09-12 22:03:55 -05:00 committed by Jason A. Donenfeld
parent b51010ba13
commit fde0a9525a

View File

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