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)
committerWilly Tarreau <w@1wt.eu>
Wed, 19 Feb 2025 09:34:26 +0000 (10:34 +0100)
commit7cdb2bb00af5a44bab775f2a565cfb27682451f9
tree9052f070f0397b3b11d71abaf9f3e4fc55fd7050
parent3906b5a59c27ab58f1e8a6ca79c21565a400c2fd
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>
src/quic_tx.c