From 2502bb8818190f24b3de90ca14cfccacb37315b5 Mon Sep 17 00:00:00 2001 From: lonord Date: Mon, 10 Sep 2018 12:31:50 +0800 Subject: [PATCH] fix bug of getting online clients --- build.sh | 2 +- client/clientutil.go | 2 +- client/clientutil_test.go | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 177ff6d..929bbe9 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -VERSION=1.2 +VERSION=1.3 cd $(dirname $0) diff --git a/client/clientutil.go b/client/clientutil.go index db43cbe..c26a8e3 100644 --- a/client/clientutil.go +++ b/client/clientutil.go @@ -14,7 +14,7 @@ type ClientInfo struct { } func ReadClients(execFn ba.CmdExecutorFn, cfg *ba.Config) ([]ClientInfo, error) { - output, err := execFn(fmt.Sprintf("arp -a -i %s", cfg.BridgeName)) + output, err := execFn(fmt.Sprintf("arp -a -H ether -i %s", cfg.BridgeName)) if err != nil { return nil, err } diff --git a/client/clientutil_test.go b/client/clientutil_test.go index 56cf854..cd74160 100644 --- a/client/clientutil_test.go +++ b/client/clientutil_test.go @@ -9,6 +9,7 @@ import ( func TestReadClients(t *testing.T) { cfg := &ba.Config{ BridgeName: "br-lan", + BridgeAddr: "192.168.4.1", } clients, err := ReadClients(func(s string) (string, error) { return arpResult, nil