Skip to content

Commit 34d5bfd

Browse files
committed
BUG/MINOR: quic: fix room check if padding requested
qc_prep_pkts() activates padding when building an Initial packet. This ensures that resulting datagram will always be at least 1.200 bytes, which is mandatory to prevent deadlock over anti-amplication. Prior to padding activation, a check is performed to ensure that output buffer is big enough for a padded datagram. However, this did not take into account previously built packets which would be coalesced in the same datagram. Thus this patch fixes this comparison check. In theory, prior to this patch, in some cases Initial packets could not be built despite a datagram of the proper size. Currently, this probably never happens as Initial packet is always the first encoded in a datagram, thus there is no coalesced packet prior to it. However, there is no hard requirement on this, so it's better to reflect this in the code. This should be backported up to 2.6.
1 parent a84b404 commit 34d5bfd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/quic_tx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ static int qc_prep_pkts(struct quic_conn *qc, struct buffer *buf,
698698
*/
699699
if (qel == qc->iel && (qc_is_back(qc) || !LIST_ISEMPTY(frms) || probe)) {
700700
/* Ensure that no Initial packets are sent into too small datagrams */
701-
if (end - pos < QUIC_INITIAL_PACKET_MINLEN) {
701+
if (end - pos + dglen < QUIC_INITIAL_PACKET_MINLEN) {
702702
TRACE_PROTO("No more enough room to build an Initial packet",
703703
QUIC_EV_CONN_PHPKTS, qc);
704704
break;

0 commit comments

Comments
 (0)