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

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

Issue 1218293016: Tighten link-local IPv6 routing exclusion check (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Test more cases Created 5 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 | « no previous file | webrtc/p2p/base/port_unittest.cc » ('j') | webrtc/p2p/base/port_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 return true; 465 return true;
466 } 466 }
467 467
468 bool Port::IsCompatibleAddress(const rtc::SocketAddress& addr) { 468 bool Port::IsCompatibleAddress(const rtc::SocketAddress& addr) {
469 int family = ip().family(); 469 int family = ip().family();
470 // We use single-stack sockets, so families must match. 470 // We use single-stack sockets, so families must match.
471 if (addr.family() != family) { 471 if (addr.family() != family) {
472 return false; 472 return false;
473 } 473 }
474 // Link-local IPv6 ports can only connect to other link-local IPv6 ports. 474 // Link-local IPv6 ports can only connect to other link-local IPv6 ports.
475 if (family == AF_INET6 && (IPIsPrivate(ip()) != IPIsPrivate(addr.ipaddr()))) { 475 if (family == AF_INET6 &&
476 (IPIsLinkLocal(ip()) != IPIsLinkLocal(addr.ipaddr()))) {
476 return false; 477 return false;
477 } 478 }
478 return true; 479 return true;
479 } 480 }
480 481
481 bool Port::ParseStunUsername(const StunMessage* stun_msg, 482 bool Port::ParseStunUsername(const StunMessage* stun_msg,
482 std::string* local_ufrag, 483 std::string* local_ufrag,
483 std::string* remote_ufrag, 484 std::string* remote_ufrag,
484 IceProtocolType* remote_protocol_type) const { 485 IceProtocolType* remote_protocol_type) const {
485 // The packet must include a username that either begins or ends with our 486 // The packet must include a username that either begins or ends with our
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 ASSERT(sent < 0); 1552 ASSERT(sent < 0);
1552 error_ = port_->GetError(); 1553 error_ = port_->GetError();
1553 sent_packets_discarded_++; 1554 sent_packets_discarded_++;
1554 } else { 1555 } else {
1555 send_rate_tracker_.Update(sent); 1556 send_rate_tracker_.Update(sent);
1556 } 1557 }
1557 return sent; 1558 return sent;
1558 } 1559 }
1559 1560
1560 } // namespace cricket 1561 } // namespace cricket
OLDNEW
« no previous file with comments | « no previous file | webrtc/p2p/base/port_unittest.cc » ('j') | webrtc/p2p/base/port_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698