James Tucker 7c15156d4c
net/netcheck,wgengine/magicsock: add potential workaround for Palo Alto DIPP behavior
Palo Alto firewalls have a typically hard NAT, but also have a mode
called Persistent DIPP that is supposed to provide consistent port
mapping suitable for STUN resolution of public ports. Persistent DIPP
works initially on most Palo Alto firewalls, but some models/software
versions have a bug which this works around.

The bug symptom presents as follows:

- STUN sessions resolve a correct public IP:port to start with
- Much later netchecks still return the same IP:Port for a subset of
  connections, most often the users active DERP, and/or the port related
  to sustained traffic.
- New public addresses however, such as every other DERP node in a
  full netcheck will now observe a new IP:Port.
- At this point of observation, new inbound connections will only
  succeed to the new IP:Port observed, and existing/old sessions will
  only work to the old binding.

In this patch we now advertise the lowest latency global endpoint
discovered as we always have, but in addition any global endpoints that
are observed more than once in a single netcheck report. This should
provide viable endpoints for potential connection establishment across
a NAT with this behavior.

Updates #19106

Signed-off-by: James Tucker <james@tailscale.com>
2024-05-16 15:58:19 -07:00
..
2024-04-02 11:31:49 -07:00