Skip to content

Commit

Permalink
Fix leak in netstack's tunnel
Browse files Browse the repository at this point in the history
The upstream netstack's virtual tunnel device has a leaky Close
implementation - the virtual network is not being shut down properly.
What's missing is this one line change to shut down all the go routines
associated with the userspace networking stack. This change is verbatim
copied from kshangx's PR - WireGuard/wireguard-go#101

Signed-off-by: kshangx <[email protected]>
  • Loading branch information
kshangx authored and pinkisemils committed Jul 17, 2024
1 parent f4bc3ae commit 6c8a0b7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tun/netstack/tun.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ func (tun *netTun) Flush() error {

func (tun *netTun) Close() error {
tun.stack.RemoveNIC(1)
tun.stack.Close()

if tun.events != nil {
close(tun.events)
Expand Down

0 comments on commit 6c8a0b7

Please sign in to comment.