From 5ba90748f6c9d35a75a423c6cea1a8709b2586bf Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Tue, 19 Mar 2024 18:27:07 +0700 Subject: [PATCH] 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. --- internal/clientinfo/ndp_linux.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/clientinfo/ndp_linux.go b/internal/clientinfo/ndp_linux.go index cc99675..ebffe0e 100644 --- a/internal/clientinfo/ndp_linux.go +++ b/internal/clientinfo/ndp_linux.go @@ -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) } - }