aboutsummaryrefslogtreecommitdiff
path: root/src/net/platform_test.go
diff options
context:
space:
mode:
authorMikio Hara <mikioh.mikioh@gmail.com>2015-05-07 08:20:42 +0900
committerMikio Hara <mikioh.mikioh@gmail.com>2015-05-07 01:50:23 +0000
commitf963cb707ec375f36851f0a2c00a0f85474c03b6 (patch)
treec8073b8abe54ed2d49ca96db468b821b4e8ea1b7 /src/net/platform_test.go
parent76d67eaccc4aa613bb794e53abef906551cc8f55 (diff)
downloadgo-f963cb707ec375f36851f0a2c00a0f85474c03b6.tar.xz
net: don't run IP stack required tests on IP stack disabled kernels
This change doesn't work perfectly on IPv6-only kernels including CLAT enabled kernels, but works enough on IPv4-only kernels. Fixes #10721. Updates #10729. Change-Id: I7db0e572e252aa0a9f9f54c8e557955077b72e44 Reviewed-on: https://go-review.googlesource.com/9777 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/net/platform_test.go')
-rw-r--r--src/net/platform_test.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/net/platform_test.go b/src/net/platform_test.go
index eb680b8e34..b700091dc5 100644
--- a/src/net/platform_test.go
+++ b/src/net/platform_test.go
@@ -103,15 +103,26 @@ func testableListenArgs(network, address, client string) bool {
return false
}
- // Test functionality of IPv6 communication using AF_INET6
- // sockets.
+ // Test functionality of IPv4 communication using AF_INET and
+ // IPv6 communication using AF_INET6 sockets.
+ if !supportsIPv4 && ip.To4() != nil {
+ return false
+ }
if !supportsIPv6 && ip.To16() != nil && ip.To4() == nil {
return false
}
+ cip := ParseIP(client)
+ if cip != nil {
+ if !supportsIPv4 && cip.To4() != nil {
+ return false
+ }
+ if !supportsIPv6 && cip.To16() != nil && cip.To4() == nil {
+ return false
+ }
+ }
// Test functionality of IPv4 communication using AF_INET6
// sockets.
- cip := ParseIP(client)
if !supportsIPv4map && (network == "tcp" || network == "udp" || network == "ip") && wildcard {
// At this point, we prefer IPv4 when ip is nil.
// See favoriteAddrFamily for further information.