diff --git a/src/net/sockopt_bsd.go b/src/net/sockopt_bsd.go index 216e5d52f12a41..ee1f98b834cf37 100644 --- a/src/net/sockopt_bsd.go +++ b/src/net/sockopt_bsd.go @@ -26,7 +26,7 @@ func setDefaultSockopts(s, family, sotype int, ipv6only bool) error { syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_PORTRANGE, syscall.IPV6_PORTRANGE_HIGH) } } - if supportsIPv4map() && family == syscall.AF_INET6 && sotype != syscall.SOCK_RAW { + if family == syscall.AF_INET6 && sotype != syscall.SOCK_RAW && supportsIPv4map() { // Allow both IP versions even if the OS default // is otherwise. Note that some operating systems // never admit this option.