OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/quic_connection.h" | 5 #include "net/quic/quic_connection.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 } | 1336 } |
1337 | 1337 |
1338 bool QuicConnection::ProcessValidatedPacket() { | 1338 bool QuicConnection::ProcessValidatedPacket() { |
1339 if (self_ip_changed_ || self_port_changed_) { | 1339 if (self_ip_changed_ || self_port_changed_) { |
1340 SendConnectionCloseWithDetails(QUIC_ERROR_MIGRATING_ADDRESS, | 1340 SendConnectionCloseWithDetails(QUIC_ERROR_MIGRATING_ADDRESS, |
1341 "Self address migration is not supported."); | 1341 "Self address migration is not supported."); |
1342 return false; | 1342 return false; |
1343 } | 1343 } |
1344 | 1344 |
1345 if (peer_ip_changed_ || peer_port_changed_) { | 1345 if (peer_ip_changed_ || peer_port_changed_) { |
| 1346 PeerAddressChangeType type = DeterminePeerAddressChangeType(); |
| 1347 if (type != NO_CHANGE && type != UNKNOWN && |
| 1348 (FLAGS_quic_disable_non_nat_address_migration && |
| 1349 type != NAT_PORT_REBINDING && type != IPV4_SUBNET_REBINDING)) { |
| 1350 SendConnectionCloseWithDetails(QUIC_ERROR_MIGRATING_ADDRESS, |
| 1351 "Invalid peer address migration."); |
| 1352 return false; |
| 1353 } |
| 1354 |
1346 IPEndPoint old_peer_address = peer_address_; | 1355 IPEndPoint old_peer_address = peer_address_; |
1347 peer_address_ = IPEndPoint( | 1356 peer_address_ = IPEndPoint( |
1348 peer_ip_changed_ ? migrating_peer_ip_ : peer_address_.address(), | 1357 peer_ip_changed_ ? migrating_peer_ip_ : peer_address_.address(), |
1349 peer_port_changed_ ? migrating_peer_port_ : peer_address_.port()); | 1358 peer_port_changed_ ? migrating_peer_port_ : peer_address_.port()); |
1350 | 1359 |
1351 DVLOG(1) << ENDPOINT << "Peer's ip:port changed from " | 1360 DVLOG(1) << ENDPOINT << "Peer's ip:port changed from " |
1352 << old_peer_address.ToString() << " to " | 1361 << old_peer_address.ToString() << " to " |
1353 << peer_address_.ToString() << ", migrating connection."; | 1362 << peer_address_.ToString() << ", migrating connection."; |
1354 | 1363 |
1355 visitor_->OnConnectionMigration(); | 1364 visitor_->OnConnectionMigration(); |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 // next packet number is the first packet which requires | 1743 // next packet number is the first packet which requires |
1735 // forward security, start using the forward-secure encrypter. | 1744 // forward security, start using the forward-secure encrypter. |
1736 if (encryption_level_ != ENCRYPTION_FORWARD_SECURE && | 1745 if (encryption_level_ != ENCRYPTION_FORWARD_SECURE && |
1737 has_forward_secure_encrypter_ && | 1746 has_forward_secure_encrypter_ && |
1738 packet.serialized_packet.packet_number >= | 1747 packet.serialized_packet.packet_number >= |
1739 first_required_forward_secure_packet_ - 1) { | 1748 first_required_forward_secure_packet_ - 1) { |
1740 SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); | 1749 SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); |
1741 } | 1750 } |
1742 } | 1751 } |
1743 | 1752 |
| 1753 PeerAddressChangeType QuicConnection::DeterminePeerAddressChangeType() { |
| 1754 return UNKNOWN; |
| 1755 } |
| 1756 |
1744 void QuicConnection::SendPing() { | 1757 void QuicConnection::SendPing() { |
1745 if (retransmission_alarm_->IsSet()) { | 1758 if (retransmission_alarm_->IsSet()) { |
1746 return; | 1759 return; |
1747 } | 1760 } |
1748 packet_generator_.AddControlFrame(QuicFrame(QuicPingFrame())); | 1761 packet_generator_.AddControlFrame(QuicFrame(QuicPingFrame())); |
1749 } | 1762 } |
1750 | 1763 |
1751 void QuicConnection::SendAck() { | 1764 void QuicConnection::SendAck() { |
1752 ack_alarm_->Cancel(); | 1765 ack_alarm_->Cancel(); |
1753 ack_queued_ = false; | 1766 ack_queued_ = false; |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2313 packet_number_of_last_sent_packet_ + packets_between_mtu_probes_ + 1; | 2326 packet_number_of_last_sent_packet_ + packets_between_mtu_probes_ + 1; |
2314 ++mtu_probe_count_; | 2327 ++mtu_probe_count_; |
2315 | 2328 |
2316 DVLOG(2) << "Sending a path MTU discovery packet #" << mtu_probe_count_; | 2329 DVLOG(2) << "Sending a path MTU discovery packet #" << mtu_probe_count_; |
2317 SendMtuDiscoveryPacket(mtu_discovery_target_); | 2330 SendMtuDiscoveryPacket(mtu_discovery_target_); |
2318 | 2331 |
2319 DCHECK(!mtu_discovery_alarm_->IsSet()); | 2332 DCHECK(!mtu_discovery_alarm_->IsSet()); |
2320 } | 2333 } |
2321 | 2334 |
2322 } // namespace net | 2335 } // namespace net |
OLD | NEW |