summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/net/internal
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/net/internal')
-rw-r--r--vendor/golang.org/x/net/internal/iana/gen.go2
-rw-r--r--vendor/golang.org/x/net/internal/nettest/helper_bsd.go45
-rw-r--r--vendor/golang.org/x/net/internal/nettest/helper_nobsd.go4
-rw-r--r--vendor/golang.org/x/net/internal/nettest/helper_stub.go4
-rw-r--r--vendor/golang.org/x/net/internal/nettest/helper_windows.go4
-rw-r--r--vendor/golang.org/x/net/internal/nettest/interface.go2
-rw-r--r--vendor/golang.org/x/net/internal/nettest/stack.go3
7 files changed, 42 insertions, 22 deletions
diff --git a/vendor/golang.org/x/net/internal/iana/gen.go b/vendor/golang.org/x/net/internal/iana/gen.go
index 2d8c07ca1..86c78b3bb 100644
--- a/vendor/golang.org/x/net/internal/iana/gen.go
+++ b/vendor/golang.org/x/net/internal/iana/gen.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
diff --git a/vendor/golang.org/x/net/internal/nettest/helper_bsd.go b/vendor/golang.org/x/net/internal/nettest/helper_bsd.go
index b2308a0e8..a6e433b58 100644
--- a/vendor/golang.org/x/net/internal/nettest/helper_bsd.go
+++ b/vendor/golang.org/x/net/internal/nettest/helper_bsd.go
@@ -13,6 +13,23 @@ import (
"syscall"
)
+var darwinVersion int
+
+func init() {
+ if runtime.GOOS == "darwin" {
+ // See http://support.apple.com/kb/HT1633.
+ s, err := syscall.Sysctl("kern.osrelease")
+ if err != nil {
+ return
+ }
+ ss := strings.Split(s, ".")
+ if len(ss) == 0 {
+ return
+ }
+ darwinVersion, _ = strconv.Atoi(ss[0])
+ }
+}
+
func supportsIPv6MulticastDeliveryOnLoopback() bool {
switch runtime.GOOS {
case "freebsd":
@@ -22,27 +39,15 @@ func supportsIPv6MulticastDeliveryOnLoopback() bool {
// packets correctly.
return false
case "darwin":
- // See http://support.apple.com/kb/HT1633.
- s, err := syscall.Sysctl("kern.osrelease")
- if err != nil {
- return false
- }
- ss := strings.Split(s, ".")
- if len(ss) == 0 {
- return false
- }
- // OS X 10.9 (Darwin 13) or above seems to do the
- // right thing; preserving the packet header as it's
- // needed for the checksum calcuration with pseudo
- // header on loopback multicast delivery process.
- // If not, you'll probably see what is the slow-acting
- // kernel crash caused by lazy mbuf corruption.
- // See ip6_mloopback in netinet6/ip6_output.c.
- if mjver, err := strconv.Atoi(ss[0]); err != nil || mjver < 13 {
- return false
- }
- return true
+ return !causesIPv6Crash()
default:
return true
}
}
+
+func causesIPv6Crash() bool {
+ // We see some kernel crash when running IPv6 with IP-level
+ // options on Darwin kernel version 12 or below.
+ // See golang.org/issues/17015.
+ return darwinVersion < 13
+}
diff --git a/vendor/golang.org/x/net/internal/nettest/helper_nobsd.go b/vendor/golang.org/x/net/internal/nettest/helper_nobsd.go
index a42b80709..bc7da5e0d 100644
--- a/vendor/golang.org/x/net/internal/nettest/helper_nobsd.go
+++ b/vendor/golang.org/x/net/internal/nettest/helper_nobsd.go
@@ -9,3 +9,7 @@ package nettest
func supportsIPv6MulticastDeliveryOnLoopback() bool {
return true
}
+
+func causesIPv6Crash() bool {
+ return false
+}
diff --git a/vendor/golang.org/x/net/internal/nettest/helper_stub.go b/vendor/golang.org/x/net/internal/nettest/helper_stub.go
index 22d493585..ea61b6f39 100644
--- a/vendor/golang.org/x/net/internal/nettest/helper_stub.go
+++ b/vendor/golang.org/x/net/internal/nettest/helper_stub.go
@@ -23,6 +23,10 @@ func supportsIPv6MulticastDeliveryOnLoopback() bool {
return false
}
+func causesIPv6Crash() bool {
+ return false
+}
+
func protocolNotSupported(err error) bool {
return false
}
diff --git a/vendor/golang.org/x/net/internal/nettest/helper_windows.go b/vendor/golang.org/x/net/internal/nettest/helper_windows.go
index b0a6a30c4..3dcb727c9 100644
--- a/vendor/golang.org/x/net/internal/nettest/helper_windows.go
+++ b/vendor/golang.org/x/net/internal/nettest/helper_windows.go
@@ -36,3 +36,7 @@ func supportsRawIPSocket() (string, bool) {
func supportsIPv6MulticastDeliveryOnLoopback() bool {
return true
}
+
+func causesIPv6Crash() bool {
+ return false
+}
diff --git a/vendor/golang.org/x/net/internal/nettest/interface.go b/vendor/golang.org/x/net/internal/nettest/interface.go
index 53ae13a98..8e6333afe 100644
--- a/vendor/golang.org/x/net/internal/nettest/interface.go
+++ b/vendor/golang.org/x/net/internal/nettest/interface.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
diff --git a/vendor/golang.org/x/net/internal/nettest/stack.go b/vendor/golang.org/x/net/internal/nettest/stack.go
index 86de2773d..5ab95305d 100644
--- a/vendor/golang.org/x/net/internal/nettest/stack.go
+++ b/vendor/golang.org/x/net/internal/nettest/stack.go
@@ -21,6 +21,9 @@ func SupportsIPv4() bool {
// SupportsIPv6 reports whether the platform supports IPv6 networking
// functionality.
func SupportsIPv6() bool {
+ if causesIPv6Crash() {
+ return false
+ }
ln, err := net.Listen("tcp6", "[::1]:0")
if err != nil {
return false