@ -186,12 +186,11 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "losing_hostname" ,
name : "losing_hostname" ,
flags : [ ] string { "--accept-dns" } ,
flags : [ ] string { "--accept-dns" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
WantRunning : false ,
WantRunning : false ,
Hostname : "foo" ,
Hostname : "foo" ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
AllowSingleHosts : true ,
} ,
} ,
want : accidentalUpPrefix + " --accept-dns --hostname=foo" ,
want : accidentalUpPrefix + " --accept-dns --hostname=foo" ,
} ,
} ,
@ -199,11 +198,10 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "hostname_changing_explicitly" ,
name : "hostname_changing_explicitly" ,
flags : [ ] string { "--hostname=bar" } ,
flags : [ ] string { "--hostname=bar" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
AllowSingleHosts : true ,
Hostname : "foo" ,
Hostname : "foo" ,
} ,
} ,
want : "" ,
want : "" ,
} ,
} ,
@ -211,11 +209,10 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "hostname_changing_empty_explicitly" ,
name : "hostname_changing_empty_explicitly" ,
flags : [ ] string { "--hostname=" } ,
flags : [ ] string { "--hostname=" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
AllowSingleHosts : true ,
Hostname : "foo" ,
Hostname : "foo" ,
} ,
} ,
want : "" ,
want : "" ,
} ,
} ,
@ -231,11 +228,10 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "implicit_operator_change" ,
name : "implicit_operator_change" ,
flags : [ ] string { "--hostname=foo" } ,
flags : [ ] string { "--hostname=foo" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
OperatorUser : "alice" ,
OperatorUser : "alice" ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
curUser : "eve" ,
curUser : "eve" ,
want : accidentalUpPrefix + " --hostname=foo --operator=alice" ,
want : accidentalUpPrefix + " --hostname=foo --operator=alice" ,
@ -244,11 +240,10 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "implicit_operator_matches_shell_user" ,
name : "implicit_operator_matches_shell_user" ,
flags : [ ] string { "--hostname=foo" } ,
flags : [ ] string { "--hostname=foo" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
OperatorUser : "alice" ,
OperatorUser : "alice" ,
} ,
} ,
curUser : "alice" ,
curUser : "alice" ,
want : "" ,
want : "" ,
@ -257,10 +252,9 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "error_advertised_routes_exit_node_removed" ,
name : "error_advertised_routes_exit_node_removed" ,
flags : [ ] string { "--advertise-routes=10.0.42.0/24" } ,
flags : [ ] string { "--advertise-routes=10.0.42.0/24" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
AdvertiseRoutes : [ ] netip . Prefix {
AdvertiseRoutes : [ ] netip . Prefix {
netip . MustParsePrefix ( "10.0.42.0/24" ) ,
netip . MustParsePrefix ( "10.0.42.0/24" ) ,
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
@ -273,10 +267,9 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "advertised_routes_exit_node_removed_explicit" ,
name : "advertised_routes_exit_node_removed_explicit" ,
flags : [ ] string { "--advertise-routes=10.0.42.0/24" , "--advertise-exit-node=false" } ,
flags : [ ] string { "--advertise-routes=10.0.42.0/24" , "--advertise-exit-node=false" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
AdvertiseRoutes : [ ] netip . Prefix {
AdvertiseRoutes : [ ] netip . Prefix {
netip . MustParsePrefix ( "10.0.42.0/24" ) ,
netip . MustParsePrefix ( "10.0.42.0/24" ) ,
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
@ -289,10 +282,9 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "advertised_routes_includes_the_0_routes" , // but no --advertise-exit-node
name : "advertised_routes_includes_the_0_routes" , // but no --advertise-exit-node
flags : [ ] string { "--advertise-routes=11.1.43.0/24,0.0.0.0/0,::/0" } ,
flags : [ ] string { "--advertise-routes=11.1.43.0/24,0.0.0.0/0,::/0" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
AdvertiseRoutes : [ ] netip . Prefix {
AdvertiseRoutes : [ ] netip . Prefix {
netip . MustParsePrefix ( "10.0.42.0/24" ) ,
netip . MustParsePrefix ( "10.0.42.0/24" ) ,
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
@ -305,10 +297,9 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "advertise_exit_node" , // Issue 1859
name : "advertise_exit_node" , // Issue 1859
flags : [ ] string { "--advertise-exit-node" } ,
flags : [ ] string { "--advertise-exit-node" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
want : "" ,
want : "" ,
} ,
} ,
@ -316,10 +307,9 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "advertise_exit_node_over_existing_routes" ,
name : "advertise_exit_node_over_existing_routes" ,
flags : [ ] string { "--advertise-exit-node" } ,
flags : [ ] string { "--advertise-exit-node" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
AdvertiseRoutes : [ ] netip . Prefix {
AdvertiseRoutes : [ ] netip . Prefix {
netip . MustParsePrefix ( "1.2.0.0/16" ) ,
netip . MustParsePrefix ( "1.2.0.0/16" ) ,
@ -331,10 +321,9 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "advertise_exit_node_over_existing_routes_and_exit_node" ,
name : "advertise_exit_node_over_existing_routes_and_exit_node" ,
flags : [ ] string { "--advertise-exit-node" } ,
flags : [ ] string { "--advertise-exit-node" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
AdvertiseRoutes : [ ] netip . Prefix {
AdvertiseRoutes : [ ] netip . Prefix {
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
netip . MustParsePrefix ( "::/0" ) ,
netip . MustParsePrefix ( "::/0" ) ,
@ -347,10 +336,9 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "exit_node_clearing" , // Issue 1777
name : "exit_node_clearing" , // Issue 1777
flags : [ ] string { "--exit-node=" } ,
flags : [ ] string { "--exit-node=" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
ExitNodeID : "fooID" ,
ExitNodeID : "fooID" ,
} ,
} ,
@ -360,16 +348,15 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "remove_all_implicit" ,
name : "remove_all_implicit" ,
flags : [ ] string { "--force-reauth" } ,
flags : [ ] string { "--force-reauth" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
WantRunning : true ,
WantRunning : true ,
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
RouteAll : true ,
RouteAll : true ,
AllowSingleHosts : false ,
ExitNodeIP : netip . MustParseAddr ( "100.64.5.6" ) ,
ExitNodeIP : netip . MustParseAddr ( "100.64.5.6" ) ,
CorpDNS : false ,
CorpDNS : false ,
ShieldsUp : true ,
ShieldsUp : true ,
AdvertiseTags : [ ] string { "tag:foo" , "tag:bar" } ,
AdvertiseTags : [ ] string { "tag:foo" , "tag:bar" } ,
Hostname : "myhostname" ,
Hostname : "myhostname" ,
ForceDaemon : true ,
ForceDaemon : true ,
AdvertiseRoutes : [ ] netip . Prefix {
AdvertiseRoutes : [ ] netip . Prefix {
netip . MustParsePrefix ( "10.0.0.0/16" ) ,
netip . MustParsePrefix ( "10.0.0.0/16" ) ,
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
@ -379,22 +366,21 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
OperatorUser : "alice" ,
OperatorUser : "alice" ,
} ,
} ,
curUser : "eve" ,
curUser : "eve" ,
want : accidentalUpPrefix + " --force-reauth --accept-dns=false --accept-routes --advertise-exit-node --advertise-routes=10.0.0.0/16 --advertise-tags=tag:foo,tag:bar --exit-node=100.64.5.6 --host -routes=false --host name=myhostname --netfilter-mode=nodivert --operator=alice --shields-up",
want : accidentalUpPrefix + " --force-reauth --accept-dns=false --accept-routes --advertise-exit-node --advertise-routes=10.0.0.0/16 --advertise-tags=tag:foo,tag:bar --exit-node=100.64.5.6 --host name=myhostname --netfilter-mode=nodivert --operator=alice --shields-up",
} ,
} ,
{
{
name : "remove_all_implicit_except_hostname" ,
name : "remove_all_implicit_except_hostname" ,
flags : [ ] string { "--hostname=newhostname" } ,
flags : [ ] string { "--hostname=newhostname" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
WantRunning : true ,
WantRunning : true ,
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
RouteAll : true ,
RouteAll : true ,
AllowSingleHosts : false ,
ExitNodeIP : netip . MustParseAddr ( "100.64.5.6" ) ,
ExitNodeIP : netip . MustParseAddr ( "100.64.5.6" ) ,
CorpDNS : false ,
CorpDNS : false ,
ShieldsUp : true ,
ShieldsUp : true ,
AdvertiseTags : [ ] string { "tag:foo" , "tag:bar" } ,
AdvertiseTags : [ ] string { "tag:foo" , "tag:bar" } ,
Hostname : "myhostname" ,
Hostname : "myhostname" ,
ForceDaemon : true ,
ForceDaemon : true ,
AdvertiseRoutes : [ ] netip . Prefix {
AdvertiseRoutes : [ ] netip . Prefix {
netip . MustParsePrefix ( "10.0.0.0/16" ) ,
netip . MustParsePrefix ( "10.0.0.0/16" ) ,
} ,
} ,
@ -402,17 +388,16 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
OperatorUser : "alice" ,
OperatorUser : "alice" ,
} ,
} ,
curUser : "eve" ,
curUser : "eve" ,
want : accidentalUpPrefix + " --hostname=newhostname --accept-dns=false --accept-routes --advertise-routes=10.0.0.0/16 --advertise-tags=tag:foo,tag:bar --exit-node=100.64.5.6 -- host-routes=false -- netfilter-mode=nodivert --operator=alice --shields-up",
want : accidentalUpPrefix + " --hostname=newhostname --accept-dns=false --accept-routes --advertise-routes=10.0.0.0/16 --advertise-tags=tag:foo,tag:bar --exit-node=100.64.5.6 -- netfilter-mode=nodivert --operator=alice --shields-up",
} ,
} ,
{
{
name : "loggedout_is_implicit" ,
name : "loggedout_is_implicit" ,
flags : [ ] string { "--hostname=foo" } ,
flags : [ ] string { "--hostname=foo" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
LoggedOut : true ,
LoggedOut : true ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
want : "" , // not an error. LoggedOut is implicit.
want : "" , // not an error. LoggedOut is implicit.
} ,
} ,
@ -422,10 +407,9 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "make_windows_exit_node" ,
name : "make_windows_exit_node" ,
flags : [ ] string { "--advertise-exit-node" } ,
flags : [ ] string { "--advertise-exit-node" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
RouteAll : true ,
RouteAll : true ,
// And assume this no-op accidental pre-1.8 value:
// And assume this no-op accidental pre-1.8 value:
NoSNAT : true ,
NoSNAT : true ,
@ -437,8 +421,7 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "ignore_netfilter_change_non_linux" ,
name : "ignore_netfilter_change_non_linux" ,
flags : [ ] string { "--accept-dns" } ,
flags : [ ] string { "--accept-dns" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
NetfilterMode : preftype . NetfilterNoDivert , // we never had this bug, but pretend it got set non-zero on Windows somehow
NetfilterMode : preftype . NetfilterNoDivert , // we never had this bug, but pretend it got set non-zero on Windows somehow
} ,
} ,
@ -449,10 +432,9 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "operator_losing_routes_step1" , // https://twitter.com/EXPbits/status/1390418145047887877
name : "operator_losing_routes_step1" , // https://twitter.com/EXPbits/status/1390418145047887877
flags : [ ] string { "--operator=expbits" } ,
flags : [ ] string { "--operator=expbits" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
AdvertiseRoutes : [ ] netip . Prefix {
AdvertiseRoutes : [ ] netip . Prefix {
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
netip . MustParsePrefix ( "::/0" ) ,
netip . MustParsePrefix ( "::/0" ) ,
@ -465,10 +447,9 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "operator_losing_routes_step2" , // https://twitter.com/EXPbits/status/1390418145047887877
name : "operator_losing_routes_step2" , // https://twitter.com/EXPbits/status/1390418145047887877
flags : [ ] string { "--operator=expbits" , "--advertise-routes=1.2.0.0/16" } ,
flags : [ ] string { "--operator=expbits" , "--advertise-routes=1.2.0.0/16" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
AdvertiseRoutes : [ ] netip . Prefix {
AdvertiseRoutes : [ ] netip . Prefix {
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
netip . MustParsePrefix ( "::/0" ) ,
netip . MustParsePrefix ( "::/0" ) ,
@ -481,11 +462,10 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "errors_preserve_explicit_flags" ,
name : "errors_preserve_explicit_flags" ,
flags : [ ] string { "--reset" , "--force-reauth=false" , "--authkey=secretrand" } ,
flags : [ ] string { "--reset" , "--force-reauth=false" , "--authkey=secretrand" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
WantRunning : false ,
WantRunning : false ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
AllowSingleHosts : true ,
Hostname : "foo" ,
Hostname : "foo" ,
} ,
} ,
@ -495,10 +475,9 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "error_exit_node_omit_with_ip_pref" ,
name : "error_exit_node_omit_with_ip_pref" ,
flags : [ ] string { "--hostname=foo" } ,
flags : [ ] string { "--hostname=foo" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
ExitNodeIP : netip . MustParseAddr ( "100.64.5.4" ) ,
ExitNodeIP : netip . MustParseAddr ( "100.64.5.4" ) ,
} ,
} ,
@ -509,10 +488,9 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
flags : [ ] string { "--hostname=foo" } ,
flags : [ ] string { "--hostname=foo" } ,
curExitNodeIP : netip . MustParseAddr ( "100.64.5.7" ) ,
curExitNodeIP : netip . MustParseAddr ( "100.64.5.7" ) ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
ExitNodeID : "some_stable_id" ,
ExitNodeID : "some_stable_id" ,
} ,
} ,
@ -523,10 +501,9 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
flags : [ ] string { "--hostname=foo" } ,
flags : [ ] string { "--hostname=foo" } ,
curExitNodeIP : netip . MustParseAddr ( "100.2.3.4" ) ,
curExitNodeIP : netip . MustParseAddr ( "100.2.3.4" ) ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
ExitNodeAllowLANAccess : true ,
ExitNodeAllowLANAccess : true ,
ExitNodeID : "some_stable_id" ,
ExitNodeID : "some_stable_id" ,
@ -537,10 +514,9 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "ignore_login_server_synonym" ,
name : "ignore_login_server_synonym" ,
flags : [ ] string { "--login-server=https://controlplane.tailscale.com" } ,
flags : [ ] string { "--login-server=https://controlplane.tailscale.com" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
want : "" , // not an error
want : "" , // not an error
} ,
} ,
@ -548,10 +524,9 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "ignore_login_server_synonym_on_other_change" ,
name : "ignore_login_server_synonym_on_other_change" ,
flags : [ ] string { "--netfilter-mode=off" } ,
flags : [ ] string { "--netfilter-mode=off" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
AllowSingleHosts : true ,
CorpDNS : false ,
CorpDNS : false ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
want : accidentalUpPrefix + " --netfilter-mode=off --accept-dns=false" ,
want : accidentalUpPrefix + " --netfilter-mode=off --accept-dns=false" ,
} ,
} ,
@ -561,11 +536,10 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "synology_permit_omit_accept_routes" ,
name : "synology_permit_omit_accept_routes" ,
flags : [ ] string { "--hostname=foo" } ,
flags : [ ] string { "--hostname=foo" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
CorpDNS : true ,
CorpDNS : true ,
AllowSingleHosts : true ,
RouteAll : true ,
RouteAll : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
goos : "linux" ,
goos : "linux" ,
distro : distro . Synology ,
distro : distro . Synology ,
@ -577,11 +551,10 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "not_synology_dont_permit_omit_accept_routes" ,
name : "not_synology_dont_permit_omit_accept_routes" ,
flags : [ ] string { "--hostname=foo" } ,
flags : [ ] string { "--hostname=foo" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
CorpDNS : true ,
CorpDNS : true ,
AllowSingleHosts : true ,
RouteAll : true ,
RouteAll : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
goos : "linux" ,
goos : "linux" ,
distro : "" , // not Synology
distro : "" , // not Synology
@ -591,11 +564,10 @@ func TestCheckForAccidentalSettingReverts(t *testing.T) {
name : "profile_name_ignored_in_up" ,
name : "profile_name_ignored_in_up" ,
flags : [ ] string { "--hostname=foo" } ,
flags : [ ] string { "--hostname=foo" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
CorpDNS : true ,
CorpDNS : true ,
AllowSingleHosts : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
ProfileName : "foo" ,
ProfileName : "foo" ,
} ,
} ,
goos : "linux" ,
goos : "linux" ,
want : "" ,
want : "" ,
@ -661,7 +633,6 @@ func TestPrefsFromUpArgs(t *testing.T) {
NoStatefulFiltering : "false" ,
NoStatefulFiltering : "false" ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
CorpDNS : true ,
CorpDNS : true ,
AllowSingleHosts : true ,
AutoUpdate : ipn . AutoUpdatePrefs {
AutoUpdate : ipn . AutoUpdatePrefs {
Check : true ,
Check : true ,
} ,
} ,
@ -675,7 +646,6 @@ func TestPrefsFromUpArgs(t *testing.T) {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
WantRunning : true ,
WantRunning : true ,
CorpDNS : true ,
CorpDNS : true ,
AllowSingleHosts : true ,
RouteAll : true ,
RouteAll : true ,
NoSNAT : false ,
NoSNAT : false ,
NoStatefulFiltering : "false" ,
NoStatefulFiltering : "false" ,
@ -689,10 +659,9 @@ func TestPrefsFromUpArgs(t *testing.T) {
name : "advertise_default_route" ,
name : "advertise_default_route" ,
args : upArgsFromOSArgs ( "linux" , "--advertise-exit-node" ) ,
args : upArgsFromOSArgs ( "linux" , "--advertise-exit-node" ) ,
want : & ipn . Prefs {
want : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
WantRunning : true ,
WantRunning : true ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
AdvertiseRoutes : [ ] netip . Prefix {
AdvertiseRoutes : [ ] netip . Prefix {
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
netip . MustParsePrefix ( "0.0.0.0/0" ) ,
netip . MustParsePrefix ( "::/0" ) ,
netip . MustParsePrefix ( "::/0" ) ,
@ -922,6 +891,9 @@ func TestPrefFlagMapping(t *testing.T) {
continue
continue
}
}
switch prefName {
switch prefName {
case "AllowSingleHosts" :
// Fake pref for downgrade compat. See #12058.
continue
case "WantRunning" , "Persist" , "LoggedOut" :
case "WantRunning" , "Persist" , "LoggedOut" :
// All explicitly handled (ignored) by checkForAccidentalSettingReverts.
// All explicitly handled (ignored) by checkForAccidentalSettingReverts.
continue
continue
@ -1029,7 +1001,6 @@ func TestUpdatePrefs(t *testing.T) {
wantJustEditMP : & ipn . MaskedPrefs {
wantJustEditMP : & ipn . MaskedPrefs {
AdvertiseRoutesSet : true ,
AdvertiseRoutesSet : true ,
AdvertiseTagsSet : true ,
AdvertiseTagsSet : true ,
AllowSingleHostsSet : true ,
AppConnectorSet : true ,
AppConnectorSet : true ,
ControlURLSet : true ,
ControlURLSet : true ,
CorpDNSSet : true ,
CorpDNSSet : true ,
@ -1062,11 +1033,10 @@ func TestUpdatePrefs(t *testing.T) {
name : "change_login_server" ,
name : "change_login_server" ,
flags : [ ] string { "--login-server=https://localhost:1000" } ,
flags : [ ] string { "--login-server=https://localhost:1000" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
env : upCheckEnv { backendState : "Running" } ,
env : upCheckEnv { backendState : "Running" } ,
wantSimpleUp : true ,
wantSimpleUp : true ,
@ -1077,11 +1047,10 @@ func TestUpdatePrefs(t *testing.T) {
name : "change_tags" ,
name : "change_tags" ,
flags : [ ] string { "--advertise-tags=tag:foo" } ,
flags : [ ] string { "--advertise-tags=tag:foo" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
env : upCheckEnv { backendState : "Running" } ,
env : upCheckEnv { backendState : "Running" } ,
} ,
} ,
@ -1090,11 +1059,10 @@ func TestUpdatePrefs(t *testing.T) {
name : "explicit_empty_operator" ,
name : "explicit_empty_operator" ,
flags : [ ] string { "--operator=" } ,
flags : [ ] string { "--operator=" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
CorpDNS : true ,
CorpDNS : true ,
AllowSingleHosts : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
OperatorUser : "somebody" ,
OperatorUser : "somebody" ,
} ,
} ,
env : upCheckEnv { user : "somebody" , backendState : "Running" } ,
env : upCheckEnv { user : "somebody" , backendState : "Running" } ,
wantJustEditMP : & ipn . MaskedPrefs {
wantJustEditMP : & ipn . MaskedPrefs {
@ -1111,11 +1079,10 @@ func TestUpdatePrefs(t *testing.T) {
name : "enable_ssh" ,
name : "enable_ssh" ,
flags : [ ] string { "--ssh" } ,
flags : [ ] string { "--ssh" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
wantJustEditMP : & ipn . MaskedPrefs {
wantJustEditMP : & ipn . MaskedPrefs {
RunSSHSet : true ,
RunSSHSet : true ,
@ -1132,12 +1099,11 @@ func TestUpdatePrefs(t *testing.T) {
name : "disable_ssh" ,
name : "disable_ssh" ,
flags : [ ] string { "--ssh=false" } ,
flags : [ ] string { "--ssh=false" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
RunSSH : true ,
RunSSH : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
wantJustEditMP : & ipn . MaskedPrefs {
wantJustEditMP : & ipn . MaskedPrefs {
RunSSHSet : true ,
RunSSHSet : true ,
@ -1157,12 +1123,11 @@ func TestUpdatePrefs(t *testing.T) {
flags : [ ] string { "--ssh=false" } ,
flags : [ ] string { "--ssh=false" } ,
sshOverTailscale : true ,
sshOverTailscale : true ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
RunSSH : true ,
RunSSH : true ,
} ,
} ,
wantJustEditMP : & ipn . MaskedPrefs {
wantJustEditMP : & ipn . MaskedPrefs {
RunSSHSet : true ,
RunSSHSet : true ,
@ -1181,11 +1146,10 @@ func TestUpdatePrefs(t *testing.T) {
flags : [ ] string { "--ssh=true" } ,
flags : [ ] string { "--ssh=true" } ,
sshOverTailscale : true ,
sshOverTailscale : true ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
wantJustEditMP : & ipn . MaskedPrefs {
wantJustEditMP : & ipn . MaskedPrefs {
RunSSHSet : true ,
RunSSHSet : true ,
@ -1204,11 +1168,10 @@ func TestUpdatePrefs(t *testing.T) {
flags : [ ] string { "--ssh=true" , "--accept-risk=lose-ssh" } ,
flags : [ ] string { "--ssh=true" , "--accept-risk=lose-ssh" } ,
sshOverTailscale : true ,
sshOverTailscale : true ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
wantJustEditMP : & ipn . MaskedPrefs {
wantJustEditMP : & ipn . MaskedPrefs {
RunSSHSet : true ,
RunSSHSet : true ,
@ -1226,12 +1189,11 @@ func TestUpdatePrefs(t *testing.T) {
flags : [ ] string { "--ssh=false" , "--accept-risk=lose-ssh" } ,
flags : [ ] string { "--ssh=false" , "--accept-risk=lose-ssh" } ,
sshOverTailscale : true ,
sshOverTailscale : true ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
Persist : & persist . Persist { UserProfile : tailcfg . UserProfile { LoginName : "crawshaw.github" } } ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
RunSSH : true ,
RunSSH : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
wantJustEditMP : & ipn . MaskedPrefs {
wantJustEditMP : & ipn . MaskedPrefs {
RunSSHSet : true ,
RunSSHSet : true ,
@ -1249,10 +1211,9 @@ func TestUpdatePrefs(t *testing.T) {
flags : [ ] string { "--force-reauth" } ,
flags : [ ] string { "--force-reauth" } ,
sshOverTailscale : true ,
sshOverTailscale : true ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
env : upCheckEnv { backendState : "Running" } ,
env : upCheckEnv { backendState : "Running" } ,
wantErrSubtr : "aborted, no changes made" ,
wantErrSubtr : "aborted, no changes made" ,
@ -1262,10 +1223,9 @@ func TestUpdatePrefs(t *testing.T) {
flags : [ ] string { "--force-reauth" , "--accept-risk=lose-ssh" } ,
flags : [ ] string { "--force-reauth" , "--accept-risk=lose-ssh" } ,
sshOverTailscale : true ,
sshOverTailscale : true ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : "https://login.tailscale.com" ,
ControlURL : "https://login.tailscale.com" ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
wantJustEditMP : nil ,
wantJustEditMP : nil ,
env : upCheckEnv { backendState : "Running" } ,
env : upCheckEnv { backendState : "Running" } ,
@ -1274,10 +1234,9 @@ func TestUpdatePrefs(t *testing.T) {
name : "advertise_connector" ,
name : "advertise_connector" ,
flags : [ ] string { "--advertise-connector" } ,
flags : [ ] string { "--advertise-connector" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
} ,
} ,
wantJustEditMP : & ipn . MaskedPrefs {
wantJustEditMP : & ipn . MaskedPrefs {
AppConnectorSet : true ,
AppConnectorSet : true ,
@ -1294,10 +1253,9 @@ func TestUpdatePrefs(t *testing.T) {
name : "no_advertise_connector" ,
name : "no_advertise_connector" ,
flags : [ ] string { "--advertise-connector=false" } ,
flags : [ ] string { "--advertise-connector=false" } ,
curPrefs : & ipn . Prefs {
curPrefs : & ipn . Prefs {
ControlURL : ipn . DefaultControlURL ,
ControlURL : ipn . DefaultControlURL ,
AllowSingleHosts : true ,
CorpDNS : true ,
CorpDNS : true ,
NetfilterMode : preftype . NetfilterOn ,
NetfilterMode : preftype . NetfilterOn ,
AppConnector : ipn . AppConnectorPrefs {
AppConnector : ipn . AppConnectorPrefs {
Advertise : true ,
Advertise : true ,
} ,
} ,