| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/p2p/ipc_network_manager.h" | 5 #include "content/renderer/p2p/ipc_network_manager.h" |
| 6 #include <string> | 6 #include <string> |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 memcpy(&address, &it->address[0], sizeof(uint32)); | 81 memcpy(&address, &it->address[0], sizeof(uint32)); |
| 82 address = rtc::NetworkToHost32(address); | 82 address = rtc::NetworkToHost32(address); |
| 83 rtc::IPAddress prefix = | 83 rtc::IPAddress prefix = |
| 84 rtc::TruncateIP(rtc::IPAddress(address), it->prefix_length); | 84 rtc::TruncateIP(rtc::IPAddress(address), it->prefix_length); |
| 85 rtc::Network* network = | 85 rtc::Network* network = |
| 86 new rtc::Network(it->name, it->name, prefix, it->prefix_length, | 86 new rtc::Network(it->name, it->name, prefix, it->prefix_length, |
| 87 ConvertConnectionTypeToAdapterType(it->type)); | 87 ConvertConnectionTypeToAdapterType(it->type)); |
| 88 network->AddIP(rtc::IPAddress(address)); | 88 network->AddIP(rtc::IPAddress(address)); |
| 89 networks.push_back(network); | 89 networks.push_back(network); |
| 90 } else if (it->address.size() == net::kIPv6AddressSize) { | 90 } else if (it->address.size() == net::kIPv6AddressSize) { |
| 91 |
| 92 // Only allow temporary non-deprecated address to ensure the MAC is not |
| 93 // included in the address. |
| 94 if (!(it->ip_address_attributes & net::IP_ADDRESS_ATTRIBUTE_TEMPORARY) || |
| 95 (it->ip_address_attributes & net::IP_ADDRESS_ATTRIBUTE_DEPRECATED)) { |
| 96 continue; |
| 97 } |
| 98 |
| 91 in6_addr address; | 99 in6_addr address; |
| 92 memcpy(&address, &it->address[0], sizeof(in6_addr)); | 100 memcpy(&address, &it->address[0], sizeof(in6_addr)); |
| 93 rtc::IPAddress ip6_addr(address); | 101 rtc::IPAddress ip6_addr(address); |
| 94 if (!rtc::IPIsPrivate(ip6_addr)) { | 102 if (!rtc::IPIsPrivate(ip6_addr)) { |
| 95 rtc::IPAddress prefix = | 103 rtc::IPAddress prefix = |
| 96 rtc::TruncateIP(rtc::IPAddress(ip6_addr), it->prefix_length); | 104 rtc::TruncateIP(rtc::IPAddress(ip6_addr), it->prefix_length); |
| 97 rtc::Network* network = | 105 rtc::Network* network = |
| 98 new rtc::Network(it->name, it->name, prefix, it->prefix_length, | 106 new rtc::Network(it->name, it->name, prefix, it->prefix_length, |
| 99 ConvertConnectionTypeToAdapterType(it->type)); | 107 ConvertConnectionTypeToAdapterType(it->type)); |
| 100 network->AddIP(ip6_addr); | 108 network->AddIP(ip6_addr); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 131 stats.ipv4_network_count); | 139 stats.ipv4_network_count); |
| 132 UMA_HISTOGRAM_COUNTS_100("WebRTC.PeerConnection.IPv6Interfaces", | 140 UMA_HISTOGRAM_COUNTS_100("WebRTC.PeerConnection.IPv6Interfaces", |
| 133 stats.ipv6_network_count); | 141 stats.ipv6_network_count); |
| 134 } | 142 } |
| 135 | 143 |
| 136 void IpcNetworkManager::SendNetworksChangedSignal() { | 144 void IpcNetworkManager::SendNetworksChangedSignal() { |
| 137 SignalNetworksChanged(); | 145 SignalNetworksChanged(); |
| 138 } | 146 } |
| 139 | 147 |
| 140 } // namespace content | 148 } // namespace content |
| OLD | NEW |