Skip to content

Commit

Permalink
Abandon Connections with Too Many Retired CIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
nibanks committed Mar 12, 2024
1 parent edb246b commit 933f7b7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,16 @@ QuicConnRetireCid(
DestCid->CID.Retired = TRUE;
DestCid->CID.NeedsToSend = TRUE;
QuicSendSetSendFlag(&Connection->Send, QUIC_CONN_SEND_FLAG_RETIRE_CONNECTION_ID);

Connection->RetiredDestCidCount++;
if (Connection->RetiredDestCidCount > 8 * QUIC_ACTIVE_CONNECTION_ID_LIMIT) {
QuicTraceEvent(
ConnError,
"[conn][%p] ERROR, %s.",
Connection,
"Peer exceeded retire CID limit");
QuicConnSilentlyAbort(Connection);
}
}

_IRQL_requires_max_(PASSIVE_LEVEL)
Expand Down
5 changes: 5 additions & 0 deletions src/core/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ typedef struct QUIC_CONNECTION {
//
uint8_t DestCidCount;

//
// Number of retired desintation CIDs we currently have cached.
//
uint8_t RetiredDestCidCount;

//
// The maximum number of source CIDs to give the peer. This is a minimum of
// what we're willing to support and what the peer is willing to accept.
Expand Down
2 changes: 2 additions & 0 deletions src/core/loss_detection.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,8 @@ QuicLossDetectionOnPacketAcknowledged(
CXPLAT_DBG_ASSERT(DestCid->CID.Retired);
CXPLAT_DBG_ASSERT(Path == NULL || Path->DestCid != DestCid);
QUIC_CID_VALIDATE_NULL(Connection, DestCid);
CXPLAT_DBG_ASSERT(Connection->RetiredDestCidCount > 0);
Connection->RetiredDestCidCount--;
CXPLAT_FREE(DestCid, QUIC_POOL_CIDLIST);
}
break;
Expand Down

0 comments on commit 933f7b7

Please sign in to comment.