| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 case ADAPTER_TYPE_VPN: | 112 case ADAPTER_TYPE_VPN: |
| 113 return "VPN"; | 113 return "VPN"; |
| 114 case ADAPTER_TYPE_LOOPBACK: | 114 case ADAPTER_TYPE_LOOPBACK: |
| 115 return "Loopback"; | 115 return "Loopback"; |
| 116 default: | 116 default: |
| 117 RTC_DCHECK(false) << "Invalid type " << type; | 117 RTC_DCHECK(false) << "Invalid type " << type; |
| 118 return std::string(); | 118 return std::string(); |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 #if !defined(__native_client__) |
| 122 bool IsIgnoredIPv6(const InterfaceAddress& ip) { | 123 bool IsIgnoredIPv6(const InterfaceAddress& ip) { |
| 123 if (ip.family() != AF_INET6) { | 124 if (ip.family() != AF_INET6) { |
| 124 return false; | 125 return false; |
| 125 } | 126 } |
| 126 | 127 |
| 127 // Link-local addresses require scope id to be bound successfully. | 128 // Link-local addresses require scope id to be bound successfully. |
| 128 // However, our IPAddress structure doesn't carry that so the | 129 // However, our IPAddress structure doesn't carry that so the |
| 129 // information is lost and causes binding failure. | 130 // information is lost and causes binding failure. |
| 130 if (IPIsLinkLocal(ip)) { | 131 if (IPIsLinkLocal(ip)) { |
| 131 return true; | 132 return true; |
| 132 } | 133 } |
| 133 | 134 |
| 134 // Any MAC based IPv6 should be avoided to prevent the MAC tracking. | 135 // Any MAC based IPv6 should be avoided to prevent the MAC tracking. |
| 135 if (IPIsMacBased(ip)) { | 136 if (IPIsMacBased(ip)) { |
| 136 return true; | 137 return true; |
| 137 } | 138 } |
| 138 | 139 |
| 139 // Ignore deprecated IPv6. | 140 // Ignore deprecated IPv6. |
| 140 if (ip.ipv6_flags() & IPV6_ADDRESS_FLAG_DEPRECATED) { | 141 if (ip.ipv6_flags() & IPV6_ADDRESS_FLAG_DEPRECATED) { |
| 141 return true; | 142 return true; |
| 142 } | 143 } |
| 143 | 144 |
| 144 return false; | 145 return false; |
| 145 } | 146 } |
| 147 #endif // !defined(__native_client__) |
| 146 | 148 |
| 147 } // namespace | 149 } // namespace |
| 148 | 150 |
| 149 // These addresses are used as the targets to find out the default local address | 151 // These addresses are used as the targets to find out the default local address |
| 150 // on a multi-homed endpoint. They are actually DNS servers. | 152 // on a multi-homed endpoint. They are actually DNS servers. |
| 151 const char kPublicIPv4Host[] = "8.8.8.8"; | 153 const char kPublicIPv4Host[] = "8.8.8.8"; |
| 152 const char kPublicIPv6Host[] = "2001:4860:4860::8888"; | 154 const char kPublicIPv6Host[] = "2001:4860:4860::8888"; |
| 153 const int kPublicPort = 53; // DNS port. | 155 const int kPublicPort = 53; // DNS port. |
| 154 | 156 |
| 155 std::string MakeNetworkKey(const std::string& name, const IPAddress& prefix, | 157 std::string MakeNetworkKey(const std::string& name, const IPAddress& prefix, |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 std::stringstream ss; | 912 std::stringstream ss; |
| 911 // Print out the first space-terminated token of the network desc, plus | 913 // Print out the first space-terminated token of the network desc, plus |
| 912 // the IP address. | 914 // the IP address. |
| 913 ss << "Net[" << description_.substr(0, description_.find(' ')) | 915 ss << "Net[" << description_.substr(0, description_.find(' ')) |
| 914 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ | 916 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ |
| 915 << ":" << AdapterTypeToString(type_) << "]"; | 917 << ":" << AdapterTypeToString(type_) << "]"; |
| 916 return ss.str(); | 918 return ss.str(); |
| 917 } | 919 } |
| 918 | 920 |
| 919 } // namespace rtc | 921 } // namespace rtc |
| OLD | NEW |