summaryrefslogtreecommitdiffhomepage
path: root/feature
diff options
context:
space:
mode:
authorClaus Lensbøl <claus@tailscale.com>2026-01-15 09:04:20 -0500
committerClaus Lensbøl <claus@tailscale.com>2026-01-27 16:46:38 -0500
commitda28a92b22108aa366af4485c835b8feb11c4c03 (patch)
tree3a390f29614e39f33169bfa103f4b1cd532b9d85 /feature
parent8c17d871b33ade8ebf8e2a6c5e136f06c4019cd2 (diff)
downloadtailscale-cmol/run_portmapper_in_exec_queue.tar.xz
tailscale-cmol/run_portmapper_in_exec_queue.zip
net/portmapper: put mappings and releases into an execqueuecmol/run_portmapper_in_exec_queue
We had an issue where releasing mappings would cause a deadlock when the UPnP gateway did not respond. Instead of working on mappings sync, put it into an exec queue and add a timeout on releasing the mappings. Updates tailscale/corp#33888 Updates tailscale/corp#33619 Signed-off-by: Claus Lensbøl <claus@tailscale.com>
Diffstat (limited to 'feature')
-rw-r--r--feature/debugportmapper/debugportmapper.go9
-rw-r--r--feature/portmapper/portmapper.go14
2 files changed, 14 insertions, 9 deletions
diff --git a/feature/debugportmapper/debugportmapper.go b/feature/debugportmapper/debugportmapper.go
index 2625086c6..0a1038436 100644
--- a/feature/debugportmapper/debugportmapper.go
+++ b/feature/debugportmapper/debugportmapper.go
@@ -109,10 +109,11 @@ func serveDebugPortmap(h *localapi.Handler, w http.ResponseWriter, r *http.Reque
var c *portmapper.Client
c = portmapper.NewClient(portmapper.Config{
- Logf: logger.WithPrefix(logf, "portmapper: "),
- NetMon: h.LocalBackend().NetMon(),
- DebugKnobs: debugKnobs,
- EventBus: h.LocalBackend().EventBus(),
+ ShutdownCtx: ctx,
+ Logf: logger.WithPrefix(logf, "portmapper: "),
+ NetMon: h.LocalBackend().NetMon(),
+ DebugKnobs: debugKnobs,
+ EventBus: h.LocalBackend().EventBus(),
OnChange: func() {
logf("portmapping changed.")
logf("have mapping: %v", c.HaveMapping())
diff --git a/feature/portmapper/portmapper.go b/feature/portmapper/portmapper.go
index d1b903cb6..9c9d6acfc 100644
--- a/feature/portmapper/portmapper.go
+++ b/feature/portmapper/portmapper.go
@@ -6,6 +6,8 @@
package portmapper
import (
+ "context"
+
"tailscale.com/feature"
"tailscale.com/net/netmon"
"tailscale.com/net/portmapper"
@@ -20,16 +22,18 @@ func init() {
}
func newPortMapper(
+ ctx context.Context,
logf logger.Logf,
bus *eventbus.Bus,
netMon *netmon.Monitor,
disableUPnPOrNil func() bool,
- onlyTCP443OrNil func() bool) portmappertype.Client {
-
+ onlyTCP443OrNil func() bool,
+) portmappertype.Client {
pm := portmapper.NewClient(portmapper.Config{
- EventBus: bus,
- Logf: logf,
- NetMon: netMon,
+ ShutdownCtx: ctx,
+ EventBus: bus,
+ Logf: logf,
+ NetMon: netMon,
DebugKnobs: &portmapper.DebugKnobs{
DisableAll: onlyTCP443OrNil,
DisableUPnPFunc: disableUPnPOrNil,