mirror of
https://github.com/tailscale/tailscale.git
synced 2026-06-23 23:41:41 -04:00
ipn/ipnlocal, types/netmap, tsnet: filter unsigned peers on delta path
aa5da2e5f2(in the 1.99.x dev series, unstable) introduced some bugs, only some of which were later fixed. This fixed another. As of that change, tkaFilterNetmapLocked ran only on full netmaps through LocalBackend.setClientStatusLocked and not peer upserts via new or changed peers. The laterae743642d9fixed a regression in the Engine layer but didn't fix the tkaFilter code from re-running on upserts. This add a tkaFilterDeltaMutsLocked pass before nodeBackend.UpdateNetmapDelta. For each NodeMutationUpsert whose peer fails the same signature check tkaFilterNetmapLocked applies, rewrite the upsert in place into a NodeMutationRemove targeting the same node ID, so magicsock's per-mutation dispatch and nodeBackend.peers both drop the peer, matching the prior full-netmap semantics. New tsnet tests added: - TestTailnetLockFiltersUnsignedDeltaPeer covers the new-peer case. - TestTailnetLockFiltersUnsignedDeltaPeerReplacement covers the existing-peer-replacement case, to an empty signature. - TestTailnetLockFiltersDeltaPeerWithInvalidSignature like above but with a bogus signature. Updates #12542 Updates tailscale/corp#43767 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com> Change-Id: Ib35d0391541fee654867c26489847dbc5b7e2ae8
This commit is contained in:
committed by
Brad Fitzpatrick
parent
0b551986fe
commit
af2f228a18
@@ -89,6 +89,13 @@ type NodeMutationRemove struct {
|
||||
|
||||
func (m NodeMutationRemove) Apply(*tailcfg.Node) {}
|
||||
|
||||
// MakeNodeMutationRemove returns a NodeMutationRemove that targets nodeID.
|
||||
// It is the constructor for NodeMutationRemove for callers outside this
|
||||
// package, since the embedded ID field is unexported.
|
||||
func MakeNodeMutationRemove(nodeID tailcfg.NodeID) NodeMutationRemove {
|
||||
return NodeMutationRemove{mutatingNodeID(nodeID)}
|
||||
}
|
||||
|
||||
var peerChangeFields = sync.OnceValue(func() []reflect.StructField {
|
||||
var fields []reflect.StructField
|
||||
rt := reflect.TypeFor[tailcfg.PeerChange]()
|
||||
|
||||
Reference in New Issue
Block a user