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

Side by Side Diff: content/renderer/p2p/ipc_network_manager.cc

Issue 990503002: Only allow temporary IPv6 address. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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. crbug.com/413437
Sergey Ulanov 2015/03/08 16:35:27 I can't access this bug. Please remove this link.
94 if (!(it->ip_address_attributes & net::IP_ADDRESS_ATTRIBUTE_TEMPORARY) ||
95 (it->ip_address_attributes & net::IP_ADDRESS_ATTRIBUTE_DEPRECATED))
96 continue;
Sergey Ulanov 2015/03/08 16:35:27 add {} please
97
91 in6_addr address; 98 in6_addr address;
92 memcpy(&address, &it->address[0], sizeof(in6_addr)); 99 memcpy(&address, &it->address[0], sizeof(in6_addr));
93 rtc::IPAddress ip6_addr(address); 100 rtc::IPAddress ip6_addr(address);
94 if (!rtc::IPIsPrivate(ip6_addr)) { 101 if (!rtc::IPIsPrivate(ip6_addr)) {
95 rtc::IPAddress prefix = 102 rtc::IPAddress prefix =
96 rtc::TruncateIP(rtc::IPAddress(ip6_addr), it->prefix_length); 103 rtc::TruncateIP(rtc::IPAddress(ip6_addr), it->prefix_length);
97 rtc::Network* network = 104 rtc::Network* network =
98 new rtc::Network(it->name, it->name, prefix, it->prefix_length, 105 new rtc::Network(it->name, it->name, prefix, it->prefix_length,
99 ConvertConnectionTypeToAdapterType(it->type)); 106 ConvertConnectionTypeToAdapterType(it->type));
100 network->AddIP(ip6_addr); 107 network->AddIP(ip6_addr);
(...skipping 30 matching lines...) Expand all
131 stats.ipv4_network_count); 138 stats.ipv4_network_count);
132 UMA_HISTOGRAM_COUNTS_100("WebRTC.PeerConnection.IPv6Interfaces", 139 UMA_HISTOGRAM_COUNTS_100("WebRTC.PeerConnection.IPv6Interfaces",
133 stats.ipv6_network_count); 140 stats.ipv6_network_count);
134 } 141 }
135 142
136 void IpcNetworkManager::SendNetworksChangedSignal() { 143 void IpcNetworkManager::SendNetworksChangedSignal() {
137 SignalNetworksChanged(); 144 SignalNetworksChanged();
138 } 145 }
139 146
140 } // namespace content 147 } // namespace content
OLDNEW
« 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