Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(801)

Unified Diff: net/socket/socket_descriptor.cc

Issue 25727003: Enable IPv4 address mapped to IPv6. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/socket_descriptor.cc
===================================================================
--- net/socket/socket_descriptor.cc (revision 226214)
+++ net/socket/socket_descriptor.cc (working copy)
@@ -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 @@
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698