From b508620d86e6c567f17ab6d89ff40b8013db67e7 Mon Sep 17 00:00:00 2001 From: Owersun <4807375+Owersun@users.noreply.github.com> Date: Tue, 13 Jan 2026 14:21:06 +0100 Subject: [PATCH] Proxy: TUN: Close connection when handling is done --- proxy/tun/handler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/proxy/tun/handler.go b/proxy/tun/handler.go index 2b73aad9474f..5cf21a750459 100644 --- a/proxy/tun/handler.go +++ b/proxy/tun/handler.go @@ -102,6 +102,10 @@ func (t *Handler) Init(ctx context.Context, pm policy.Manager, dispatcher routin // HandleConnection pass the connection coming from the ip stack to the routing dispatcher func (t *Handler) HandleConnection(conn net.Conn, destination net.Destination) { + // when handling is done with any outcome, always signal back to the incoming connection + // to close, send completion packets back to the network, and cleanup + defer conn.Close() + sid := session.NewID() ctx := c.ContextWithID(t.ctx, sid)