Skip to content

Commit 6b9872e

Browse files
committed
net: never check IPv4-on-IPv6 map support on OpenBSD
Certain operating systems may refuse to implement IPv4 addresses mapped to the IPv6 address space, and a runtime check for this support can be avoided. OpenBSD is one such OS, and others may exist as well.
1 parent 11b4aee commit 6b9872e

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 "openbsd":
52+
return false
53+
}
54+
4755
ipStackCaps.Once.Do(ipStackCaps.probe)
4856
return ipStackCaps.ipv4MappedIPv6Enabled
4957
}

0 commit comments

Comments
 (0)