diff options
Diffstat (limited to 'p2p')
-rw-r--r-- | p2p/base/portallocator.h | 4 | ||||
-rw-r--r-- | p2p/client/basicportallocator.cc | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/p2p/base/portallocator.h b/p2p/base/portallocator.h index f8e813f502..1081448918 100644 --- a/p2p/base/portallocator.h +++ b/p2p/base/portallocator.h @@ -87,6 +87,10 @@ enum { // the application to work in a wider variety of environments, at the expense // of having to allocate additional candidates. PORTALLOCATOR_ENABLE_ANY_ADDRESS_PORTS = 0x8000, + + // Exclude link-local network interfaces + // from considertaion after adapter enumeration. + PORTALLOCATOR_DISABLE_LINK_LOCAL_NETWORKS = 0x10000, }; // Defines various reasons that have caused ICE regathering. diff --git a/p2p/client/basicportallocator.cc b/p2p/client/basicportallocator.cc index 339e007766..86cec8fb34 100644 --- a/p2p/client/basicportallocator.cc +++ b/p2p/client/basicportallocator.cc @@ -633,6 +633,14 @@ std::vector<rtc::Network*> BasicPortAllocatorSession::GetNetworks() { network_manager->GetAnyAddressNetworks(&networks); } } + // Filter out link-local networks if needed. + if (flags() & PORTALLOCATOR_DISABLE_LINK_LOCAL_NETWORKS) { + networks.erase(std::remove_if(networks.begin(), networks.end(), + [](rtc::Network* network) { + return IPIsLinkLocal(network->prefix()); + }), + networks.end()); + } // Do some more filtering, depending on the network ignore mask and "disable // costly networks" flag. networks.erase(std::remove_if(networks.begin(), networks.end(), |