diff options
author | mallinath@chromium.org <mallinath@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-07 01:53:52 +0000 |
---|---|---|
committer | mallinath@chromium.org <mallinath@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-07 01:53:52 +0000 |
commit | 316f478f0fa6373fc78a7c8bc091d99a5b7ef76b (patch) | |
tree | ace0604178628172dc500a70bc0f1b8b4f5af1d5 /content/renderer/p2p | |
parent | 0f642e8c89369b6a441f6efb0102f033779f9358 (diff) | |
download | chromium_src-316f478f0fa6373fc78a7c8bc091d99a5b7ef76b.zip chromium_src-316f478f0fa6373fc78a7c8bc091d99a5b7ef76b.tar.gz chromium_src-316f478f0fa6373fc78a7c8bc091d99a5b7ef76b.tar.bz2 |
Push IPv6 addresses to libjingle PortAllocator.
Currently we have disabled IPv6 support in libjingle, but
there is effort going on to support it. This is the one of the first step in that process.
TBR=sergeyu@chromium.org
BUG=https://code.google.com/p/webrtc/issues/detail?id=1406
Review URL: https://codereview.chromium.org/30193002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233473 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/p2p')
-rw-r--r-- | content/renderer/p2p/ipc_network_manager.cc | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/content/renderer/p2p/ipc_network_manager.cc b/content/renderer/p2p/ipc_network_manager.cc index 34a65c5..bd7923d 100644 --- a/content/renderer/p2p/ipc_network_manager.cc +++ b/content/renderer/p2p/ipc_network_manager.cc @@ -46,18 +46,32 @@ void IpcNetworkManager::OnNetworkListChanged( 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; |