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

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, 2 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
===================================================================
--- content/renderer/p2p/ipc_network_manager.cc (revision 229244)
+++ content/renderer/p2p/ipc_network_manager.cc (working copy)
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "content/renderer/p2p/ipc_network_manager.h"
-
+#include <iostream>
#include "base/bind.h"
#include "base/sys_byteorder.h"
#include "net/base/net_util.h"
@@ -49,15 +49,28 @@
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::IPAddress ip4_addr(address);
+ int prefix_length = talk_base::CountIPMaskBits(ip4_addr);
Ronghua Wu (Left Chromium) 2013/10/21 16:49:58 Is the CountIPMaskBits (returns the number of cont
Mallinath (Gone from Chromium) 2013/10/21 16:55:46 Agree. Prefix length should be used for only ident
+ talk_base::Network* network = new talk_base::Network(
+ it->name, it->name, talk_base::TruncateIP(ip4_addr, prefix_length),
+ prefix_length);
+ network->AddIP(ip4_addr);
+ 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);
+ int prefix_length = talk_base::CountIPMaskBits(ip6_addr);
+ talk_base::Network* network = new talk_base::Network(
+ it->name, it->name, talk_base::TruncateIP(ip6_addr, prefix_length),
+ prefix_length);
+ 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