Browse Source

Check for the right arp command for the platform

Douglas Thrift 1 year ago
parent
commit
1fb524e8a9
3 changed files with 6 additions and 1 deletions
  1. 1 1
      neighbors/arp.go
  2. 1 0
      neighbors/arp_freebsd.go
  3. 4 0
      neighbors/arp_linux.go

+ 1 - 1
neighbors/arp.go

@@ -24,7 +24,7 @@ type (
 )
 
 func NewARP(count uint) (ARP, error) {
-	cmd, err := exec.LookPath("ip")
+	cmd, err := exec.LookPath(arpCmd)
 	if err != nil {
 		return nil, err
 	}

+ 1 - 0
neighbors/arp_freebsd.go

@@ -10,6 +10,7 @@ import (
 )
 
 const (
+	arpCmd           = "arp"
 	arpOutputVersion = "1"
 )
 

+ 4 - 0
neighbors/arp_linux.go

@@ -8,6 +8,10 @@ import (
 	"goa.design/clue/log"
 )
 
+const (
+	arpCmd = "ip"
+)
+
 type (
 	arpEntry struct {
 		IPAddress  string `json:"dst"`