Skip to content

Commit 7eb6718

Browse files
committed
net: never probe IPv4 map support on DragonFly BSD, OpenBSD
DragonFly BSD and OpenBSD do not implement mapping IPv4 addresses to the IPv6 address space, and a runtime check can be avoided. As the IP stack capabilities probe was only being called from supportsIPv4map to check for this support, the OS-specific handling can be added to this function rather than continuing to run the probe.
1 parent 11b4aee commit 7eb6718

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/net/ipsock.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package net
77
import (
88
"context"
99
"internal/bytealg"
10+
"runtime"
1011
"sync"
1112
)
1213

@@ -44,6 +45,13 @@ func supportsIPv6() bool {
4445
// IPv4 address inside an IPv6 address at transport layer
4546
// protocols. See RFC 4291, RFC 4038 and RFC 3493.
4647
func supportsIPv4map() bool {
48+
// Some operating systems provide no support for mapping IPv4
49+
// addresses to IPv6, and a runtime check is unnecessary.
50+
switch runtime.GOOS {
51+
case "dragonfly", "openbsd":
52+
return false
53+
}
54+
4755
ipStackCaps.Once.Do(ipStackCaps.probe)
4856
return ipStackCaps.ipv4MappedIPv6Enabled
4957
}

0 commit comments

Comments
 (0)