diff --git a/ipn/prefs.go b/ipn/prefs.go index 12babdd69..6da71bfaa 100644 --- a/ipn/prefs.go +++ b/ipn/prefs.go @@ -10,6 +10,7 @@ import ( "fmt" "io/ioutil" "log" + "net" "os" "path/filepath" @@ -24,6 +25,7 @@ type Prefs struct { WantRunning bool NotepadURLs bool UsePacketFilter bool + AdvertiseRoutes []*net.IPNet // The Persist field is named 'Config' in the file for backward // compatibility with earlier versions. @@ -34,7 +36,7 @@ type Prefs struct { } // IsEmpty reports whether p is nil or pointing to a Prefs zero value. -func (uc *Prefs) IsEmpty() bool { return uc == nil || *uc == Prefs{} } +func (uc *Prefs) IsEmpty() bool { return uc == nil || uc.Equals(&Prefs{}) } func (uc *Prefs) Pretty() string { var ucp string @@ -43,9 +45,9 @@ func (uc *Prefs) Pretty() string { } else { ucp = "Persist=nil" } - return fmt.Sprintf("Prefs{ra=%v mesh=%v dns=%v want=%v notepad=%v pf=%v %v}", + return fmt.Sprintf("Prefs{ra=%v mesh=%v dns=%v want=%v notepad=%v pf=%v routes=%v %v}", uc.RouteAll, uc.AllowSingleHosts, uc.CorpDNS, uc.WantRunning, - uc.NotepadURLs, uc.UsePacketFilter, ucp) + uc.NotepadURLs, uc.UsePacketFilter, uc.AdvertiseRoutes, ucp) } func (uc *Prefs) ToBytes() []byte { diff --git a/ipn/prefs_test.go b/ipn/prefs_test.go index 467ba0960..95e5cca6c 100644 --- a/ipn/prefs_test.go +++ b/ipn/prefs_test.go @@ -29,7 +29,7 @@ func checkPrefs(t *testing.T, p Prefs) { } p2 = p p2.RouteAll = true - if p == p2 { + if p.Equals(&p2) { t.Fatalf("p == p2\n") } p2b, err = PrefsFromBytes(p2.ToBytes(), false)