diff --git a/pkg/services/forwarder/udp.go b/pkg/services/forwarder/udp.go index 3226b14c6..f9098ad75 100644 --- a/pkg/services/forwarder/udp.go +++ b/pkg/services/forwarder/udp.go @@ -38,6 +38,13 @@ func UDP(s *stack.Stack, nat map[tcpip.Address]tcpip.Address, natLock *sync.Mute p, _ := NewUDPProxy(&autoStoppingListener{underlying: gonet.NewUDPConn(s, &wq, ep)}, func() (net.Conn, error) { return net.Dial("udp", fmt.Sprintf("%s:%d", localAddress, r.ID().LocalPort)) }) - go p.Run() + go func() { + p.Run() + + // note that at this point packets that is sent to the current forwarder session + // will be dropped. we will start processing the packets again when we get new + // fowrarder request. + ep.Close() + }() }) }