| OLD | NEW |
| 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 441 |
| 442 // If socket is shared and |stun_reflected_addr| is equal to local socket | 442 // If socket is shared and |stun_reflected_addr| is equal to local socket |
| 443 // address, or if the same address has been added by another STUN server, | 443 // address, or if the same address has been added by another STUN server, |
| 444 // then discarding the stun address. | 444 // then discarding the stun address. |
| 445 // For STUN, related address is the local socket address. | 445 // For STUN, related address is the local socket address. |
| 446 if ((!SharedSocket() || stun_reflected_addr != socket_->GetLocalAddress()) && | 446 if ((!SharedSocket() || stun_reflected_addr != socket_->GetLocalAddress()) && |
| 447 !HasCandidateWithAddress(stun_reflected_addr)) { | 447 !HasCandidateWithAddress(stun_reflected_addr)) { |
| 448 | 448 |
| 449 rtc::SocketAddress related_address = socket_->GetLocalAddress(); | 449 rtc::SocketAddress related_address = socket_->GetLocalAddress(); |
| 450 // If we can't stamp the related address correctly, empty it to avoid leak. | 450 // If we can't stamp the related address correctly, empty it to avoid leak. |
| 451 if (!MaybeSetDefaultLocalAddress(&related_address) || | 451 if (!MaybeSetDefaultLocalAddress(&related_address)) { |
| 452 !(candidate_filter() & CF_HOST)) { | |
| 453 // If candidate filter doesn't have CF_HOST specified, empty raddr to | |
| 454 // avoid local address leakage. | |
| 455 related_address = rtc::EmptySocketAddressWithFamily( | 452 related_address = rtc::EmptySocketAddressWithFamily( |
| 456 related_address.family()); | 453 related_address.family()); |
| 457 } | 454 } |
| 458 | 455 |
| 459 AddAddress(stun_reflected_addr, socket_->GetLocalAddress(), related_address, | 456 AddAddress(stun_reflected_addr, socket_->GetLocalAddress(), related_address, |
| 460 UDP_PROTOCOL_NAME, "", "", STUN_PORT_TYPE, | 457 UDP_PROTOCOL_NAME, "", "", STUN_PORT_TYPE, |
| 461 ICE_TYPE_PREFERENCE_SRFLX, 0, false); | 458 ICE_TYPE_PREFERENCE_SRFLX, 0, false); |
| 462 } | 459 } |
| 463 MaybeSetPortCompleteOrError(); | 460 MaybeSetPortCompleteOrError(); |
| 464 } | 461 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 const std::vector<Candidate>& existing_candidates = Candidates(); | 507 const std::vector<Candidate>& existing_candidates = Candidates(); |
| 511 std::vector<Candidate>::const_iterator it = existing_candidates.begin(); | 508 std::vector<Candidate>::const_iterator it = existing_candidates.begin(); |
| 512 for (; it != existing_candidates.end(); ++it) { | 509 for (; it != existing_candidates.end(); ++it) { |
| 513 if (it->address() == addr) | 510 if (it->address() == addr) |
| 514 return true; | 511 return true; |
| 515 } | 512 } |
| 516 return false; | 513 return false; |
| 517 } | 514 } |
| 518 | 515 |
| 519 } // namespace cricket | 516 } // namespace cricket |
| OLD | NEW |