diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-11-16 19:28:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-16 19:28:52 -0500 |
commit | 0135904f7d3e1c0e763adaefe267c736616e3d26 (patch) | |
tree | c27be7588f98eaea62e0bd0c0087f2b348da9738 /vendor/golang.org/x/net/internal/nettest/helper_bsd.go | |
parent | 0b296dd8c2aefefe89787be5cc627d44cf431150 (diff) | |
download | chat-0135904f7d3e1c0e763adaefe267c736616e3d26.tar.gz chat-0135904f7d3e1c0e763adaefe267c736616e3d26.tar.bz2 chat-0135904f7d3e1c0e763adaefe267c736616e3d26.zip |
Upgrading server dependancies (#4566)
Diffstat (limited to 'vendor/golang.org/x/net/internal/nettest/helper_bsd.go')
-rw-r--r-- | vendor/golang.org/x/net/internal/nettest/helper_bsd.go | 45 |
1 files changed, 25 insertions, 20 deletions
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 +} |