Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Nick Goossens <ngoossens@duckduckgo.com>
To: wireguard@lists.zx2c4.com
Cc: Nick Goossens <ngoossens@duckduckgo.com>
Subject: [PATCH] tun/netstack: close stack on netTun close
Date: Mon, 23 Oct 2023 16:33:47 +0200	[thread overview]
Message-ID: <20231023143356.6889-1-ngoossens@duckduckgo.com> (raw)

If the stack is not closed when closing netTun then goroutines
will be leaked because the the transport protocols remain open.
This adds the needed close call.

Signed-off-by: Nick Goossens <ngoossens@duckduckgo.com>
---
 tun/netstack/tun.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tun/netstack/tun.go b/tun/netstack/tun.go
index 2b73054..a06bc21 100644
--- a/tun/netstack/tun.go
+++ b/tun/netstack/tun.go
@@ -167,6 +167,7 @@ func (tun *netTun) WriteNotify() {
 
 func (tun *netTun) Close() error {
 	tun.stack.RemoveNIC(1)
+	tun.stack.Close()
 
 	if tun.events != nil {
 		close(tun.events)
-- 
2.42.0


             reply	other threads:[~2023-10-23 14:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23 14:33 Nick Goossens [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-10-11 11:14 Nick Goossens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231023143356.6889-1-ngoossens@duckduckgo.com \
    --to=ngoossens@duckduckgo.com \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).