summaryrefslogtreecommitdiffhomepage
path: root/control
diff options
context:
space:
mode:
Diffstat (limited to 'control')
-rw-r--r--control/controlclient/auto.go12
-rw-r--r--control/controlclient/client.go6
-rw-r--r--control/controlclient/direct.go41
3 files changed, 4 insertions, 55 deletions
diff --git a/control/controlclient/auto.go b/control/controlclient/auto.go
index fa5e2e106..10f5a3781 100644
--- a/control/controlclient/auto.go
+++ b/control/controlclient/auto.go
@@ -564,18 +564,6 @@ func (c *Auto) SetHostinfo(hi *tailcfg.Hostinfo) {
c.updateControl()
}
-func (c *Auto) SetNetInfo(ni *tailcfg.NetInfo) {
- if ni == nil {
- panic("nil NetInfo")
- }
- if !c.direct.SetNetInfo(ni) {
- return
- }
-
- // Send new NetInfo to server
- c.updateControl()
-}
-
// SetTKAHead updates the TKA head hash that map-request infrastructure sends.
func (c *Auto) SetTKAHead(headHash string) {
if !c.direct.SetTKAHead(headHash) {
diff --git a/control/controlclient/client.go b/control/controlclient/client.go
index ef5af68c6..1bd087e29 100644
--- a/control/controlclient/client.go
+++ b/control/controlclient/client.go
@@ -65,12 +65,6 @@ type Client interface {
// in a separate http request. It has nothing to do with the rest of
// the state machine.
SetHostinfo(*tailcfg.Hostinfo)
- // SetNetinfo changes the NetIinfo structure that will be sent in
- // subsequent node registration requests.
- // TODO: a server-side change would let us simply upload this
- // in a separate http request. It has nothing to do with the rest of
- // the state machine.
- SetNetInfo(*tailcfg.NetInfo)
// SetTKAHead changes the TKA head hash value that will be sent in
// subsequent netmap requests.
SetTKAHead(headHash string)
diff --git a/control/controlclient/direct.go b/control/controlclient/direct.go
index 80f6e919b..1b1ed78f5 100644
--- a/control/controlclient/direct.go
+++ b/control/controlclient/direct.go
@@ -20,7 +20,6 @@ import (
"net/netip"
"net/url"
"os"
- "reflect"
"runtime"
"slices"
"strings"
@@ -50,7 +49,6 @@ import (
"tailscale.com/types/logger"
"tailscale.com/types/netmap"
"tailscale.com/types/persist"
- "tailscale.com/types/ptr"
"tailscale.com/types/tkatype"
"tailscale.com/util/clientmetric"
"tailscale.com/util/multierr"
@@ -93,8 +91,7 @@ type Direct struct {
authKey string
tryingNewKey key.NodePrivate
expiry time.Time // or zero value if none/unknown
- hostinfo *tailcfg.Hostinfo // always non-nil
- netinfo *tailcfg.NetInfo
+ hostinfo *tailcfg.Hostinfo // always non-nil, never mutated only replaced
endpoints []tailcfg.Endpoint
tkaHead string
lastPingURL string // last PingRequest.URL received, for dup suppression
@@ -289,9 +286,6 @@ func NewDirect(opts Options) (*Direct, error) {
c.SetHostinfo(hostinfo.New())
} else {
c.SetHostinfo(opts.Hostinfo)
- if ni := opts.Hostinfo.NetInfo; ni != nil {
- c.SetNetInfo(ni)
- }
}
if opts.NoiseTestClient != nil {
c.noiseClient = &NoiseClient{
@@ -321,8 +315,6 @@ func (c *Direct) SetHostinfo(hi *tailcfg.Hostinfo) bool {
if hi == nil {
panic("nil Hostinfo")
}
- hi = ptr.To(*hi)
- hi.NetInfo = nil
c.mu.Lock()
defer c.mu.Unlock()
@@ -335,24 +327,7 @@ func (c *Direct) SetHostinfo(hi *tailcfg.Hostinfo) bool {
return true
}
-// SetNetInfo clones the provided NetInfo and remembers it for the
-// next update. It reports whether the NetInfo has changed.
-func (c *Direct) SetNetInfo(ni *tailcfg.NetInfo) bool {
- if ni == nil {
- panic("nil NetInfo")
- }
- c.mu.Lock()
- defer c.mu.Unlock()
-
- if reflect.DeepEqual(ni, c.netinfo) {
- return false
- }
- c.netinfo = ni.Clone()
- c.logf("NetInfo: %v", ni)
- return true
-}
-
-// SetNetInfo stores a new TKA head value for next update.
+// SetTKAHead stores a new TKA head value for next update.
// It reports whether the TKA head changed.
func (c *Direct) SetTKAHead(tkaHead string) bool {
c.mu.Lock()
@@ -445,14 +420,6 @@ type httpClient interface {
Do(req *http.Request) (*http.Response, error)
}
-// hostInfoLocked returns a Clone of c.hostinfo and c.netinfo.
-// It must only be called with c.mu held.
-func (c *Direct) hostInfoLocked() *tailcfg.Hostinfo {
- hi := c.hostinfo.Clone()
- hi.NetInfo = c.netinfo.Clone()
- return hi
-}
-
func (c *Direct) doLogin(ctx context.Context, opt loginOpt) (mustRegen bool, newURL string, nks tkatype.MarshaledSignature, err error) {
c.mu.Lock()
persist := c.persist.AsStruct()
@@ -460,7 +427,7 @@ func (c *Direct) doLogin(ctx context.Context, opt loginOpt) (mustRegen bool, new
serverKey := c.serverKey
serverNoiseKey := c.serverNoiseKey
authKey, isWrapped, wrappedSig, wrappedKey := decodeWrappedAuthkey(c.authKey, c.logf)
- hi := c.hostInfoLocked()
+ hi := c.hostinfo
backendLogID := hi.BackendLogID
expired := !c.expiry.IsZero() && c.expiry.Before(c.clock.Now())
c.mu.Unlock()
@@ -849,7 +816,7 @@ func (c *Direct) sendMapRequest(ctx context.Context, isStreaming bool, nu Netmap
serverURL := c.serverURL
serverKey := c.serverKey
serverNoiseKey := c.serverNoiseKey
- hi := c.hostInfoLocked()
+ hi := c.hostinfo
backendLogID := hi.BackendLogID
var epStrs []string
var eps []netip.AddrPort