diff options
| author | Mikio Hara <mikioh.mikioh@gmail.com> | 2016-04-14 16:31:52 +0900 |
|---|---|---|
| committer | Mikio Hara <mikioh.mikioh@gmail.com> | 2016-04-15 01:38:13 +0000 |
| commit | 19db74566491dcbb4dc2ad0a92b98aa2c28dd8fe (patch) | |
| tree | 7ab2c4d1af7d506cc604284c5608c427d62391b7 /src/net/interface_test.go | |
| parent | 77d374940e87935a2cc46a60591ec8213003e99a (diff) | |
| download | go-19db74566491dcbb4dc2ad0a92b98aa2c28dd8fe.tar.xz | |
net: relax TestInterfaces and TestInterfaceAddrs for BSD variants
Fixes #15249.
Change-Id: I91fc3d6a2df294b21a67d085da6fe661827a850e
Reviewed-on: https://go-review.googlesource.com/22079
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/net/interface_test.go')
| -rw-r--r-- | src/net/interface_test.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/net/interface_test.go b/src/net/interface_test.go index 60225506b4..e158013493 100644 --- a/src/net/interface_test.go +++ b/src/net/interface_test.go @@ -183,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 } @@ -219,7 +225,7 @@ func testAddrs(t *testing.T, ifat []Addr) (naf4, naf6 int) { } 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 } |
