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

Unified Diff: webrtc/p2p/client/basicportallocator.cc

Issue 1411253008: WebRTC should generate default private address even when adapter enumeration is disabled. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: after rebase on master Created 5 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 | « webrtc/p2p/base/stunport.cc ('k') | webrtc/p2p/client/portallocator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/client/basicportallocator.cc
diff --git a/webrtc/p2p/client/basicportallocator.cc b/webrtc/p2p/client/basicportallocator.cc
index 21c8921f4024c51b3679471595a97dae199c1625..865fbbb4c0f33efa736ba5d6cdfef6dc816c4f90 100644
--- a/webrtc/p2p/client/basicportallocator.cc
+++ b/webrtc/p2p/client/basicportallocator.cc
@@ -436,7 +436,8 @@ void BasicPortAllocatorSession::AddAllocatedPort(Port* port,
// When adapter enumeration is disabled, disable CF_HOST at port level so
// local address is not leaked by stunport in the candidate's related address.
- if (flags() & PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION) {
+ if ((flags() & PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION) &&
+ (flags() & PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE)) {
candidate_filter &= ~CF_HOST;
}
port->set_candidate_filter(candidate_filter);
@@ -600,25 +601,6 @@ bool BasicPortAllocatorSession::CheckCandidateFilter(const Candidate& c) {
return true;
}
- // If PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE is specified and it's
- // loopback address, we should allow it as it's for demo page connectivity
- // when no TURN/STUN specified.
- if (c.address().IsLoopbackIP() &&
- (flags() & PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE) != 0) {
- return true;
- }
-
- // This is just to prevent the case when binding to any address (all 0s), if
- // somehow the host candidate address is not all 0s. Either because local
- // installed proxy changes the address or a packet has been sent for any
- // reason before getsockname is called.
- if (flags() & PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION) {
- LOG(LS_WARNING) << "Received non-0 host address: "
- << c.address().ToString()
- << " when adapter enumeration is disabled";
- return false;
- }
-
return ((filter & CF_HOST) != 0);
}
return false;
@@ -882,19 +864,19 @@ void AllocationSequence::CreateUDPPorts() {
// TODO(mallinath) - Remove UDPPort creating socket after shared socket
// is enabled completely.
UDPPort* port = NULL;
- bool emit_localhost_for_anyaddress =
- IsFlagSet(PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE);
+ bool emit_local_candidate_for_anyaddress =
+ !IsFlagSet(PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE);
if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET) && udp_socket_) {
port = UDPPort::Create(
session_->network_thread(), session_->socket_factory(), network_,
udp_socket_.get(), session_->username(), session_->password(),
- session_->allocator()->origin(), emit_localhost_for_anyaddress);
+ session_->allocator()->origin(), emit_local_candidate_for_anyaddress);
} else {
port = UDPPort::Create(
session_->network_thread(), session_->socket_factory(), network_, ip_,
session_->allocator()->min_port(), session_->allocator()->max_port(),
session_->username(), session_->password(),
- session_->allocator()->origin(), emit_localhost_for_anyaddress);
+ session_->allocator()->origin(), emit_local_candidate_for_anyaddress);
}
if (port) {
« no previous file with comments | « webrtc/p2p/base/stunport.cc ('k') | webrtc/p2p/client/portallocator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698