Skip to content

Commit 209a54d

Browse files
committed
BUG/MINOR: quic: pad Initial pkt with CONNECTION_CLOSE on client
Currently, when connection is closing, only CONNECTION_CLOSE frame is emitted via qc_prep_pkts()/qc_do_build_pkt(). Also, only the first registered encryption level is considered while the others are dismissed. This results in a single packet datagram. This can cause issues for QUIC client support, as padding is required for every Initial packet, contrary to server side where only ack-eliciting packets are eligible. Thus a client must add padding to a CONNECTION_CLOSE frame on Initial level. This patch adjusts qc_prep_pkts() to ensure such packet will be correctly padded on client side. It sets <final_packet> variable which instructs that if padding is necessary it must be apply immediately on the current encryption level instead of the last one. It could appear as unnecessary to pad a CONNECTION_CLOSE packet, as the peer will enter in draining state when processing it. However, RFC mandates that a client Initial packet too small must be dropped by the server, so there is a risk that the CONNECTION_CLOSE is simply discarded prior to its processing if stored in a too small datagram. No need to backport as this is a QUIC backend issue only.
1 parent e9b78e3 commit 209a54d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/quic_tx.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,12 @@ static int qc_prep_pkts(struct quic_conn *qc, struct buffer *buf,
715715
*/
716716
if (probe && (must_ack || (qel->pktns->flags & QUIC_FL_PKTNS_ACK_REQUIRED)))
717717
final_packet = 1;
718+
/* If CONNECTION_CLOSE is emitted only a single QEL is considered while the others are dismissed. This
719+
* must be taken into account if padding is required on QUIC client side. Note that this is irrelevant
720+
* for server side as CONNECTION_CLOSE is not ack-eliciting.
721+
*/
722+
else if (qc_is_back(qc) && cc)
723+
final_packet = 1;
718724

719725
pkt_type = quic_enc_level_pkt_type(qc, qel);
720726
cur_pkt = qc_build_pkt(&pos, end, qel, tls_ctx, frms,

0 commit comments

Comments
 (0)