Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't make an error on duplicated RETIRE_CONNECTION frames #7131

Merged
merged 1 commit into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions iocore/net/quic/QUICAltConnectionManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,15 @@ QUICAltConnectionManager::_init_alt_connection_ids()
this->_need_advertise = true;
}

bool
void
QUICAltConnectionManager::_update_alt_connection_id(uint64_t chosen_seq_num)
{
for (int i = 0; i < this->_remote_active_cid_limit; ++i) {
if (this->_alt_quic_connection_ids_local[i].seq_num == chosen_seq_num) {
this->_alt_quic_connection_ids_local[i] = this->_generate_next_alt_con_info();
this->_need_advertise = true;
return true;
}
}

return false;
}

QUICConnectionErrorUPtr
Expand Down Expand Up @@ -184,9 +181,11 @@ QUICAltConnectionManager::_retire_remote_connection_id(const QUICRetireConnectio
{
QUICConnectionErrorUPtr error = nullptr;

if (!this->_update_alt_connection_id(frame.seq_num())) {
if (frame.seq_num() > this->_alt_quic_connection_id_seq_num) {
error = std::make_unique<QUICConnectionError>(QUICTransErrorCode::PROTOCOL_VIOLATION, "received unused sequence number",
QUICFrameType::RETIRE_CONNECTION_ID);
} else {
this->_update_alt_connection_id(frame.seq_num());
}
return error;
}
Expand Down
2 changes: 1 addition & 1 deletion iocore/net/quic/QUICAltConnectionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class QUICAltConnectionManager : public QUICFrameHandler, public QUICFrameGenera

AltConnectionInfo _generate_next_alt_con_info();
void _init_alt_connection_ids();
bool _update_alt_connection_id(uint64_t chosen_seq_num);
void _update_alt_connection_id(uint64_t chosen_seq_num);

void _records_new_connection_id_frame(QUICEncryptionLevel level, const QUICNewConnectionIdFrame &frame);
void _records_retire_connection_id_frame(QUICEncryptionLevel, const QUICRetireConnectionIdFrame &frame);
Expand Down