Skip to content

Commit fde0a95

Browse files
coadlerzx2c4
authored andcommitted
tun/netstack: ensure (*netTun).incomingPacket chan is closed
Without this, `device.Close()` will deadlock. Signed-off-by: Colin Adler <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent b51010b commit fde0a95

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tun/netstack/tun.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ func (tun *netTun) Close() error {
164164

165165
tun.ep.Close()
166166

167+
if tun.incomingPacket != nil {
168+
close(tun.incomingPacket)
169+
}
170+
167171
return nil
168172
}
169173

0 commit comments

Comments
 (0)