ipn: handle advertised routes provided by frontend.

Signed-off-by: David Anderson <dave@natulte.net>
This commit is contained in:
David Anderson
2020-02-17 19:33:01 -08:00
committed by Dave Anderson
parent 5d79530caa
commit 47da432991
6 changed files with 177 additions and 13 deletions
+11
View File
@@ -156,6 +156,8 @@ func (b *LocalBackend) Start(opts Options) error {
return fmt.Errorf("loading requested state: %v", err)
}
hi.RoutableIPs = append(hi.RoutableIPs, b.prefs.AdvertiseRoutes...)
b.notify = opts.Notify
b.netMapCache = nil
b.mu.Unlock()
@@ -502,8 +504,17 @@ func (b *LocalBackend) SetPrefs(new Prefs) {
b.logf("Failed to save new controlclient state: %v", err)
}
}
oldHi := b.hiCache
newHi := oldHi.Copy()
newHi.RoutableIPs = append([]wgcfg.CIDR(nil), b.prefs.AdvertiseRoutes...)
b.hiCache = *newHi
cli := b.c
b.mu.Unlock()
if cli != nil && !oldHi.Equal(newHi) {
cli.SetHostinfo(*newHi)
}
if old.WantRunning != new.WantRunning {
b.stateMachine()
} else {