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 ea33425..f75d7e6 100644
--- a/include/haproxy/quic_frame.h
+++ b/include/haproxy/quic_frame.h
@@ -254,5 +254,18 @@
*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 */
diff --git a/src/quic_conn.c b/src/quic_conn.c
index 6fd8412..5fa2ce9 100644
--- a/src/quic_conn.c
+++ b/src/quic_conn.c
@@ -1897,8 +1897,9 @@
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 @@
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 @@
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);
}