comparison src/event/quic/ngx_event_quic_ack.c @ 9170:c80d111340dc

QUIC: prevented generating ACK frames with discarded keys. Previously it was possible to generate ACK frames using formally discarded protection keys, in particular, when acknowledging a client Handshake packet used to complete the TLS handshake and to discard handshake protection keys. As it happens late in packet processing, it could be possible to generate ACK frames after the keys were already discarded. ACK frames are generated from ngx_quic_ack_packet(), either using a posted push event, which envolves ngx_quic_generate_ack() as a part of the final packet assembling, or directly in ngx_quic_ack_packet(), such as when there is no room to add a new ACK range or when the received packet is out of order. The added keys availability check is used to avoid generating late ACK frames in both cases.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 20 Oct 2023 18:05:07 +0400
parents 58afcd72446f
children efcdaa66df2e
comparison
equal deleted inserted replaced
9169:60c4e8d3151f 9170:c80d111340dc
905 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0, 905 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0,
906 "quic ngx_quic_ack_packet pn:%uL largest %L fr:%uL" 906 "quic ngx_quic_ack_packet pn:%uL largest %L fr:%uL"
907 " nranges:%ui", pkt->pn, (int64_t) ctx->largest_range, 907 " nranges:%ui", pkt->pn, (int64_t) ctx->largest_range,
908 ctx->first_range, ctx->nranges); 908 ctx->first_range, ctx->nranges);
909 909
910 if (!ngx_quic_keys_available(qc->keys, ctx->level, 1)) {
911 return NGX_OK;
912 }
913
910 prev_pending = ctx->pending_ack; 914 prev_pending = ctx->pending_ack;
911 915
912 if (pkt->need_ack) { 916 if (pkt->need_ack) {
913 917
914 ngx_post_event(&qc->push, &ngx_posted_events); 918 ngx_post_event(&qc->push, &ngx_posted_events);