OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/base/net_util.h" | 5 #include "net/base/net_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <unicode/ucnv.h> | 9 #include <unicode/ucnv.h> |
10 #include <unicode/uidna.h> | 10 #include <unicode/uidna.h> |
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 ports.insert(StringToInt(WideToASCII( | 1556 ports.insert(StringToInt(WideToASCII( |
1557 allowed_ports.substr(last, length)))); | 1557 allowed_ports.substr(last, length)))); |
1558 last = i + 1; | 1558 last = i + 1; |
1559 } | 1559 } |
1560 } | 1560 } |
1561 explicitly_allowed_ports = ports; | 1561 explicitly_allowed_ports = ports; |
1562 } | 1562 } |
1563 | 1563 |
1564 enum IPv6SupportStatus { | 1564 enum IPv6SupportStatus { |
1565 IPV6_CANNOT_CREATE_SOCKETS, | 1565 IPV6_CANNOT_CREATE_SOCKETS, |
1566 IPV6_CAN_CREATE_SOCKETS, // Deprecated: No longer used. | 1566 IPV6_CAN_CREATE_SOCKETS, |
1567 IPV6_GETIFADDRS_FAILED, | 1567 IPV6_GETIFADDRS_FAILED, |
1568 IPV6_GLOBAL_ADDRESS_MISSING, | 1568 IPV6_GLOBAL_ADDRESS_MISSING, |
1569 IPV6_GLOBAL_ADDRESS_PRESENT, | 1569 IPV6_GLOBAL_ADDRESS_PRESENT, |
1570 IPV6_INTERFACE_ARRAY_TOO_SHORT, | 1570 IPV6_INTERFACE_ARRAY_TOO_SHORT, |
1571 IPV6_SUPPORT_MAX // Bounding values for enumeration. | 1571 IPV6_SUPPORT_MAX // Bounding values for enumeration. |
1572 }; | 1572 }; |
1573 | 1573 |
1574 static void IPv6SupportResults(IPv6SupportStatus result) { | 1574 static void IPv6SupportResults(IPv6SupportStatus result) { |
1575 static bool run_once = false; | 1575 static bool run_once = false; |
1576 if (!run_once) { | 1576 if (!run_once) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 return true; | 1634 return true; |
1635 #elif defined(OS_WIN) | 1635 #elif defined(OS_WIN) |
1636 EnsureWinsockInit(); | 1636 EnsureWinsockInit(); |
1637 SOCKET test_socket = socket(AF_INET6, SOCK_STREAM, 0); | 1637 SOCKET test_socket = socket(AF_INET6, SOCK_STREAM, 0); |
1638 if (test_socket == INVALID_SOCKET) { | 1638 if (test_socket == INVALID_SOCKET) { |
1639 IPv6SupportResults(IPV6_CANNOT_CREATE_SOCKETS); | 1639 IPv6SupportResults(IPV6_CANNOT_CREATE_SOCKETS); |
1640 return false; | 1640 return false; |
1641 } | 1641 } |
1642 closesocket(test_socket); | 1642 closesocket(test_socket); |
1643 | 1643 |
| 1644 // TODO(jar): Bug 40851: The remainder of probe is not working. |
| 1645 IPv6SupportResults(IPV6_CAN_CREATE_SOCKETS); // Record status. |
| 1646 return true; // Don't disable IPv6 yet. |
| 1647 |
1644 // Check to see if any interface has a IPv6 address. | 1648 // Check to see if any interface has a IPv6 address. |
1645 // Note: The original IPv6 socket can't be used here, as WSAIoctl() will fail. | 1649 // Note: The original IPv6 socket can't be used here, as WSAIoctl() will fail. |
1646 test_socket = WSASocket(AF_INET, SOCK_DGRAM, 0, NULL, 0, 0); | 1650 test_socket = socket(AF_INET, SOCK_STREAM, 0); |
1647 DCHECK(test_socket != INVALID_SOCKET); | 1651 DCHECK(test_socket != INVALID_SOCKET); |
1648 INTERFACE_INFO interfaces[128]; | 1652 INTERFACE_INFO interfaces[128]; |
1649 DWORD bytes_written = 0; | 1653 DWORD bytes_written = 0; |
1650 int rv = WSAIoctl(test_socket, SIO_GET_INTERFACE_LIST, NULL, 0, interfaces, | 1654 int rv = WSAIoctl(test_socket, SIO_GET_INTERFACE_LIST, NULL, 0, interfaces, |
1651 sizeof(interfaces), &bytes_written, NULL, NULL); | 1655 sizeof(interfaces), &bytes_written, NULL, NULL); |
1652 closesocket(test_socket); | 1656 closesocket(test_socket); |
1653 | 1657 |
1654 if (0 != rv) { | 1658 if (0 != rv) { |
1655 if (WSAGetLastError() == WSAEFAULT) | 1659 if (WSAGetLastError() == WSAEFAULT) |
1656 IPv6SupportResults(IPV6_INTERFACE_ARRAY_TOO_SHORT); | 1660 IPv6SupportResults(IPV6_INTERFACE_ARRAY_TOO_SHORT); |
(...skipping 20 matching lines...) Expand all Loading... |
1677 | 1681 |
1678 IPv6SupportResults(IPV6_GLOBAL_ADDRESS_MISSING); | 1682 IPv6SupportResults(IPV6_GLOBAL_ADDRESS_MISSING); |
1679 return false; | 1683 return false; |
1680 #else | 1684 #else |
1681 NOTIMPLEMENTED(); | 1685 NOTIMPLEMENTED(); |
1682 return true; | 1686 return true; |
1683 #endif // defined(various platforms) | 1687 #endif // defined(various platforms) |
1684 } | 1688 } |
1685 | 1689 |
1686 } // namespace net | 1690 } // namespace net |
OLD | NEW |