Skip to content

Commit

Permalink
MINOR: mux-quic: Don't send an emtpy H3 DATA frame during zero-copy f…
Browse files Browse the repository at this point in the history
…orwarding

It may only happens when there is no data to forward but a last stream frame
must be sent with the FIN bit. It is not invalid, but it is useless to send
an empty H3 DATA frame in that case.

(cherry picked from commit 6697e87)
[ad: This patch was merely considered as an optimization. However, it
 is in fact mandatory as it fixes a bug on QUIC zero-copy
 implementation. As such, it must be backported up to 2.9.

This bug can happen when iobuf data is null in done_ff, indicating that
no data were transferred. Despite this, qcc_send_stream() was always
called with data incorrectly incremented to iobuf offset, which is equal
to HTTP/3 frame header length. This could cause garbage data emission by
QUIC MUX. The most visible effect is that it provokes a BUG_ON() crash
when QCS instance is released due to Tx offsets desynchronization.

This bug is related to github issue haproxy#2678.]

Signed-off-by: Amaury Denoyelle <[email protected]>
  • Loading branch information
capflam authored and a-denoyelle committed Dec 5, 2024
1 parent 56cd20c commit d680647
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mux_quic.c
Original file line number Diff line number Diff line change
Expand Up @@ -3148,7 +3148,8 @@ static size_t qmux_strm_done_ff(struct stconn *sc)
goto end;
}

data += sd->iobuf.offset;
if (data)
data += sd->iobuf.offset;
total = qcs->qcc->app_ops->done_ff(qcs);

if (data || qcs->flags & QC_SF_FIN_STREAM)
Expand Down

0 comments on commit d680647

Please sign in to comment.