diff options
author | Michael Stapelberg <stapelberg@google.com> | 2018-11-02 11:23:54 +0100 |
---|---|---|
committer | Mikio Hara <mikioh.public.networking@gmail.com> | 2018-11-06 00:05:32 +0000 |
commit | 9fc22d29092933460fe00bdaccea179f29e9960d (patch) | |
tree | 74b30bd25c397797fd3d4baa82aecf0ef89cf7f2 /src/net/interface_linux_test.go | |
parent | 5848b6c9b854546473814c8752ee117a71bb8b54 (diff) | |
download | go-git-9fc22d29092933460fe00bdaccea179f29e9960d.tar.gz |
net: update zoneCache on cache misses to cover appearing interfaces
performance differences are in measurement noise as per benchcmp:
benchmark old ns/op new ns/op delta
BenchmarkUDP6LinkLocalUnicast-12 5012 5009 -0.06%
Fixes #28535
Change-Id: Id022e2ed089ce8388a2398e755848ec94e77e653
Reviewed-on: https://go-review.googlesource.com/c/146941
Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com>
Reviewed-by: Mikio Hara <mikioh.public.networking@gmail.com>
Diffstat (limited to 'src/net/interface_linux_test.go')
-rw-r--r-- | src/net/interface_linux_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/net/interface_linux_test.go b/src/net/interface_linux_test.go index 6959ddb3d9..0699fec636 100644 --- a/src/net/interface_linux_test.go +++ b/src/net/interface_linux_test.go @@ -35,6 +35,31 @@ func (ti *testInterface) setBroadcast(suffix int) error { return nil } +func (ti *testInterface) setLinkLocal(suffix int) error { + ti.name = fmt.Sprintf("gotest%d", suffix) + xname, err := exec.LookPath("ip") + if err != nil { + return err + } + ti.setupCmds = append(ti.setupCmds, &exec.Cmd{ + Path: xname, + Args: []string{"ip", "link", "add", ti.name, "type", "dummy"}, + }) + ti.setupCmds = append(ti.setupCmds, &exec.Cmd{ + Path: xname, + Args: []string{"ip", "address", "add", ti.local, "dev", ti.name}, + }) + ti.teardownCmds = append(ti.teardownCmds, &exec.Cmd{ + Path: xname, + Args: []string{"ip", "address", "del", ti.local, "dev", ti.name}, + }) + ti.teardownCmds = append(ti.teardownCmds, &exec.Cmd{ + Path: xname, + Args: []string{"ip", "link", "delete", ti.name, "type", "dummy"}, + }) + return nil +} + func (ti *testInterface) setPointToPoint(suffix int) error { ti.name = fmt.Sprintf("gotest%d", suffix) xname, err := exec.LookPath("ip") |