From: Frédéric Lécaille Date: Tue, 29 Mar 2022 17:09:46 +0000 (+0200) Subject: BUG/MINOR: quic: Discard Initial packet number space only one time X-Git-Tag: v2.6-dev5~70 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=05bd92bbc541a6c0c0e195dd6dc63c4efeb6a602;p=thirdparty%2Fhaproxy.git 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). --- diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 253aa85df4..7ba47a6f47 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; }