mirror of
https://github.com/tailscale/tailscale.git
synced 2025-03-28 20:12:27 +00:00
ipn/ipnlocal: disallow exit nodes from using exit nodes
Nodes which have both -advertise-exit-node and -exit-node in prefs should continue have them until the next invocation of `tailscale up`. Updates #3569. Signed-off-by: salman <salman@tailscale.com>
This commit is contained in:
parent
5f68763cb2
commit
2d271f3bd1
@ -2362,6 +2362,9 @@ func (b *LocalBackend) checkPrefsLocked(p *ipn.Prefs) error {
|
|||||||
if err := b.checkSSHPrefsLocked(p); err != nil {
|
if err := b.checkSSHPrefsLocked(p); err != nil {
|
||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
}
|
}
|
||||||
|
if err := b.checkExitNodePrefsLocked(p); err != nil {
|
||||||
|
errs = append(errs, err)
|
||||||
|
}
|
||||||
return multierr.New(errs...)
|
return multierr.New(errs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2441,6 +2444,13 @@ func (b *LocalBackend) isDefaultServerLocked() bool {
|
|||||||
return prefs.ControlURLOrDefault() == ipn.DefaultControlURL
|
return prefs.ControlURLOrDefault() == ipn.DefaultControlURL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *LocalBackend) checkExitNodePrefsLocked(p *ipn.Prefs) error {
|
||||||
|
if (p.ExitNodeIP.IsValid() || p.ExitNodeID != "") && p.AdvertisesExitNode() {
|
||||||
|
return errors.New("Cannot advertise an exit node and use an exit node at the same time.")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (b *LocalBackend) EditPrefs(mp *ipn.MaskedPrefs) (ipn.PrefsView, error) {
|
func (b *LocalBackend) EditPrefs(mp *ipn.MaskedPrefs) (ipn.PrefsView, error) {
|
||||||
b.mu.Lock()
|
b.mu.Lock()
|
||||||
if mp.EggSet {
|
if mp.EggSet {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user