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

Side by Side Diff: webrtc/p2p/base/turnport.cc

Issue 2440043004: Preventing TURN redirects to loopback addresses. (Closed)
Patch Set: Created 4 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/base/turnport_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 2012 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2012 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 return false; 632 return false;
633 } 633 }
634 634
635 // If protocol family of server address doesn't match with local, return. 635 // If protocol family of server address doesn't match with local, return.
636 if (!IsCompatibleAddress(address)) { 636 if (!IsCompatibleAddress(address)) {
637 LOG(LS_WARNING) << "Server IP address family does not match with " 637 LOG(LS_WARNING) << "Server IP address family does not match with "
638 << "local host address family type"; 638 << "local host address family type";
639 return false; 639 return false;
640 } 640 }
641 641
642 // Block redirects to a loopback address.
643 // See: https://bugs.chromium.org/p/chromium/issues/detail?id=649118
644 if (address.IsLoopbackIP()) {
645 LOG_J(LS_WARNING, this)
646 << "Blocking attempted redirect to loopback address.";
647 return false;
648 }
649
642 LOG_J(LS_INFO, this) << "Redirecting from TURN server [" 650 LOG_J(LS_INFO, this) << "Redirecting from TURN server ["
643 << server_address_.address.ToSensitiveString() 651 << server_address_.address.ToSensitiveString()
644 << "] to TURN server [" 652 << "] to TURN server ["
645 << address.ToSensitiveString() 653 << address.ToSensitiveString()
646 << "]"; 654 << "]";
647 server_address_ = ProtocolAddress(address, server_address_.proto, 655 server_address_ = ProtocolAddress(address, server_address_.proto,
648 server_address_.secure); 656 server_address_.secure);
649 657
650 // Insert the current address to prevent redirection pingpong. 658 // Insert the current address to prevent redirection pingpong.
651 attempted_server_addresses_.insert(server_address_.address); 659 attempted_server_addresses_.insert(server_address_.address);
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 } else { 1542 } else {
1535 state_ = STATE_UNBOUND; 1543 state_ = STATE_UNBOUND;
1536 port_->FailAndPruneConnection(ext_addr_); 1544 port_->FailAndPruneConnection(ext_addr_);
1537 } 1545 }
1538 } 1546 }
1539 void TurnEntry::OnChannelBindTimeout() { 1547 void TurnEntry::OnChannelBindTimeout() {
1540 state_ = STATE_UNBOUND; 1548 state_ = STATE_UNBOUND;
1541 port_->FailAndPruneConnection(ext_addr_); 1549 port_->FailAndPruneConnection(ext_addr_);
1542 } 1550 }
1543 } // namespace cricket 1551 } // namespace cricket
OLDNEW
« no previous file with comments | « no previous file | webrtc/p2p/base/turnport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698