tstest/integration/testcontrol: notify peers when subnet routes change

When SetSubnetRoutes is called, also send updatePeerChanged to all
other connected nodes so they re-fetch their MapResponse and learn
about the updated AllowedIPs. Without this, peers never see new
subnet routes until they happen to reconnect to the control server.

Discovered while working on a three-VM natlab subnet router
integration test, coming later.

Updates #13038

Change-Id: I20e7a2fda994a8ab0e7a24240e6eae536f4f5f15
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
main
Brad Fitzpatrick 1 week ago committed by Brad Fitzpatrick
parent 9e68841939
commit ccef06b968
  1. 7
      tstest/integration/testcontrol/testcontrol.go

@ -486,6 +486,13 @@ func (s *Server) SetSubnetRoutes(nodeKey key.NodePublic, routes []netip.Prefix)
mak.Set(&s.nodeSubnetRoutes, nodeKey, routes)
if node, ok := s.nodes[nodeKey]; ok {
sendUpdate(s.updates[node.ID], updateSelfChanged)
// Also notify all other peers so they get the updated AllowedIPs
// in their next MapResponse.
for _, n := range s.nodes {
if n.ID != node.ID {
sendUpdate(s.updates[n.ID], updatePeerChanged)
}
}
}
}

Loading…
Cancel
Save