This is an automated email from the ASF dual-hosted git repository. maskit pushed a commit to branch quic-latest in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/quic-latest by this push: new 5fa5698 Send PATH_CHALLENGE when receives a packet with an alternative CID 5fa5698 is described below commit 5fa569877e56cdddb0bae36effd61140b3218809 Author: Masakazu Kitajo <mas...@apache.org> AuthorDate: Mon Apr 9 17:02:57 2018 +0900 Send PATH_CHALLENGE when receives a packet with an alternative CID --- iocore/net/P_QUICNetVConnection.h | 5 +++ iocore/net/QUICNetVConnection.cc | 42 ++++++++++++++++++++++++++ iocore/net/quic/QUICEvents.h | 1 + iocore/net/quic/QUICPathValidator.cc | 1 + iocore/net/quic/test/test_QUICPacketFactory.cc | 3 +- 5 files changed, 51 insertions(+), 1 deletion(-) diff --git a/iocore/net/P_QUICNetVConnection.h b/iocore/net/P_QUICNetVConnection.h index a0077b1..9d8523a 100644 --- a/iocore/net/P_QUICNetVConnection.h +++ b/iocore/net/P_QUICNetVConnection.h @@ -276,6 +276,11 @@ private: void _close_closed_event(Event *data); Event *_closed_event = nullptr; + void _schedule_path_validation_timeout(ink_hrtime interval); + void _unschedule_path_validation_timeout(); + void _close_path_validation_timeout(Event *data); + Event *_path_validation_timeout = nullptr; + uint32_t _maximum_stream_frame_data_size(); uint32_t _transmit_packet(QUICPacketUPtr packet); void _store_frame(ats_unique_buf &buf, size_t &len, bool &retransmittable, QUICPacketType ¤t_packet_type, diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc index 4ad106c..8c19e6c 100644 --- a/iocore/net/QUICNetVConnection.cc +++ b/iocore/net/QUICNetVConnection.cc @@ -590,6 +590,10 @@ QUICNetVConnection::state_connection_established(int event, Event *data) this->_schedule_packet_write_ready(true); break; } + case QUIC_EVENT_PATH_VALIDATION_TIMEOUT: + this->_close_path_validation_timeout(data); + this->_switch_to_close_state(); + break; case EVENT_IMMEDIATE: { // Start Immediate Close because of Idle Timeout this->_handle_idle_timeout(); @@ -623,6 +627,10 @@ QUICNetVConnection::state_connection_closing(int event, Event *data) // Reschedule WRITE_READY this->_schedule_packet_write_ready(true); break; + case QUIC_EVENT_PATH_VALIDATION_TIMEOUT: + this->_close_path_validation_timeout(data); + this->_switch_to_close_state(); + break; case QUIC_EVENT_CLOSING_TIMEOUT: this->_close_closing_timeout(data); this->_switch_to_close_state(); @@ -650,6 +658,10 @@ QUICNetVConnection::state_connection_draining(int event, Event *data) // This should be the only difference between this and closing_state. this->_close_packet_write_ready(data); break; + case QUIC_EVENT_PATH_VALIDATION_TIMEOUT: + this->_close_path_validation_timeout(data); + this->_switch_to_close_state(); + break; case QUIC_EVENT_CLOSING_TIMEOUT: this->_close_closing_timeout(data); this->_switch_to_close_state(); @@ -925,6 +937,11 @@ QUICNetVConnection::_state_common_receive_packet() Connection con; con.setRemote(&p->from().sa); this->con.move(con); + this->_path_validator->validate(); + // Not sure how long we should wait. The spec says just "enough time". + // Use the same time amount as the closing timeout. + ink_hrtime rto = this->_loss_detector->current_rto_period(); + this->_schedule_path_validation_timeout(3 * rto); } else { // TODO Send some error? } @@ -1532,6 +1549,31 @@ QUICNetVConnection::_complete_handshake_if_possible() } void +QUICNetVConnection::_schedule_path_validation_timeout(ink_hrtime interval) +{ + if (!this->_path_validation_timeout) { + QUICConDebug("Schedule %s event", QUICDebugNames::quic_event(QUIC_EVENT_PATH_VALIDATION_TIMEOUT)); + this->_path_validation_timeout = this_ethread()->schedule_in_local(this, interval, QUIC_EVENT_PATH_VALIDATION_TIMEOUT); + } +} + +void +QUICNetVConnection::_unschedule_path_validation_timeout() +{ + if (this->_path_validation_timeout) { + this->_path_validation_timeout->cancel(); + this->_path_validation_timeout = nullptr; + } +} + +void +QUICNetVConnection::_close_path_validation_timeout(Event *data) +{ + ink_assert(this->_path_validation_timeout == data); + this->_path_validation_timeout = nullptr; +} + +void QUICNetVConnection::_start_application() { if (!this->_application_started) { diff --git a/iocore/net/quic/QUICEvents.h b/iocore/net/quic/QUICEvents.h index ffbb3b4..59e3feb 100644 --- a/iocore/net/quic/QUICEvents.h +++ b/iocore/net/quic/QUICEvents.h @@ -31,6 +31,7 @@ enum { QUIC_EVENT_PACKET_WRITE_READY, QUIC_EVENT_HANDSHAKE_PACKET_WRITE_COMPLETE, QUIC_EVENT_CLOSING_TIMEOUT, + QUIC_EVENT_PATH_VALIDATION_TIMEOUT, QUIC_EVENT_SHUTDOWN, QUIC_EVENT_LD_SHUTDOWN, }; diff --git a/iocore/net/quic/QUICPathValidator.cc b/iocore/net/quic/QUICPathValidator.cc index b779970..510131c 100644 --- a/iocore/net/quic/QUICPathValidator.cc +++ b/iocore/net/quic/QUICPathValidator.cc @@ -35,6 +35,7 @@ QUICPathValidator::validate() if (this->_state == ValidationState::VALIDATING) { // Do nothing } else { + this->_state = ValidationState::VALIDATING; this->_generate_challenge(); } } diff --git a/iocore/net/quic/test/test_QUICPacketFactory.cc b/iocore/net/quic/test/test_QUICPacketFactory.cc index 8fcb9d8..29ff72a 100644 --- a/iocore/net/quic/test/test_QUICPacketFactory.cc +++ b/iocore/net/quic/test/test_QUICPacketFactory.cc @@ -42,7 +42,8 @@ TEST_CASE("QUICPacketFactory_Create_VersionNegotiationPacket", "[quic]") 0x00 // Payload }; - QUICPacketHeaderUPtr header = QUICPacketHeader::load({}, {initial_packet_header, [](void *) {}}, sizeof(initial_packet_header), 0); + QUICPacketHeaderUPtr header = + QUICPacketHeader::load({}, {initial_packet_header, [](void *) {}}, sizeof(initial_packet_header), 0); QUICPacket initial_packet(std::move(header), ats_unique_buf(initial_packet_payload, [](void *) {}), sizeof(initial_packet_payload), 0); -- To stop receiving notification emails like this one, please contact mas...@apache.org.