From: Frédéric Lécaille Date: Fri, 17 Mar 2023 07:56:50 +0000 (+0100) Subject: BUG/MINOR: quic: Missing STREAM frame data pointer updates X-Git-Tag: v2.8-dev6~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca07979b978ed683b96d0ec99073c7cb972fd022;p=thirdparty%2Fhaproxy.git BUG/MINOR: quic: Missing STREAM frame data pointer updates This patch follows this one which was not sufficient: "BUG/MINOR: quic: Missing STREAM frame length updates" Indeed, it is not sufficient to update the ->len and ->offset member of a STREAM frame to move it forward. The data pointer must also be updated. This is not done by the STREAM frame builder. Must be backported to 2.6 and 2.7. --- diff --git a/include/haproxy/quic_frame.h b/include/haproxy/quic_frame.h index ea33425ac8..f75d7e65fc 100644 --- a/include/haproxy/quic_frame.h +++ b/include/haproxy/quic_frame.h @@ -254,5 +254,18 @@ static inline void qc_frm_free(struct quic_frame **frm) *frm = NULL; } +/* Move forward STREAM frame by bytes. */ +static inline void qc_stream_frm_mv_fwd(struct quic_stream *strm, uint64_t data) +{ + struct buffer cf_buf; + + strm->offset.key += data; + strm->len -= data; + cf_buf = b_make(b_orig(strm->buf), + b_size(strm->buf), + (char *)strm->data - b_orig(strm->buf), 0); + strm->data = (unsigned char *)b_peek(&cf_buf, data); +} + #endif /* USE_QUIC */ #endif /* _HAPROXY_QUIC_FRAME_H */ diff --git a/src/quic_conn.c b/src/quic_conn.c index 6fd8412f2f..5fa2ce942d 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -1897,8 +1897,9 @@ static inline int qc_requeue_nacked_pkt_tx_frms(struct quic_conn *qc, continue; } else if (strm_frm->offset.key < stream_desc->ack_offset) { - strm_frm->offset.key = stream_desc->ack_offset; - strm_frm->len -= stream_desc->ack_offset - strm_frm->offset.key; + uint64_t diff = stream_desc->ack_offset - strm_frm->offset.key; + + qc_stream_frm_mv_fwd(strm_frm, diff); TRACE_DEVEL("updated partially acked frame", QUIC_EV_CONN_PRSAFRM, qc, frm); } @@ -2553,8 +2554,9 @@ static void qc_dup_pkt_frms(struct quic_conn *qc, continue; } else if (strm_frm->offset.key < stream_desc->ack_offset) { - strm_frm->offset.key = stream_desc->ack_offset; - strm_frm->len -= stream_desc->ack_offset - strm_frm->offset.key; + uint64_t diff = stream_desc->ack_offset - strm_frm->offset.key; + + qc_stream_frm_mv_fwd(strm_frm, diff); TRACE_DEVEL("updated partially acked frame", QUIC_EV_CONN_PRSAFRM, qc, frm); } @@ -7289,8 +7291,9 @@ static inline int qc_build_frms(struct list *outlist, struct list *inlist, continue; } else if (strm->offset.key < stream_desc->ack_offset) { - strm->offset.key = stream_desc->ack_offset; - strm->len -= stream_desc->ack_offset - strm->offset.key; + uint64_t diff = stream_desc->ack_offset - strm->offset.key; + + qc_stream_frm_mv_fwd(strm, diff); TRACE_DEVEL("updated partially acked frame", QUIC_EV_CONN_PRSAFRM, qc, cf); }