summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorClaus Lensbøl <claus@tailscale.com>2025-10-22 10:59:28 -0400
committerClaus Lensbøl <claus@tailscale.com>2025-10-22 10:59:28 -0400
commitc686a9d6d01c0679ff6f3dad3bb83dc2a20cbcff (patch)
tree5615525de7f4f97c59dc5f81c082d833f5be2bf7
parentafaa23c3b4c5fcbb7a62d42831a5b7e55e30eeac (diff)
downloadtailscale-cmol/add_upnp_release_timeout.tar.xz
tailscale-cmol/add_upnp_release_timeout.zip
net/portmapper: add UPnP-IGD release timeoutcmol/add_upnp_release_timeout
Smallest possible change that could help mitigate a deadlock if a release is haning. Updates tailscale/corp#33619 Signed-off-by: Claus Lensbøl <claus@tailscale.com>
-rw-r--r--net/portmapper/portmapper.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/portmapper/portmapper.go b/net/portmapper/portmapper.go
index 9368d1c4e..3cdfb76ed 100644
--- a/net/portmapper/portmapper.go
+++ b/net/portmapper/portmapper.go
@@ -395,7 +395,9 @@ func (c *Client) listenPacket(ctx context.Context, network, addr string) (nettyp
func (c *Client) invalidateMappingsLocked(releaseOld bool) {
if c.mapping != nil {
if releaseOld {
- c.mapping.Release(context.Background())
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+ defer cancel()
+ c.mapping.Release(ctx)
}
c.mapping = nil
}