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

Side by Side Diff: webrtc/p2p/base/turnserver.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, 5 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/turnserver.h ('k') | no next file » | 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 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 const rtc::PacketTime& packet_time) { 794 const rtc::PacketTime& packet_time) {
795 ASSERT(external_socket_.get() == socket); 795 ASSERT(external_socket_.get() == socket);
796 Channel* channel = FindChannel(addr); 796 Channel* channel = FindChannel(addr);
797 if (channel) { 797 if (channel) {
798 // There is a channel bound to this address. Send as a channel message. 798 // There is a channel bound to this address. Send as a channel message.
799 rtc::ByteBufferWriter buf; 799 rtc::ByteBufferWriter buf;
800 buf.WriteUInt16(channel->id()); 800 buf.WriteUInt16(channel->id());
801 buf.WriteUInt16(static_cast<uint16_t>(size)); 801 buf.WriteUInt16(static_cast<uint16_t>(size));
802 buf.WriteBytes(data, size); 802 buf.WriteBytes(data, size);
803 server_->Send(&conn_, buf); 803 server_->Send(&conn_, buf);
804 } else if (HasPermission(addr.ipaddr())) { 804 } else if (!server_->enable_permission_checks_ ||
805 HasPermission(addr.ipaddr())) {
805 // No channel, but a permission exists. Send as a data indication. 806 // No channel, but a permission exists. Send as a data indication.
806 TurnMessage msg; 807 TurnMessage msg;
807 msg.SetType(TURN_DATA_INDICATION); 808 msg.SetType(TURN_DATA_INDICATION);
808 msg.SetTransactionID( 809 msg.SetTransactionID(
809 rtc::CreateRandomString(kStunTransactionIdLength)); 810 rtc::CreateRandomString(kStunTransactionIdLength));
810 VERIFY(msg.AddAttribute(new StunXorAddressAttribute( 811 VERIFY(msg.AddAttribute(new StunXorAddressAttribute(
811 STUN_ATTR_XOR_PEER_ADDRESS, addr))); 812 STUN_ATTR_XOR_PEER_ADDRESS, addr)));
812 VERIFY(msg.AddAttribute(new StunByteStringAttribute( 813 VERIFY(msg.AddAttribute(new StunByteStringAttribute(
813 STUN_ATTR_DATA, data, size))); 814 STUN_ATTR_DATA, data, size)));
814 server_->SendStun(&conn_, &msg); 815 server_->SendStun(&conn_, &msg);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 MSG_ALLOCATION_TIMEOUT); 953 MSG_ALLOCATION_TIMEOUT);
953 } 954 }
954 955
955 void TurnServerAllocation::Channel::OnMessage(rtc::Message* msg) { 956 void TurnServerAllocation::Channel::OnMessage(rtc::Message* msg) {
956 ASSERT(msg->message_id == MSG_ALLOCATION_TIMEOUT); 957 ASSERT(msg->message_id == MSG_ALLOCATION_TIMEOUT);
957 SignalDestroyed(this); 958 SignalDestroyed(this);
958 delete this; 959 delete this;
959 } 960 }
960 961
961 } // namespace cricket 962 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/turnserver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698