Skip to content

Commit 46c448d

Browse files
committed
Release 4.0.4
1 parent 9d9cde9 commit 46c448d

File tree

5 files changed

+46
-13
lines changed

5 files changed

+46
-13
lines changed

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2024-01-08
2+
- 4.0.4
3+
- Fix DCID validation.
4+
- Fix CPU spinning due to pending STREAM_BLOCKED frame.
5+
16
2023-12-25
27
- 4.0.3
38
- Fix session resumption bug introduced in 4.0.2.

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# The short X.Y version
2727
version = u'4.0'
2828
# The full version, including alpha/beta/rc tags
29-
release = u'4.0.3'
29+
release = u'4.0.4'
3030

3131

3232
# -- General configuration ---------------------------------------------------

include/lsquic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern "C" {
2727

2828
#define LSQUIC_MAJOR_VERSION 4
2929
#define LSQUIC_MINOR_VERSION 0
30-
#define LSQUIC_PATCH_VERSION 3
30+
#define LSQUIC_PATCH_VERSION 4
3131

3232
/**
3333
* Engine flags:

src/liblsquic/lsquic_full_conn_ietf.c

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,7 @@ blocked_ka_alarm_expired (enum alarm_id al_id, void *ctx,
755755
struct ietf_full_conn *const conn = (struct ietf_full_conn *) ctx;
756756
struct lsquic_stream *stream;
757757
struct lsquic_hash_elem *el;
758+
int has_send_flag;
758759

759760
if (lsquic_conn_cap_avail(&conn->ifc_pub.conn_cap) == 0)
760761
{
@@ -769,12 +770,18 @@ blocked_ka_alarm_expired (enum alarm_id al_id, void *ctx,
769770
stream = lsquic_hashelem_getdata(el);
770771
if (lsquic_stream_is_blocked(stream))
771772
{
772-
if (!(stream->sm_qflags & SMQF_SENDING_FLAGS))
773-
TAILQ_INSERT_TAIL(&conn->ifc_pub.sending_streams, stream,
774-
next_send_stream);
773+
has_send_flag = (stream->sm_qflags & SMQF_SENDING_FLAGS);
775774
stream->sm_qflags |= SMQF_SEND_BLOCKED;
776775
LSQ_DEBUG("set SEND_BLOCKED flag on stream %"PRIu64, stream->id);
777-
return;
776+
if (!lsquic_sendctl_gen_stream_blocked_frame(
777+
stream->conn_pub->send_ctl, stream))
778+
{
779+
LSQ_DEBUG("failed to send STREAM_BLOCKED frame for"
780+
" stream %"PRIu64 " immedately, postpone.", stream->id);
781+
if (!has_send_flag)
782+
TAILQ_INSERT_TAIL(&conn->ifc_pub.sending_streams, stream,
783+
next_send_stream);
784+
}
778785
}
779786
}
780787
}
@@ -7387,6 +7394,7 @@ process_regular_packet (struct ietf_full_conn *conn,
73877394
enum was_missing was_missing;
73887395
int is_rechist_empty;
73897396
unsigned char saved_path_id;
7397+
int is_dcid_changed;
73907398

73917399
if (HETY_RETRY == packet_in->pi_header_type)
73927400
return process_retry_packet(conn, packet_in);
@@ -7489,16 +7497,31 @@ process_regular_packet (struct ietf_full_conn *conn,
74897497
}
74907498
}
74917499

7500+
is_dcid_changed = !LSQUIC_CIDS_EQ(CN_SCID(&conn->ifc_conn),
7501+
&packet_in->pi_dcid);
74927502
if (pns == PNS_INIT)
74937503
conn->ifc_conn.cn_esf.i->esfi_set_iscid(conn->ifc_conn.cn_enc_session,
74947504
packet_in);
7495-
else if (pns == PNS_HSK)
7505+
else
74967506
{
7497-
if ((conn->ifc_flags & (IFC_SERVER | IFC_IGNORE_INIT)) == IFC_SERVER)
7498-
ignore_init(conn);
7499-
lsquic_send_ctl_maybe_calc_rough_rtt(&conn->ifc_send_ctl, pns - 1);
7507+
if (is_dcid_changed)
7508+
{
7509+
if (LSQUIC_CIDS_EQ(&conn->ifc_conn.cn_cces[0].cce_cid,
7510+
&packet_in->pi_dcid)
7511+
&& !(conn->ifc_conn.cn_cces[0].cce_flags & CCE_SEQNO))
7512+
{
7513+
ABORT_QUIETLY(0, TEC_PROTOCOL_VIOLATION,
7514+
"protocol violation detected bad dcid");
7515+
return -1;
7516+
}
7517+
}
7518+
if (pns == PNS_HSK)
7519+
{
7520+
if ((conn->ifc_flags & (IFC_SERVER | IFC_IGNORE_INIT)) == IFC_SERVER)
7521+
ignore_init(conn);
7522+
lsquic_send_ctl_maybe_calc_rough_rtt(&conn->ifc_send_ctl, pns - 1);
7523+
}
75007524
}
7501-
75027525
EV_LOG_PACKET_IN(LSQUIC_LOG_CONN_ID, packet_in);
75037526

75047527
is_rechist_empty = lsquic_rechist_is_empty(&conn->ifc_rechist[pns]);
@@ -7522,8 +7545,7 @@ process_regular_packet (struct ietf_full_conn *conn,
75227545
<< packet_in->pi_path_id);
75237546
}
75247547
}
7525-
else if (!LSQUIC_CIDS_EQ(CN_SCID(&conn->ifc_conn),
7526-
&packet_in->pi_dcid))
7548+
else if (is_dcid_changed)
75277549
{
75287550
if (0 != on_dcid_change(conn, &packet_in->pi_dcid))
75297551
return -1;

src/liblsquic/lsquic_stream.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,6 +2437,12 @@ lsquic_stream_dispatch_write_events (lsquic_stream_t *stream)
24372437
else
24382438
stream_dispatch_write_events_loop(stream);
24392439

2440+
if ((stream->sm_qflags & SMQF_SEND_BLOCKED) &&
2441+
(stream->sm_bflags & SMBF_IETF))
2442+
{
2443+
lsquic_sendctl_gen_stream_blocked_frame(stream->conn_pub->send_ctl, stream);
2444+
}
2445+
24402446
/* Progress means either flags or offsets changed: */
24412447
progress = !((stream->sm_qflags & SMQF_WRITE_Q_FLAGS) == q_flags &&
24422448
stream->tosend_off == tosend_off &&

0 commit comments

Comments
 (0)