tailcfg: add missing Node.DERP check in Node.Equals

Updates tailscale/corp#549

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2020-08-10 19:45:20 -07:00
parent 4e63a4fda3
commit 1f7a7a4ffe
2 changed files with 6 additions and 0 deletions

View File

@ -628,6 +628,7 @@ func (n *Node) Equal(n2 *Node) bool {
eqCIDRs(n.Addresses, n2.Addresses) &&
eqCIDRs(n.AllowedIPs, n2.AllowedIPs) &&
eqStrings(n.Endpoints, n2.Endpoints) &&
n.DERP == n2.DERP &&
n.Hostinfo.Equal(&n2.Hostinfo) &&
n.Created.Equal(n2.Created) &&
eqTimePtr(n.LastSeen, n2.LastSeen) &&

View File

@ -315,6 +315,11 @@ func TestNodeEqual(t *testing.T) {
&Node{LastSeen: &now},
true,
},
{
&Node{DERP: "foo"},
&Node{DERP: "bar"},
false,
},
}
for i, tt := range tests {
got := tt.a.Equal(tt.b)