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

Side by Side Diff: webrtc/p2p/client/basicportallocator.cc

Issue 1378753003: WebRTC might leak srflx ip address when multiple_routes disabled and IceTransportType is relay (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/p2p/client/portallocator_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 ASSERT(rtc::Thread::Current() == network_thread_); 466 ASSERT(rtc::Thread::Current() == network_thread_);
467 PortData* data = FindPort(port); 467 PortData* data = FindPort(port);
468 ASSERT(data != NULL); 468 ASSERT(data != NULL);
469 // Discarding any candidate signal if port allocation status is 469 // Discarding any candidate signal if port allocation status is
470 // already in completed state. 470 // already in completed state.
471 if (data->complete()) 471 if (data->complete())
472 return; 472 return;
473 473
474 ProtocolType pvalue; 474 ProtocolType pvalue;
475 bool candidate_signalable = CheckCandidateFilter(c); 475 bool candidate_signalable = CheckCandidateFilter(c);
476
477 // When device enumeration is disabled (to prevent non-default IP addresses
478 // from leaking), we ping from some local candidates even though we don't
479 // signal them. However, if host candidates are also disabled (for example, to
480 // prevent even default IP addresses from leaking), we still don't want to
481 // ping from them, even if device enumeration is disabled. Thus, we check for
482 // both device enumeration and host candidates being disabled.
483 bool network_enumeration_disabled = c.address().IsAnyIP();
484 bool can_ping_from_candidate =
485 (port->SharedSocket() || c.protocol() == TCP_PROTOCOL_NAME);
486 bool host_canidates_disabled = !(allocator_->candidate_filter() & CF_HOST);
487
476 bool candidate_pairable = 488 bool candidate_pairable =
477 candidate_signalable || 489 candidate_signalable ||
478 (c.address().IsAnyIP() && 490 (network_enumeration_disabled && can_ping_from_candidate &&
479 (port->SharedSocket() || c.protocol() == TCP_PROTOCOL_NAME)); 491 !host_canidates_disabled);
480 bool candidate_protocol_enabled = 492 bool candidate_protocol_enabled =
481 StringToProto(c.protocol().c_str(), &pvalue) && 493 StringToProto(c.protocol().c_str(), &pvalue) &&
482 data->sequence()->ProtocolEnabled(pvalue); 494 data->sequence()->ProtocolEnabled(pvalue);
483 495
484 if (candidate_signalable && candidate_protocol_enabled) { 496 if (candidate_signalable && candidate_protocol_enabled) {
485 std::vector<Candidate> candidates; 497 std::vector<Candidate> candidates;
486 candidates.push_back(c); 498 candidates.push_back(c);
487 SignalCandidatesReady(this, candidates); 499 SignalCandidatesReady(this, candidates);
488 } 500 }
489 501
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 ServerAddresses servers; 1187 ServerAddresses servers;
1176 for (size_t i = 0; i < relays.size(); ++i) { 1188 for (size_t i = 0; i < relays.size(); ++i) {
1177 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { 1189 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) {
1178 servers.insert(relays[i].ports.front().address); 1190 servers.insert(relays[i].ports.front().address);
1179 } 1191 }
1180 } 1192 }
1181 return servers; 1193 return servers;
1182 } 1194 }
1183 1195
1184 } // namespace cricket 1196 } // namespace cricket
OLDNEW
« no previous file with comments | « no previous file | webrtc/p2p/client/portallocator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698