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.

(cherry picked from commit ca07979b978ed683b96d0ec99073c7cb972fd022)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit dcc827589a3a351af315d1f4cf0126dd2dc8a746)
[cf: ctx adjustment]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
This commit is contained in:
Frédéric Lécaille 2023-03-17 08:56:50 +01:00 committed by Christopher Faulet
parent 14e256dd6b
commit a68b664ab7
2 changed files with 22 additions and 6 deletions

View File

@ -176,5 +176,18 @@ static inline struct quic_err quic_err_app(uint64_t code)
return (struct quic_err){ .code = code, .app = 1 };
}
/* Move forward <strm> STREAM frame by <data> 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 */

View File

@ -1854,8 +1854,9 @@ static inline void 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);
}
@ -2501,8 +2502,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);
}
@ -6809,8 +6811,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);
}