feature/conn25: recreate transit IP mappings when connector loses them

Mappings from transit IPs to real IPs are stored ephemerally in the
connector, so they're lost on restart. When we send a packet to the
connector with a transit IP it does not recognize, it sends us a TSMP
message saying so (see #19883). If we (the client) know of such a
mapping, we now re-send it to the connector so that a connection can
proceed.

Fixes tailscale/corp#34256.

Signed-off-by: Naman Sood <mail@nsood.in>
This commit is contained in:
Naman Sood
2026-06-17 13:50:51 -04:00
committed by GitHub
parent 88f5206511
commit 47333e9487
4 changed files with 91 additions and 39 deletions
+11
View File
@@ -203,6 +203,11 @@ type Wrapper struct {
// false otherwise.
OnICMPEchoResponseReceived func(*packet.Parsed) bool
// OnUnmappedTransitIPMessage, if non-nil, is called when a TSMP message is
// received indicating that a packet was rejected by a connector due to a
// missing transit IP->real IP mapping.
OnUnmappedTransitIPMessage func(packet.TailscaleRejectedHeader)
// PeerAPIPort, if non-nil, returns the peerapi port that's
// running for the given IP address.
PeerAPIPort func(netip.Addr) (port uint16, ok bool)
@@ -1171,6 +1176,12 @@ func (t *Wrapper) filterPacketInboundFromWireGuard(p *packet.Parsed, captHook pa
if f := t.OnTSMPPongReceived; f != nil {
f(data)
}
} else if data, ok := p.AsTailscaleRejectedHeader(); ok {
if data.Reason == packet.RejectedDueToUnknownAppConnectorTransitIP {
if f := t.OnUnmappedTransitIPMessage; f != nil {
f(data)
}
}
}
}