diff options
| author | Mikio Hara <mikioh.mikioh@gmail.com> | 2016-02-28 09:37:36 +0900 |
|---|---|---|
| committer | Mikio Hara <mikioh.mikioh@gmail.com> | 2016-04-19 09:21:57 +0000 |
| commit | 3e9264c9ae781a2cd28127deaed6ae26f84b4b15 (patch) | |
| tree | e2d77506edc2f09cca005720252afe6cce4838e9 /src/net/interface_test.go | |
| parent | 45bb8874314635fc40945da3f765a7844482bfef (diff) | |
| download | go-3e9264c9ae781a2cd28127deaed6ae26f84b4b15.tar.xz | |
net: add support for Zone of IPNet
This change adds Zone field to IPNet structure for making it possible to
determine which network interface is associated with IPv6 link-local
address. Also makes ParseCIDR and IPNet.String capable handling literal
IPv6 address prefixes with zone identifier.
Fixes #14518.
Change-Id: I8f8a40d3b4f500ffef25728d4995651379d8408a
Reviewed-on: https://go-review.googlesource.com/19946
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/net/interface_test.go')
| -rw-r--r-- | src/net/interface_test.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/net/interface_test.go b/src/net/interface_test.go index e158013493..c3e1ee231f 100644 --- a/src/net/interface_test.go +++ b/src/net/interface_test.go @@ -221,6 +221,10 @@ func testAddrs(t *testing.T, ifat []Addr) (naf4, naf6 int) { t.Errorf("unexpected prefix length for IPv6 loopback: %d/%d", prefixLen, maxPrefixLen) continue } + if ifa.IP.IsLinkLocalUnicast() && ifa.Zone == "" { + t.Errorf("no IPv6 zone identifier found: %#v", ifa) + continue + } naf6++ } t.Logf("interface address %q", ifa.String()) @@ -239,7 +243,7 @@ func testAddrs(t *testing.T, ifat []Addr) (naf4, naf6 int) { if ifa.IP.To16() != nil && ifa.IP.To4() == nil { naf6++ } - t.Logf("interface address %s", ifa.String()) + t.Logf("interface address %q", ifa.String()) default: t.Errorf("unexpected type: %T", ifa) } |
