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.
This commit is contained in:
Frdric Lcaille 2023-03-17 08:56:50 +01:00 committed by Willy Tarreau
parent 14ea98af73
commit ca07979b97
2 changed files with 22 additions and 6 deletions

View File

@ -254,5 +254,18 @@ static inline void qc_frm_free(struct quic_frame **frm)
*frm = NULL;
}
/* 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

@ -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);
}