Development discussion of WireGuard
 help / color / mirror / Atom feed
* [PATCH] tun/netstack: close stack on netTun close
@ 2023-10-23 14:33 Nick Goossens
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Goossens @ 2023-10-23 14:33 UTC (permalink / raw)
  To: wireguard; +Cc: Nick Goossens

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] tun/netstack: close stack on netTun close
@ 2023-10-11 11:14 Nick Goossens
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Goossens @ 2023-10-11 11:14 UTC (permalink / raw)
  To: wireguard; +Cc: Nick Goossens

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.
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-23 14:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-23 14:33 [PATCH] tun/netstack: close stack on netTun close Nick Goossens
  -- strict thread matches above, loose matches on Subject: below --
2023-10-11 11:14 Nick Goossens

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).