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.
This commit is contained in:
Amaury Denoyelle 2023-02-02 14:59:36 +01:00
parent 565e3cc43a
commit 2216b0866e
3 changed files with 6 additions and 8 deletions

View File

@ -170,7 +170,6 @@ struct quic_stream {
struct eb64_node offset; struct eb64_node offset;
uint64_t len; uint64_t len;
int fin;
/* for TX pointer into <buf> field. /* for TX pointer into <buf> field.
* for RX pointer into the packet buffer. * for RX pointer into the packet buffer.

View File

@ -2355,14 +2355,15 @@ static inline int qc_provide_cdata(struct quic_enc_level *el,
return ret; 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 * Return 1 on success. On error, 0 is returned. In this case, the packet
* containing the frame must not be acknowledged. * containing the frame must not be acknowledged.
*/ */
static inline int qc_handle_strm_frm(struct quic_rx_packet *pkt, static inline int qc_handle_strm_frm(struct quic_rx_packet *pkt,
struct quic_stream *strm_frm, struct quic_stream *strm_frm,
struct quic_conn *qc) struct quic_conn *qc, char fin)
{ {
int ret; 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); TRACE_ENTER(QUIC_EV_CONN_PRSFRM, qc);
ret = qcc_recv(qc->qcc, strm_frm->id, strm_frm->len, ret = qcc_recv(qc->qcc, strm_frm->id, strm_frm->len,
strm_frm->offset.key, strm_frm->fin, strm_frm->offset.key, fin, (char *)strm_frm->data);
(char *)strm_frm->data);
/* frame rejected - packet must not be acknowledeged */ /* frame rejected - packet must not be acknowledeged */
TRACE_LEAVE(QUIC_EV_CONN_PRSFRM, qc); 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; struct quic_stream *stream = &frm.stream;
unsigned nb_streams = qc->rx.strms[qcs_id_type(stream->id)].nb_streams; 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. */ /* The upper layer may not be allocated. */
if (qc->mux_state != QC_MUX_READY) { 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); TRACE_ERROR("qc_handle_strm_frm() failed", QUIC_EV_CONN_PRSHPKT, qc);
goto leave; goto leave;
} }

View File

@ -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) else if (!quic_dec_int(&stream->len, buf, end) || end - *buf < stream->len)
return 0; return 0;
stream->fin = (frm->type & QUIC_STREAM_FRAME_TYPE_FIN_BIT);
stream->data = *buf; stream->data = *buf;
*buf += stream->len; *buf += stream->len;