MINOR: quic: remove fin from quic_stream frame type
A dedicated <fin> field was used in quic_stream structure. However, this
info is already encoded in the frame type field as specified by QUIC
protocol.
In fact, only code for packet reception used the <fin> field. On the
sending side, we only checked for the FIN bit. To align both sides,
remove the <fin> field and only used the FIN bit.
This should be backported up to 2.7.
diff --git a/include/haproxy/quic_frame-t.h b/include/haproxy/quic_frame-t.h
index 7770f61..cae1ae8 100644
--- a/include/haproxy/quic_frame-t.h
+++ b/include/haproxy/quic_frame-t.h
@@ -170,7 +170,6 @@
struct eb64_node offset;
uint64_t len;
- int fin;
/* for TX pointer into <buf> field.
* for RX pointer into the packet buffer.
diff --git a/src/quic_conn.c b/src/quic_conn.c
index 795c1ab..26a75f5 100644
--- a/src/quic_conn.c
+++ b/src/quic_conn.c
@@ -2355,14 +2355,15 @@
return ret;
}
-/* Parse a STREAM frame <strm_frm>
+/* Parse a STREAM frame <strm_frm> received in <pkt> packet for <qc>
+ * connection. <fin> is true if FIN bit is set on frame type.
*
* Return 1 on success. On error, 0 is returned. In this case, the packet
* containing the frame must not be acknowledged.
*/
static inline int qc_handle_strm_frm(struct quic_rx_packet *pkt,
struct quic_stream *strm_frm,
- struct quic_conn *qc)
+ struct quic_conn *qc, char fin)
{
int ret;
@@ -2377,8 +2378,7 @@
TRACE_ENTER(QUIC_EV_CONN_PRSFRM, qc);
ret = qcc_recv(qc->qcc, strm_frm->id, strm_frm->len,
- strm_frm->offset.key, strm_frm->fin,
- (char *)strm_frm->data);
+ strm_frm->offset.key, fin, (char *)strm_frm->data);
/* frame rejected - packet must not be acknowledeged */
TRACE_LEAVE(QUIC_EV_CONN_PRSFRM, qc);
@@ -2827,6 +2827,7 @@
{
struct quic_stream *stream = &frm.stream;
unsigned nb_streams = qc->rx.strms[qcs_id_type(stream->id)].nb_streams;
+ const char fin = frm.type & QUIC_STREAM_FRAME_TYPE_FIN_BIT;
/* The upper layer may not be allocated. */
if (qc->mux_state != QC_MUX_READY) {
@@ -2854,7 +2855,7 @@
}
}
- if (!qc_handle_strm_frm(pkt, stream, qc)) {
+ if (!qc_handle_strm_frm(pkt, stream, qc, fin)) {
TRACE_ERROR("qc_handle_strm_frm() failed", QUIC_EV_CONN_PRSHPKT, qc);
goto leave;
}
diff --git a/src/quic_frame.c b/src/quic_frame.c
index f98f594..6f299ba 100644
--- a/src/quic_frame.c
+++ b/src/quic_frame.c
@@ -556,8 +556,6 @@
else if (!quic_dec_int(&stream->len, buf, end) || end - *buf < stream->len)
return 0;
- stream->fin = (frm->type & QUIC_STREAM_FRAME_TYPE_FIN_BIT);
-
stream->data = *buf;
*buf += stream->len;