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

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

Issue 2086203004: Allow receiving a packet on a TURN port from an unknown address. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing memory leak found by ASan bot. Created 4 years, 6 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 | « webrtc/p2p/base/testturnserver.h ('k') | 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 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 } 824 }
825 825
826 const StunByteStringAttribute* data_attr = 826 const StunByteStringAttribute* data_attr =
827 msg.GetByteString(STUN_ATTR_DATA); 827 msg.GetByteString(STUN_ATTR_DATA);
828 if (!data_attr) { 828 if (!data_attr) {
829 LOG_J(LS_WARNING, this) << "Missing STUN_ATTR_DATA attribute in " 829 LOG_J(LS_WARNING, this) << "Missing STUN_ATTR_DATA attribute in "
830 << "data indication."; 830 << "data indication.";
831 return; 831 return;
832 } 832 }
833 833
834 // Verify that the data came from somewhere we think we have a permission for. 834 // Log a warning if the data didn't come from an address that we think we have
835 // a permission for.
835 rtc::SocketAddress ext_addr(addr_attr->GetAddress()); 836 rtc::SocketAddress ext_addr(addr_attr->GetAddress());
836 if (!HasPermission(ext_addr.ipaddr())) { 837 if (!HasPermission(ext_addr.ipaddr())) {
837 LOG_J(LS_WARNING, this) << "Received TURN data indication with invalid " 838 LOG_J(LS_WARNING, this)
838 << "peer address, addr=" 839 << "Received TURN data indication with unknown "
839 << ext_addr.ToSensitiveString(); 840 << "peer address, addr=" << ext_addr.ToSensitiveString();
840 return;
841 } 841 }
842 842
843 DispatchPacket(data_attr->bytes(), data_attr->length(), ext_addr, 843 DispatchPacket(data_attr->bytes(), data_attr->length(), ext_addr,
844 PROTO_UDP, packet_time); 844 PROTO_UDP, packet_time);
845 } 845 }
846 846
847 void TurnPort::HandleChannelData(int channel_id, const char* data, 847 void TurnPort::HandleChannelData(int channel_id, const char* data,
848 size_t size, 848 size_t size,
849 const rtc::PacketTime& packet_time) { 849 const rtc::PacketTime& packet_time) {
850 // Read the message, and process according to RFC5766, Section 11.6. 850 // Read the message, and process according to RFC5766, Section 11.6.
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 } else { 1533 } else {
1534 state_ = STATE_UNBOUND; 1534 state_ = STATE_UNBOUND;
1535 port_->FailAndPruneConnection(ext_addr_); 1535 port_->FailAndPruneConnection(ext_addr_);
1536 } 1536 }
1537 } 1537 }
1538 void TurnEntry::OnChannelBindTimeout() { 1538 void TurnEntry::OnChannelBindTimeout() {
1539 state_ = STATE_UNBOUND; 1539 state_ = STATE_UNBOUND;
1540 port_->FailAndPruneConnection(ext_addr_); 1540 port_->FailAndPruneConnection(ext_addr_);
1541 } 1541 }
1542 } // namespace cricket 1542 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/testturnserver.h ('k') | webrtc/p2p/base/turnport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698