tstest/integration/testcontrol: make Stream w/ capver >= 68 match docs, prod
testcontrol wasn't following the document specs (and prod behavior) breaking a WIP integration test elsewhere. Updates tailscale/corp#40088 Change-Id: I02cf70894346bad7c85940b617d99c21c5310664 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
cf76202aa3
commit
dfc2667f8f
@@ -1157,8 +1157,15 @@ func (s *Server) serveMap(w http.ResponseWriter, r *http.Request, mkey key.Machi
|
||||
return
|
||||
}
|
||||
|
||||
// Per tailcfg.MapRequest.Stream docs: if Stream is true and Version >= 68,
|
||||
// the server must treat this as read-only and ignore Hostinfo, Endpoints,
|
||||
// DiscoKey, etc. — modern clients send those via a separate non-streaming
|
||||
// POST /machine/map from a dedicated updateRoutine, not piggybacked on the
|
||||
// streaming poll. Without this, the streaming MapRequest's zero-valued
|
||||
// DiscoKey/Endpoints clobber whatever was just pushed out-of-band.
|
||||
streamingNonUpdate := req.Stream && req.Version >= 68
|
||||
var peersToUpdate []tailcfg.NodeID
|
||||
if !req.ReadOnly {
|
||||
if !req.ReadOnly && !streamingNonUpdate {
|
||||
endpoints := filterInvalidIPv6Endpoints(req.Endpoints)
|
||||
node.Endpoints = endpoints
|
||||
node.DiscoKey = req.DiscoKey
|
||||
|
||||
Reference in New Issue
Block a user