BUG/MINOR: quic: fix CRYPTO payload size calcul for encoding
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 11 Feb 2025 13:35:52 +0000 (14:35 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 18 Mar 2025 14:42:59 +0000 (15:42 +0100)
commit3e1cfa5b8d3010f1bca613ba8be31ed7e6ccdcd3
treef6ce7776034f7af1da19e278be00a02f97afb6f0
parentc5d006b0a24bc2d69898c153bc06f66783e0fccd
BUG/MINOR: quic: fix CRYPTO payload size calcul for encoding

Function max_stream_data_size() is used to determine the payload length
of a CRYPTO frame. It takes into account that the CRYPTO length field is
a variable length integer.

Implemented calcul was incorrect as it reserved too much space as a
frame header. This error is mostly due because max_stream_data_size()
reuses max_available_room() which also reserve space for a variable
length integer. This results in CRYPTO frames shorter of 1 to 2 bytes
than the maximum achievable value, which produces in the end datagram
shorter than the MTU.

Fix max_stream_data_size() implementation. It is now merely a wrapper on
max_available_room(). This ensures that CRYPTO frame encoding is now
properly optimized to use the MTU available.

This should be backported up to 2.6.

(cherry picked from commit e6a223542ae87880b3e8261daffbe362730f9e55)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 7cdb2bb00af5a44bab775f2a565cfb27682451f9)
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
src/quic_tx.c