diff options
Diffstat (limited to 'content/renderer/p2p')
-rw-r--r-- | content/renderer/p2p/ipc_network_manager.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/content/renderer/p2p/ipc_network_manager.cc b/content/renderer/p2p/ipc_network_manager.cc index ad62327..8ccda2a 100644 --- a/content/renderer/p2p/ipc_network_manager.cc +++ b/content/renderer/p2p/ipc_network_manager.cc @@ -15,6 +15,14 @@ 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) { @@ -88,17 +96,15 @@ void IpcNetworkManager::OnNetworkListChanged( network->AddIP(rtc::IPAddress(address)); networks.push_back(network); } else if (it->address.size() == net::kIPv6AddressSize) { - - // Only allow temporary non-deprecated address to ensure the MAC is not - // included in the address. - if (!(it->ip_address_attributes & net::IP_ADDRESS_ATTRIBUTE_TEMPORARY) || + // Only allow non-deprecated IPv6 addresses which don't contain MAC. + if (IsMacBasedIPv6Address(it->address) || (it->ip_address_attributes & net::IP_ADDRESS_ATTRIBUTE_DEPRECATED)) { continue; } in6_addr address; memcpy(&address, &it->address[0], sizeof(in6_addr)); - rtc::IPAddress ip6_addr(address); + 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); |