Files
tailscale/net
Francois Marier 4fd07b5f98 net/portmapper: add metrics for createOrGetMapping
Probe counts the replies it gets from PCP, NAT-PMP and UPnP servers.
When createOrGetMapping asks for a mapping, only the UPnP path has
metrics. We can't tell which protocol created a mapping, how often new
mappings and renewals fail, or which errors PCP and NAT-PMP servers
return.

This adds portmap_create_* metrics for new and renewed mappings by
protocol, the UPnP fallback, every PCP and NAT-PMP result code, and the
replies we drop (unparseable, PCP nonce mismatch, NAT-PMP reply for
another internal port, unknown version). A request is a renewal if the
mapping it replaces used the same protocol.

We send NAT-PMP requests without knowing whether the gateway supports
NAT-PMP, so most timeouts come from gateways that don't. The success
rate for new NAT-PMP mappings on gateways that support it is therefore
portmap_create_new_pmp_ok / (portmap_create_new_pmp_sent -
portmap_create_new_pmp_timeout).

portmap_create_no_mapping_v6 stays at 0 for now, since the built-in
gateway lookups only return IPv4 gateways.

The existing portmap_upnp_select_* metrics move from the UPnP Probe
block to the new createOrGetMapping block, since only
createOrGetMapping increments them. Their names don't change.

Updates tailscale/corp#51202

Change-Id: Iec2051d803f6714aed1b37d63426c1d327e53ff3
Signed-off-by: Francois Marier <francois@tailscale.com>
2026-12-03 23:34:00 +00:00
..
2026-07-10 17:39:16 -07:00
2026-12-02 18:06:59 -08:00