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

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

Issue 30193002: Push IPv6 addresses to libjingle PortAllocator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 1 month 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
===================================================================
--- content/renderer/p2p/ipc_network_manager.cc (revision 233097)
+++ content/renderer/p2p/ipc_network_manager.cc (working copy)
@@ -46,18 +46,32 @@
if (!network_list_received_)
network_list_received_ = true;
+ // Note: 32 and 64 are the arbitrary(kind of) prefix length used to
+ // differentiate IPv4 and IPv6 addresses.
+ // talk_base::Network uses these prefix_length to compare network
+ // interfaces discovered.
std::vector<talk_base::Network*> networks;
for (net::NetworkInterfaceList::const_iterator it = list.begin();
it != list.end(); it++) {
- uint32 address;
- if (it->address.size() != net::kIPv4AddressSize)
- continue;
- memcpy(&address, &it->address[0], sizeof(uint32));
- address = talk_base::NetworkToHost32(address);
- talk_base::Network* network = new talk_base::Network(
- it->name, it->name, talk_base::IPAddress(address), 32);
- network->AddIP(talk_base::IPAddress(address));
- networks.push_back(network);
+ if (it->address.size() == net::kIPv4AddressSize) {
+ uint32 address;
+ memcpy(&address, &it->address[0], sizeof(uint32));
+ address = talk_base::NetworkToHost32(address);
+ talk_base::Network* network = new talk_base::Network(
+ it->name, it->name, talk_base::IPAddress(address), 32);
+ network->AddIP(talk_base::IPAddress(address));
+ networks.push_back(network);
+ } else if (it->address.size() == net::kIPv6AddressSize) {
+ in6_addr address;
+ memcpy(&address, &it->address[0], sizeof(in6_addr));
+ talk_base::IPAddress ip6_addr(address);
+ if (!talk_base::IPIsPrivate(ip6_addr)) {
+ talk_base::Network* network = new talk_base::Network(
+ it->name, it->name, ip6_addr, 64);
+ network->AddIP(ip6_addr);
+ networks.push_back(network);
+ }
+ }
}
bool changed = false;
« 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