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

Unified Diff: content/renderer/p2p/ipc_network_manager.cc

Issue 1026813003: Clean up - Use webrtc IPIsMacBased. (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 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: content/renderer/p2p/ipc_network_manager.cc
diff --git a/content/renderer/p2p/ipc_network_manager.cc b/content/renderer/p2p/ipc_network_manager.cc
index 8ccda2aef2bd43fbbf156d64f3da0f0afc116b6c..e279f9830f9696dfde53e711f20f279de7dfd9c0 100644
--- a/content/renderer/p2p/ipc_network_manager.cc
+++ b/content/renderer/p2p/ipc_network_manager.cc
@@ -15,14 +15,6 @@ namespace content {
namespace {
-// According to http://www.ietf.org/rfc/rfc2373.txt, Appendix A, page 19. An
-// address which contains MAC will have its 11th and 12th bytes as FF:FE as well
-// as the U/L bit as 1.
-bool IsMacBasedIPv6Address(const net::IPAddressNumber& ipaddress) {
- return ((ipaddress[8] & 0x02) && ipaddress[11] == 0xFF &&
- ipaddress[12] == 0xFE);
-}
-
rtc::AdapterType ConvertConnectionTypeToAdapterType(
net::NetworkChangeNotifier::ConnectionType type) {
switch (type) {
@@ -96,15 +88,16 @@ void IpcNetworkManager::OnNetworkListChanged(
network->AddIP(rtc::IPAddress(address));
networks.push_back(network);
} else if (it->address.size() == net::kIPv6AddressSize) {
+ in6_addr address;
+ memcpy(&address, &it->address[0], sizeof(in6_addr));
+ rtc::InterfaceAddress ip6_addr(address, it->ip_address_attributes);
+
// Only allow non-deprecated IPv6 addresses which don't contain MAC.
- if (IsMacBasedIPv6Address(it->address) ||
+ if (rtc::IPIsMacBased(ip6_addr) ||
(it->ip_address_attributes & net::IP_ADDRESS_ATTRIBUTE_DEPRECATED)) {
continue;
}
- in6_addr address;
- memcpy(&address, &it->address[0], sizeof(in6_addr));
- rtc::InterfaceAddress ip6_addr(address, it->ip_address_attributes);
if (!rtc::IPIsPrivate(ip6_addr)) {
rtc::IPAddress prefix =
rtc::TruncateIP(rtc::IPAddress(ip6_addr), it->prefix_length);
« 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