cmd/tailscale/cli: release portmap after netcheck

Updates #12954

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: Ic14f037b48a79b1263b140c6699579b466d89310
pull/12966/head
Andrew Dunham 4 months ago
parent 19b0c8a024
commit 35a8fca379

@ -52,9 +52,15 @@ func runNetcheck(ctx context.Context, args []string) error {
if err != nil { if err != nil {
return err return err
} }
// Ensure that we close the portmapper after running a netcheck; this
// will release any port mappings created.
pm := portmapper.NewClient(logf, netMon, nil, nil, nil)
defer pm.Close()
c := &netcheck.Client{ c := &netcheck.Client{
NetMon: netMon, NetMon: netMon,
PortMapper: portmapper.NewClient(logf, netMon, nil, nil, nil), PortMapper: pm,
UseDNSCache: false, // always resolve, don't cache UseDNSCache: false, // always resolve, don't cache
} }
if netcheckArgs.verbose { if netcheckArgs.verbose {

Loading…
Cancel
Save