diff options
author | Matt Caswell <matt@openssl.org> | 2023-06-12 16:21:16 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2023-06-14 10:23:58 +0100 |
commit | ca711651c19530b54f0dd6f7ff6b24b5c8d016a2 (patch) | |
tree | 808b2cc656d0ee5bb1c18fd16d088204dffce247 | |
parent | fbff5b57715471910ea99d28f03ba6a417b45135 (diff) |
Only take note of the ack deadline if we can actually issue an ack
When determining the next tick deadline we cannot actually issue an
ack if the CC will not let us, or the enc_level is not yet provisioned.
This avoids a bug where we can end up in a busy loop because the next
event deadline is reported as "now" because we want to send an ack, but
we can't actually send anything yet.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21181)
-rw-r--r-- | ssl/quic/quic_channel.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c index d4437c4d90..aa4233c51d 100644 --- a/ssl/quic/quic_channel.c +++ b/ssl/quic/quic_channel.c @@ -1710,7 +1710,7 @@ static int ch_tx(QUIC_CHANNEL *ch) static OSSL_TIME ch_determine_next_tick_deadline(QUIC_CHANNEL *ch) { OSSL_TIME deadline; - uint32_t pn_space; + int i; if (ossl_quic_channel_is_terminated(ch)) return ossl_time_infinite(); @@ -1719,9 +1719,19 @@ static OSSL_TIME ch_determine_next_tick_deadline(QUIC_CHANNEL *ch) if (ossl_time_is_zero(deadline)) deadline = ossl_time_infinite(); - for (pn_space = QUIC_PN_SPACE_INITIAL; pn_space < QUIC_PN_SPACE_NUM; ++pn_space) - deadline = ossl_time_min(deadline, - ossl_ackm_get_ack_deadline(ch->ackm, pn_space)); + /* + * If the CC will let us send acks, check the ack deadline for all + * enc_levels that are actually provisioned + */ + if (ch->cc_method->get_tx_allowance(ch->cc_data) > 0) { + for (i = 0; i < QUIC_ENC_LEVEL_NUM; i++) { + if (ossl_qtx_is_enc_level_provisioned(ch->qtx, i)) { + deadline = ossl_time_min(deadline, + ossl_ackm_get_ack_deadline(ch->ackm, + ossl_quic_enc_level_to_pn_space(i))); + } + } + } /* When will CC let us send more? */ if (ossl_quic_tx_packetiser_has_pending(ch->txp, TX_PACKETISER_ARCHETYPE_NORMAL, |