Skip to content

Commit 2d1c29c

Browse files
authored
Fixes #518: lsquic compliance with RFC 9000 for MAX_STREAM_DATA frame (#525)
* Fix lsquic compliance with RFC 9000 for MAX_STREAM_DATA frame * Fix lsquic compliance with RFC 9000 for MAX_STREAM_DATA frame, and build successfully upon latest version * Fix: handle MAX_STREAM_DATA frame according to RFC 9000 and RFC 9114 * Fix: Readjust to handle MAX_STREAM_DATA frame according to RFC 9000 and RFC 9114
1 parent d3582f3 commit 2d1c29c

File tree

1 file changed

+53
-3
lines changed

1 file changed

+53
-3
lines changed

src/liblsquic/lsquic_full_conn_ietf.c

+53-3
Original file line numberDiff line numberDiff line change
@@ -6194,9 +6194,59 @@ process_max_stream_data_frame (struct ietf_full_conn *conn,
61946194
stream_id);
61956195
else
61966196
{
6197-
ABORT_QUIETLY(0, TEC_STREAM_STATE_ERROR, "received MAX_STREAM_DATA "
6198-
"frame on never-opened stream %"PRIu64, stream_id);
6199-
return 0;
6197+
if (is_peer_initiated(conn, stream_id))
6198+
{
6199+
if ((conn->ifc_flags & (IFC_SERVER|IFC_HTTP)) == IFC_HTTP
6200+
&& SIT_BIDI_SERVER == (stream_id & SIT_MASK))
6201+
{
6202+
ABORT_QUIETLY(1, HEC_STREAM_CREATION_ERROR, "HTTP/3 server "
6203+
"is not allowed to initiate bidirectional streams (got "
6204+
"STREAM frame for stream %"PRIu64, stream_id);
6205+
return 0;
6206+
}
6207+
6208+
if (conn->ifc_flags & IFC_CLOSING)
6209+
{
6210+
LSQ_DEBUG("Connection closing: ignore frame");
6211+
return parsed_len;
6212+
}
6213+
6214+
const lsquic_stream_id_t max_allowed =
6215+
conn->ifc_max_allowed_stream_id[stream_id & SIT_MASK];
6216+
if (stream_id >= max_allowed)
6217+
{
6218+
ABORT_QUIETLY(0, TEC_STREAM_LIMIT_ERROR, "incoming stream "
6219+
"%"PRIu64" exceeds allowed max of %"PRIu64,
6220+
stream_id, max_allowed);
6221+
return 0;
6222+
}
6223+
if (conn->ifc_flags & IFC_GOING_AWAY)
6224+
{
6225+
LSQ_DEBUG("going away: reject new incoming stream %"PRIu64,
6226+
stream_id);
6227+
maybe_schedule_ss_for_stream(conn, stream_id,
6228+
HEC_REQUEST_REJECTED);
6229+
return parsed_len;
6230+
}
6231+
stream = new_stream(conn, stream_id, SCF_CALL_ON_NEW);
6232+
if (!stream)
6233+
{
6234+
ABORT_ERROR("cannot create new stream: %s", strerror(errno));
6235+
return 0;
6236+
}
6237+
if (SD_BIDI == ((stream_id >> SD_SHIFT) & 1)
6238+
&& (!valid_stream_id(conn->ifc_max_req_id)
6239+
|| conn->ifc_max_req_id < stream_id))
6240+
conn->ifc_max_req_id = stream_id;
6241+
6242+
lsquic_stream_window_update(stream, max_data);
6243+
}
6244+
else
6245+
{
6246+
ABORT_QUIETLY(0, TEC_STREAM_STATE_ERROR, "received MAX_STREAM_DATA "
6247+
"frame on never-opened stream %"PRIu64, stream_id);
6248+
return 0;
6249+
}
62006250
}
62016251

62026252
return parsed_len;

0 commit comments

Comments
 (0)