summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIrbe Krumina <irbe@tailscale.com>2024-08-05 19:45:35 +0300
committerIrbe Krumina <irbe@tailscale.com>2024-08-05 19:45:35 +0300
commit981c2fa5fdf4f47677e738b96865c9a7ffbff03e (patch)
treef83b2d7e5a3b513de39ad862c441527ff1c23072
parent3748046455f9885344931312044017aec9ee82c7 (diff)
downloadtailscale-irbekrm/reload_config.tar.xz
tailscale-irbekrm/reload_config.zip
code review feedbackirbekrm/reload_config
Signed-off-by: Irbe Krumina <irbe@tailscale.com>
-rw-r--r--ipn/ipnlocal/local.go5
-rw-r--r--wgengine/magicsock/magicsock.go6
2 files changed, 6 insertions, 5 deletions
diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go
index bdce8591c..87dc2eaff 100644
--- a/ipn/ipnlocal/local.go
+++ b/ipn/ipnlocal/local.go
@@ -626,7 +626,7 @@ func (b *LocalBackend) SetDirectFileRoot(dir string) {
// success, or (false, error) on failure.
//
// If it is called whilst the LocalBackend is in 'Running' state, only a subset
-// of changes currently deemed safe to chnage for a running system are applied.
+// of changes currently deemed safe to change for a running system are applied.
// The rest of the changes will get applied next time LocalBackend starts and
// config is reloaded. Currently (08/2024) changes safe to apply while running
// are changes to '.AcceptRoutes', '.AdvertiseRoutes' and '.StaticEndpoints'
@@ -705,8 +705,7 @@ func (b *LocalBackend) setConfigLocked(conf *conffile.Config, unlock unlockOnce)
return err
}
-// needStaticEndpointUpdate accepts a configfile and returns true if the
-// configfile contains a change to the static wireguard endpoints.
+// needStaticEndpointUpdate reports whether newConf modifies the static wireguard endpoints.
func (b *LocalBackend) needStaticEndpointsUpdate(newConf *conffile.Config) bool {
// If the new configfile does not have static endpoints set and existing
// config does not have any (to unset), no need to update.
diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go
index eddefaa1a..4966add86 100644
--- a/wgengine/magicsock/magicsock.go
+++ b/wgengine/magicsock/magicsock.go
@@ -645,7 +645,7 @@ func (c *Conn) setEndpoints(endpoints []tailcfg.Endpoint) (changed bool) {
// SetStaticEndpoints sets static endpoints to the provided value and triggers
// an asynchronous update of the endpoints that this node advertises.
-// Static endpoints are endpoints explicitly configured by user.
+// Static endpoints are endpoints explicitly configured by the user.
func (c *Conn) SetStaticEndpoints(ep views.Slice[netip.AddrPort]) {
c.mu.Lock()
if reflect.DeepEqual(c.staticEndpoints.AsSlice(), ep.AsSlice()) {
@@ -659,8 +659,10 @@ func (c *Conn) SetStaticEndpoints(ep views.Slice[netip.AddrPort]) {
c.ReSTUN("static-endpoint-change")
}
-// GetStaticEndpoints returns any wireguard endpoints explicitly configured by user.
+// GetStaticEndpoints returns any wireguard endpoints explicitly configured by the user.
func (c *Conn) GetStaticEndpoints() views.Slice[netip.AddrPort] {
+ c.mu.Lock()
+ c.mu.Unlock()
return c.staticEndpoints
}