From 75df96b5e5971a1c6eaef07d29f32d22e2f141cc Mon Sep 17 00:00:00 2001 From: zhangzujian Date: Tue, 23 Aug 2022 11:23:18 +0800 Subject: [PATCH] fix arping error log --- pkg/util/arping.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/util/arping.go b/pkg/util/arping.go index 6a97ce80d17..ef6c9a6c86e 100644 --- a/pkg/util/arping.go +++ b/pkg/util/arping.go @@ -42,11 +42,12 @@ func Arping(nic, srcIP, dstIP string, timeout time.Duration, maxRetry int) (net. return nil, count, fmt.Errorf("failed to set up ARP client: %v", err) } + var mac net.HardwareAddr for ; count < maxRetry; count++ { if err = client.SetDeadline(time.Now().Add(timeout)); err != nil { continue } - if mac, err := client.Resolve(target); err == nil { + if mac, err = client.Resolve(target); err == nil { return mac, count + 1, nil } }