Skip to content

Commit

Permalink
fix arping error log (#1841)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Aug 24, 2022
1 parent 9447b85 commit 1a3a169
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/util/arping.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 1a3a169

Please sign in to comment.