OLD | NEW |
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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 void TurnServerAllocation::HandleCreatePermissionRequest( | 691 void TurnServerAllocation::HandleCreatePermissionRequest( |
692 const TurnMessage* msg) { | 692 const TurnMessage* msg) { |
693 // Check mandatory attributes. | 693 // Check mandatory attributes. |
694 const StunAddressAttribute* peer_attr = | 694 const StunAddressAttribute* peer_attr = |
695 msg->GetAddress(STUN_ATTR_XOR_PEER_ADDRESS); | 695 msg->GetAddress(STUN_ATTR_XOR_PEER_ADDRESS); |
696 if (!peer_attr) { | 696 if (!peer_attr) { |
697 SendBadRequestResponse(msg); | 697 SendBadRequestResponse(msg); |
698 return; | 698 return; |
699 } | 699 } |
700 | 700 |
| 701 if (server_->reject_private_addresses_ && |
| 702 rtc::IPIsPrivate(peer_attr->GetAddress().ipaddr())) { |
| 703 SendErrorResponse(msg, STUN_ERROR_FORBIDDEN, STUN_ERROR_REASON_FORBIDDEN); |
| 704 return; |
| 705 } |
| 706 |
701 // Add this permission. | 707 // Add this permission. |
702 AddPermission(peer_attr->GetAddress().ipaddr()); | 708 AddPermission(peer_attr->GetAddress().ipaddr()); |
703 | 709 |
704 LOG_J(LS_INFO, this) << "Created permission, peer=" | 710 LOG_J(LS_INFO, this) << "Created permission, peer=" |
705 << peer_attr->GetAddress(); | 711 << peer_attr->GetAddress(); |
706 | 712 |
707 // Send a success response. | 713 // Send a success response. |
708 TurnMessage response; | 714 TurnMessage response; |
709 InitResponse(msg, &response); | 715 InitResponse(msg, &response); |
710 SendResponse(&response); | 716 SendResponse(&response); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 thread_->PostDelayed(kChannelTimeout, this, MSG_ALLOCATION_TIMEOUT); | 942 thread_->PostDelayed(kChannelTimeout, this, MSG_ALLOCATION_TIMEOUT); |
937 } | 943 } |
938 | 944 |
939 void TurnServerAllocation::Channel::OnMessage(rtc::Message* msg) { | 945 void TurnServerAllocation::Channel::OnMessage(rtc::Message* msg) { |
940 ASSERT(msg->message_id == MSG_ALLOCATION_TIMEOUT); | 946 ASSERT(msg->message_id == MSG_ALLOCATION_TIMEOUT); |
941 SignalDestroyed(this); | 947 SignalDestroyed(this); |
942 delete this; | 948 delete this; |
943 } | 949 } |
944 | 950 |
945 } // namespace cricket | 951 } // namespace cricket |
OLD | NEW |