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:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user