From 05bd92bbc541a6c0c0e195dd6dc63c4efeb6a602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Tue, 29 Mar 2022 19:09:46 +0200 Subject: [PATCH] BUG/MINOR: quic: Discard Initial packet number space only one time When discarding a packet number space, we at least reset the PTO backoff counter. Doing this several times have an impact on the PTO duration calculation. We must not discard a packet number space several times (this is already the case for the handshake packet number space). --- src/xprt_quic.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 253aa85df..7ba47a6f4 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -2559,12 +2559,15 @@ static int qc_parse_pkt_frms(struct quic_rx_packet *pkt, struct ssl_sock_ctx *ct */ if (pkt->type == QUIC_PACKET_TYPE_HANDSHAKE && qc_is_listener(ctx->qc)) { if (qc->state >= QUIC_HS_ST_SERVER_INITIAL) { - quic_tls_discard_keys(&qc->els[QUIC_TLS_ENC_LEVEL_INITIAL]); - TRACE_PROTO("discarding Initial pktns", QUIC_EV_CONN_PRSHPKT, qc); - quic_pktns_discard(qc->els[QUIC_TLS_ENC_LEVEL_INITIAL].pktns, qc); - qc_set_timer(ctx->qc); - qc_el_rx_pkts_del(&qc->els[QUIC_TLS_ENC_LEVEL_INITIAL]); - qc_release_pktns_frms(qc->els[QUIC_TLS_ENC_LEVEL_INITIAL].pktns); + if (!(qc->els[QUIC_TLS_ENC_LEVEL_INITIAL].tls_ctx.flags & + QUIC_FL_TLS_SECRETS_DCD)) { + quic_tls_discard_keys(&qc->els[QUIC_TLS_ENC_LEVEL_INITIAL]); + TRACE_PROTO("discarding Initial pktns", QUIC_EV_CONN_PRSHPKT, qc); + quic_pktns_discard(qc->els[QUIC_TLS_ENC_LEVEL_INITIAL].pktns, qc); + qc_set_timer(ctx->qc); + qc_el_rx_pkts_del(&qc->els[QUIC_TLS_ENC_LEVEL_INITIAL]); + qc_release_pktns_frms(qc->els[QUIC_TLS_ENC_LEVEL_INITIAL].pktns); + } if (qc->state < QUIC_HS_ST_SERVER_HANDSHAKE) qc->state = QUIC_HS_ST_SERVER_HANDSHAKE; }