From 9d73f84a7166ae10f98b7e67678cd4ea8ebb3c1f Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 12 Jan 2021 07:54:34 -0800 Subject: [PATCH] tailcfg, control/controlclient: make MapResponse.CollectServices an opt.Bool Signed-off-by: Brad Fitzpatrick --- control/controlclient/direct.go | 7 ++++++- tailcfg/tailcfg.go | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/control/controlclient/direct.go b/control/controlclient/direct.go index d0d65080a..49fc6b10d 100644 --- a/control/controlclient/direct.go +++ b/control/controlclient/direct.go @@ -661,6 +661,7 @@ func (c *Direct) sendMapRequest(ctx context.Context, maxPolls int, cb func(*Netw var lastDERPMap *tailcfg.DERPMap var lastUserProfile = map[tailcfg.UserID]tailcfg.UserProfile{} var lastParsedPacketFilter []filter.Match + var collectServices bool // If allowStream, then the server will use an HTTP long poll to // return incremental results. There is always one response right @@ -742,6 +743,10 @@ func (c *Direct) sendMapRequest(ctx context.Context, maxPolls int, cb func(*Netw lastParsedPacketFilter = c.parsePacketFilter(pf) } + if v, ok := resp.CollectServices.Get(); ok { + collectServices = v + } + // Get latest localPort. This might've changed if // a lite map update occured meanwhile. This only affects // the end-to-end test. @@ -765,7 +770,7 @@ func (c *Direct) sendMapRequest(ctx context.Context, maxPolls int, cb func(*Netw DNS: resp.DNSConfig, Hostinfo: resp.Node.Hostinfo, PacketFilter: lastParsedPacketFilter, - CollectServices: resp.CollectServices, + CollectServices: collectServices, DERPMap: lastDERPMap, Debug: resp.Debug, } diff --git a/tailcfg/tailcfg.go b/tailcfg/tailcfg.go index df1cfcd60..e30b8004a 100644 --- a/tailcfg/tailcfg.go +++ b/tailcfg/tailcfg.go @@ -667,7 +667,9 @@ type MapResponse struct { // CollectServices reports whether this node's Tailnet has // requested that info about services be included in HostInfo. - CollectServices bool `json:",omitempty"` + // If unset, the most recent non-empty MapResponse value in + // the HTTP response stream is used. + CollectServices opt.Bool `json:",omitempty"` // PacketFilter are the firewall rules. //