mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
ipn: remove DisableDERP pref
We depend on DERP for NAT traversal now[0] so disabling it entirely can't work. What we'll do instead in the future is let people specify alternate/additional DERP servers. And perhaps in the future we could also add a pref for nodes to say when they expect to never need/want to use DERP for data (but allow it for NAT traversal communication). But this isn't the right pref and it doesn't work, so delete it. Fixes #318 [0] https://tailscale.com/blog/how-nat-traversal-works/
This commit is contained in:
parent
f0e9dcdc0a
commit
3bdcfa7193
@ -60,7 +60,6 @@
|
|||||||
upf.StringVar(&upArgs.advertiseTags, "advertise-tags", "", "ACL tags to request (comma-separated, e.g. eng,montreal,ssh)")
|
upf.StringVar(&upArgs.advertiseTags, "advertise-tags", "", "ACL tags to request (comma-separated, e.g. eng,montreal,ssh)")
|
||||||
upf.StringVar(&upArgs.authKey, "authkey", "", "node authorization key")
|
upf.StringVar(&upArgs.authKey, "authkey", "", "node authorization key")
|
||||||
upf.StringVar(&upArgs.hostname, "hostname", "", "hostname to use instead of the one provided by the OS")
|
upf.StringVar(&upArgs.hostname, "hostname", "", "hostname to use instead of the one provided by the OS")
|
||||||
upf.BoolVar(&upArgs.enableDERP, "enable-derp", true, "enable the use of DERP servers")
|
|
||||||
if runtime.GOOS == "linux" || isBSD(runtime.GOOS) || version.OS() == "macOS" {
|
if runtime.GOOS == "linux" || isBSD(runtime.GOOS) || version.OS() == "macOS" {
|
||||||
upf.StringVar(&upArgs.advertiseRoutes, "advertise-routes", "", "routes to advertise to other nodes (comma-separated, e.g. 10.0.0.0/8,192.168.0.0/24)")
|
upf.StringVar(&upArgs.advertiseRoutes, "advertise-routes", "", "routes to advertise to other nodes (comma-separated, e.g. 10.0.0.0/8,192.168.0.0/24)")
|
||||||
}
|
}
|
||||||
@ -89,7 +88,6 @@ func defaultNetfilterMode() string {
|
|||||||
forceReauth bool
|
forceReauth bool
|
||||||
advertiseRoutes string
|
advertiseRoutes string
|
||||||
advertiseTags string
|
advertiseTags string
|
||||||
enableDERP bool
|
|
||||||
snat bool
|
snat bool
|
||||||
netfilterMode string
|
netfilterMode string
|
||||||
authKey string
|
authKey string
|
||||||
@ -216,7 +214,6 @@ func runUp(ctx context.Context, args []string) error {
|
|||||||
prefs.AdvertiseRoutes = routes
|
prefs.AdvertiseRoutes = routes
|
||||||
prefs.AdvertiseTags = tags
|
prefs.AdvertiseTags = tags
|
||||||
prefs.NoSNAT = !upArgs.snat
|
prefs.NoSNAT = !upArgs.snat
|
||||||
prefs.DisableDERP = !upArgs.enableDERP
|
|
||||||
prefs.Hostname = upArgs.hostname
|
prefs.Hostname = upArgs.hostname
|
||||||
if runtime.GOOS == "linux" {
|
if runtime.GOOS == "linux" {
|
||||||
switch upArgs.netfilterMode {
|
switch upArgs.netfilterMode {
|
||||||
|
13
ipn/local.go
13
ipn/local.go
@ -273,17 +273,10 @@ func (b *LocalBackend) setClientStatus(st controlclient.Status) {
|
|||||||
|
|
||||||
b.updateFilter(st.NetMap, prefs)
|
b.updateFilter(st.NetMap, prefs)
|
||||||
b.e.SetNetworkMap(st.NetMap)
|
b.e.SetNetworkMap(st.NetMap)
|
||||||
|
|
||||||
if !dnsMapsEqual(st.NetMap, netMap) {
|
if !dnsMapsEqual(st.NetMap, netMap) {
|
||||||
b.updateDNSMap(st.NetMap)
|
b.updateDNSMap(st.NetMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
disableDERP := prefs != nil && prefs.DisableDERP
|
|
||||||
if disableDERP {
|
|
||||||
b.e.SetDERPMap(nil)
|
|
||||||
} else {
|
|
||||||
b.e.SetDERPMap(st.NetMap.DERPMap)
|
b.e.SetDERPMap(st.NetMap.DERPMap)
|
||||||
}
|
|
||||||
|
|
||||||
b.send(Notify{NetMap: st.NetMap})
|
b.send(Notify{NetMap: st.NetMap})
|
||||||
}
|
}
|
||||||
@ -869,11 +862,7 @@ func (b *LocalBackend) SetPrefs(new *Prefs) {
|
|||||||
|
|
||||||
b.updateFilter(netMap, new)
|
b.updateFilter(netMap, new)
|
||||||
|
|
||||||
turnDERPOff := new.DisableDERP && !old.DisableDERP
|
if netMap != nil {
|
||||||
turnDERPOn := !new.DisableDERP && old.DisableDERP
|
|
||||||
if turnDERPOff {
|
|
||||||
b.e.SetDERPMap(nil)
|
|
||||||
} else if turnDERPOn && netMap != nil {
|
|
||||||
b.e.SetDERPMap(netMap.DERPMap)
|
b.e.SetDERPMap(netMap.DERPMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,9 +67,6 @@ type Prefs struct {
|
|||||||
// users narrow it down a bit.
|
// users narrow it down a bit.
|
||||||
NotepadURLs bool
|
NotepadURLs bool
|
||||||
|
|
||||||
// DisableDERP prevents DERP from being used.
|
|
||||||
DisableDERP bool
|
|
||||||
|
|
||||||
// The following block of options only have an effect on Linux.
|
// The following block of options only have an effect on Linux.
|
||||||
|
|
||||||
// AdvertiseRoutes specifies CIDR prefixes to advertise into the
|
// AdvertiseRoutes specifies CIDR prefixes to advertise into the
|
||||||
@ -109,9 +106,9 @@ func (p *Prefs) Pretty() string {
|
|||||||
} else {
|
} else {
|
||||||
pp = "Persist=nil"
|
pp = "Persist=nil"
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("Prefs{ra=%v mesh=%v dns=%v want=%v notepad=%v derp=%v shields=%v routes=%v snat=%v nf=%v %v}",
|
return fmt.Sprintf("Prefs{ra=%v mesh=%v dns=%v want=%v notepad=%v shields=%v routes=%v snat=%v nf=%v %v}",
|
||||||
p.RouteAll, p.AllowSingleHosts, p.CorpDNS, p.WantRunning,
|
p.RouteAll, p.AllowSingleHosts, p.CorpDNS, p.WantRunning,
|
||||||
p.NotepadURLs, !p.DisableDERP, p.ShieldsUp, p.AdvertiseRoutes, !p.NoSNAT, p.NetfilterMode, pp)
|
p.NotepadURLs, p.ShieldsUp, p.AdvertiseRoutes, !p.NoSNAT, p.NetfilterMode, pp)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Prefs) ToBytes() []byte {
|
func (p *Prefs) ToBytes() []byte {
|
||||||
@ -137,7 +134,6 @@ func (p *Prefs) Equals(p2 *Prefs) bool {
|
|||||||
p.CorpDNS == p2.CorpDNS &&
|
p.CorpDNS == p2.CorpDNS &&
|
||||||
p.WantRunning == p2.WantRunning &&
|
p.WantRunning == p2.WantRunning &&
|
||||||
p.NotepadURLs == p2.NotepadURLs &&
|
p.NotepadURLs == p2.NotepadURLs &&
|
||||||
p.DisableDERP == p2.DisableDERP &&
|
|
||||||
p.ShieldsUp == p2.ShieldsUp &&
|
p.ShieldsUp == p2.ShieldsUp &&
|
||||||
p.NoSNAT == p2.NoSNAT &&
|
p.NoSNAT == p2.NoSNAT &&
|
||||||
p.NetfilterMode == p2.NetfilterMode &&
|
p.NetfilterMode == p2.NetfilterMode &&
|
||||||
|
@ -24,7 +24,7 @@ func fieldsOf(t reflect.Type) (fields []string) {
|
|||||||
func TestPrefsEqual(t *testing.T) {
|
func TestPrefsEqual(t *testing.T) {
|
||||||
tstest.PanicOnLog()
|
tstest.PanicOnLog()
|
||||||
|
|
||||||
prefsHandles := []string{"ControlURL", "RouteAll", "AllowSingleHosts", "CorpDNS", "WantRunning", "ShieldsUp", "AdvertiseTags", "Hostname", "OSVersion", "DeviceModel", "NotepadURLs", "DisableDERP", "AdvertiseRoutes", "NoSNAT", "NetfilterMode", "Persist"}
|
prefsHandles := []string{"ControlURL", "RouteAll", "AllowSingleHosts", "CorpDNS", "WantRunning", "ShieldsUp", "AdvertiseTags", "Hostname", "OSVersion", "DeviceModel", "NotepadURLs", "AdvertiseRoutes", "NoSNAT", "NetfilterMode", "Persist"}
|
||||||
if have := fieldsOf(reflect.TypeOf(Prefs{})); !reflect.DeepEqual(have, prefsHandles) {
|
if have := fieldsOf(reflect.TypeOf(Prefs{})); !reflect.DeepEqual(have, prefsHandles) {
|
||||||
t.Errorf("Prefs.Equal check might be out of sync\nfields: %q\nhandled: %q\n",
|
t.Errorf("Prefs.Equal check might be out of sync\nfields: %q\nhandled: %q\n",
|
||||||
have, prefsHandles)
|
have, prefsHandles)
|
||||||
|
Loading…
Reference in New Issue
Block a user