From 9936cffc1a07d201a9bde71111ba51c40629064f Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 18 Jan 2021 13:32:16 -0800 Subject: [PATCH] wgengine: correctly track all node IPs in lazy config. Signed-off-by: David Anderson --- wgengine/userspace.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wgengine/userspace.go b/wgengine/userspace.go index a3e761fb5..d76371e9e 100644 --- a/wgengine/userspace.go +++ b/wgengine/userspace.go @@ -807,11 +807,14 @@ func (e *userspaceEngine) maybeReconfigWireguardLocked(discoChanged map[key.Publ } continue } - tsIP := p.AllowedIPs[0].IP dk := discoKeyFromPeer(p) trackDisco = append(trackDisco, dk) - trackIPs = append(trackIPs, tsIP) - if e.isActiveSince(dk, tsIP, activeCutoff) { + recentlyActive := false + for _, cidr := range p.AllowedIPs { + trackIPs = append(trackIPs, cidr.IP) + recentlyActive = recentlyActive || e.isActiveSince(dk, cidr.IP, activeCutoff) + } + if recentlyActive { min.Peers = append(min.Peers, *p) if discoChanged[key.Public(p.PublicKey)] { needRemoveStep = true