From: Amaury Denoyelle Date: Thu, 2 Feb 2023 13:59:36 +0000 (+0100) Subject: MINOR: quic: remove fin from quic_stream frame type X-Git-Tag: v2.8-dev3~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2216b0866e785f1fc2dcc3cecb66e9eeda045184;p=thirdparty%2Fhaproxy.git MINOR: quic: remove fin from quic_stream frame type A dedicated 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 field. On the sending side, we only checked for the FIN bit. To align both sides, remove the 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 7770f61878..cae1ae8897 100644 --- a/include/haproxy/quic_frame-t.h +++ b/include/haproxy/quic_frame-t.h @@ -170,7 +170,6 @@ struct quic_stream { struct eb64_node offset; uint64_t len; - int fin; /* for TX pointer into field. * for RX pointer into the packet buffer. diff --git a/src/quic_conn.c b/src/quic_conn.c index 795c1ab924..26a75f563b 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -2355,14 +2355,15 @@ static inline int qc_provide_cdata(struct quic_enc_level *el, return ret; } -/* Parse a STREAM frame +/* Parse a STREAM frame received in packet for + * connection. 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 @@ static inline int qc_handle_strm_frm(struct quic_rx_packet *pkt, 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 @@ static int qc_parse_pkt_frms(struct quic_conn *qc, struct quic_rx_packet *pkt, { 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 @@ static int qc_parse_pkt_frms(struct quic_conn *qc, struct quic_rx_packet *pkt, } } - 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 f98f5944ed..6f299ba2d4 100644 --- a/src/quic_frame.c +++ b/src/quic_frame.c @@ -556,8 +556,6 @@ static int quic_parse_stream_frame(struct quic_frame *frm, struct quic_conn *qc, 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;