1
0
mirror of https://github.com/golang/go synced 2024-11-19 14:44:40 -07:00

net: adjust the test for IPv4 loopback address block

We live in the era of virtualization and isolation.
There is no reason to hesitate to use IPv4 loopback address block for
umbrella-type customer accommodating services.

Fixes #23903

Change-Id: I990dd98e2651a993dac1b105c0bc771f8631cb93
Reviewed-on: https://go-review.googlesource.com/95336
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Mikio Hara 2018-02-20 12:57:51 +09:00
parent 2d0172c3a7
commit 9b7f221a3a

View File

@ -202,7 +202,7 @@ func validateInterfaceUnicastAddrs(ifat []Addr) (*routeStats, error) {
if 0 >= prefixLen || prefixLen > 8*IPv4len || maxPrefixLen != 8*IPv4len {
return nil, fmt.Errorf("unexpected prefix length: %d/%d for %#v", prefixLen, maxPrefixLen, ifa)
}
if ifa.IP.IsLoopback() && (prefixLen != 8 && prefixLen != 8*IPv4len) { // see RFC 1122
if ifa.IP.IsLoopback() && prefixLen < 8 { // see RFC 1122
return nil, fmt.Errorf("unexpected prefix length: %d/%d for %#v", prefixLen, maxPrefixLen, ifa)
}
stats.ipv4++