diff options
| author | Rick Hudson <rlh@golang.org> | 2016-04-27 18:19:16 -0400 |
|---|---|---|
| committer | Rick Hudson <rlh@golang.org> | 2016-04-27 18:46:52 -0400 |
| commit | 23aeb34df172b17b7bfaa85fb59ca64bef9073bb (patch) | |
| tree | a8ab866f1e50f0059856ce628f036d93ab620155 /src/net/interface_test.go | |
| parent | 1354b32cd70f2702381764fd595dd2faa996840c (diff) | |
| parent | d3c79d324acd7300b6f705e66af8ca711af00d9f (diff) | |
| download | go-23aeb34df172b17b7bfaa85fb59ca64bef9073bb.tar.xz | |
[dev.garbage] Merge remote-tracking branch 'origin/master' into HEAD
Change-Id: I282fd9ce9db435dfd35e882a9502ab1abc185297
Diffstat (limited to 'src/net/interface_test.go')
| -rw-r--r-- | src/net/interface_test.go | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/net/interface_test.go b/src/net/interface_test.go index 1487acf601..c3e1ee231f 100644 --- a/src/net/interface_test.go +++ b/src/net/interface_test.go @@ -5,6 +5,7 @@ package net import ( + "internal/testenv" "reflect" "runtime" "testing" @@ -56,6 +57,10 @@ type routeStats struct { } func TestInterfaces(t *testing.T) { + if runtime.GOOS == "freebsd" && runtime.GOARCH == "arm" { + // 100% flaky, actually, at least on some FreeBSD versions + testenv.SkipFlaky(t, 15262) + } ift, err := Interfaces() if err != nil { t.Fatal(err) @@ -178,10 +183,16 @@ func testInterfaceMulticastAddrs(t *testing.T, ifi *Interface) (nmaf4, nmaf6 int } func testAddrs(t *testing.T, ifat []Addr) (naf4, naf6 int) { + // Note: BSD variants allow assigning any IPv4/IPv6 address + // prefix to IP interface. For example, + // - 0.0.0.0/0 through 255.255.255.255/32 + // - ::/0 through ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/128 + // In other words, there is no tightly-coupled combination of + // interface address prefixes and connected routes. for _, ifa := range ifat { switch ifa := ifa.(type) { case *IPNet: - if ifa == nil || ifa.IP == nil || ifa.IP.IsUnspecified() || ifa.IP.IsMulticast() || ifa.Mask == nil { + if ifa == nil || ifa.IP == nil || ifa.IP.IsMulticast() || ifa.Mask == nil { t.Errorf("unexpected value: %#v", ifa) continue } @@ -210,11 +221,15 @@ 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()) case *IPAddr: - if ifa == nil || ifa.IP == nil || ifa.IP.IsUnspecified() || ifa.IP.IsMulticast() { + if ifa == nil || ifa.IP == nil || ifa.IP.IsMulticast() { t.Errorf("unexpected value: %#v", ifa) continue } @@ -228,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) } |
