internal/clientinfo: skipping non-reachable neighbor

Otherwise, failed or stale ipv6 will be used if it appeared last in the
table, instaed of the current one.
This commit is contained in:
Cuong Manh Le
2024-03-19 18:27:07 +07:00
committed by Cuong Manh Le
parent 20f8f22bae
commit 5ba90748f6

View File

@@ -15,9 +15,12 @@ func (nd *ndpDiscover) scan() {
}
for _, n := range neighs {
// Skipping non-reachable neighbors.
if n.State&netlink.NUD_REACHABLE == 0 {
continue
}
ip := n.IP.String()
mac := n.HardwareAddr.String()
nd.saveInfo(ip, mac)
}
}