summaryrefslogtreecommitdiff
path: root/chromium/net/socket/socket_descriptor.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/net/socket/socket_descriptor.cc')
-rw-r--r--chromium/net/socket/socket_descriptor.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/chromium/net/socket/socket_descriptor.cc b/chromium/net/socket/socket_descriptor.cc
index 5a2e53cab4d..81787a29d25 100644
--- a/chromium/net/socket/socket_descriptor.cc
+++ b/chromium/net/socket/socket_descriptor.cc
@@ -12,6 +12,8 @@
#include "base/basictypes.h"
#if defined(OS_WIN)
+#include <ws2tcpip.h>
+#include "base/win/windows_version.h"
#include "net/base/winsock_init.h"
#endif
@@ -32,7 +34,18 @@ void PlatformSocketFactory::SetInstance(PlatformSocketFactory* factory) {
SocketDescriptor CreateSocketDefault(int family, int type, int protocol) {
#if defined(OS_WIN)
EnsureWinsockInit();
- return ::WSASocket(family, type, protocol, NULL, 0, WSA_FLAG_OVERLAPPED);
+ SocketDescriptor result = ::WSASocket(family, type, protocol, NULL, 0,
+ WSA_FLAG_OVERLAPPED);
+ if (result != kInvalidSocket && family == AF_INET6 &&
+ base::win::OSInfo::GetInstance()->version() >= base::win::VERSION_VISTA) {
+ DWORD value = 0;
+ if (setsockopt(result, IPPROTO_IPV6, IPV6_V6ONLY,
+ reinterpret_cast<const char*>(&value), sizeof(value))) {
+ closesocket(result);
+ return kInvalidSocket;
+ }
+ }
+ return result;
#else // OS_WIN
return ::socket(family, type, protocol);
#endif // OS_WIN