From 082507cd1032c90cefc0a9cad845c5fdeae53f86 Mon Sep 17 00:00:00 2001 From: George Wang Date: Thu, 30 Sep 2021 11:23:56 -0400 Subject: [PATCH] Release 3.0.3 --- CHANGELOG | 10 ++++++++++ docs/conf.py | 2 +- include/lsquic.h | 8 +++++++- src/liblsquic/lsquic_enc_sess_ietf.c | 4 +++- src/liblsquic/lsquic_full_conn_ietf.c | 4 ++-- src/liblsquic/lsquic_ietf.h | 2 +- src/liblsquic/lsquic_packet_out.c | 7 +++++-- src/liblsquic/lsquic_parse_ietf_v1.c | 3 ++- src/liblsquic/lsquic_stream.c | 15 ++++++++++++--- src/liblsquic/lsquic_version.c | 19 ++++++++++++++++++- 10 files changed, 61 insertions(+), 13 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 58e6a1b..14a444b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,13 @@ +2021-09-30 + - 3.0.3 + - Generate ACK for DATAGRAM frame while avoid RETX (issue #312 #325). + - Fix BBR end of startup phase detection (issue #328). + - Fix HTTP/3 v1 retry handling (issue #332) + - Fix memory leak when reset dcid (issue #333) + - Fix double decrement for ifc_active_cids_count (#334) + - Fix uninitialized value in frame_reader/frame_writer (#316) + - Remove a few overly strict asserts. + 2021-06-16 - 3.0.2 - Do not timeout connection if peer sends PING frames. diff --git a/docs/conf.py b/docs/conf.py index c25e1e4..2832dd8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,7 +26,7 @@ author = u'LiteSpeed Technologies' # The short X.Y version version = u'3.0' # The full version, including alpha/beta/rc tags -release = u'3.0.2' +release = u'3.0.3' # -- General configuration --------------------------------------------------- diff --git a/include/lsquic.h b/include/lsquic.h index efb0bb7..5e41915 100644 --- a/include/lsquic.h +++ b/include/lsquic.h @@ -25,7 +25,7 @@ extern "C" { #define LSQUIC_MAJOR_VERSION 3 #define LSQUIC_MINOR_VERSION 0 -#define LSQUIC_PATCH_VERSION 2 +#define LSQUIC_PATCH_VERSION 3 /** * Engine flags: @@ -1689,6 +1689,12 @@ lsquic_stream_id (const lsquic_stream_t *s); lsquic_stream_ctx_t * lsquic_stream_get_ctx (const lsquic_stream_t *s); +/** + * Set user-supplied context associated with the stream. + */ +void +lsquic_stream_set_ctx (lsquic_stream_t *stream, lsquic_stream_ctx_t *ctx); + /** Returns true if this is a pushed stream */ int lsquic_stream_is_pushed (const lsquic_stream_t *s); diff --git a/src/liblsquic/lsquic_enc_sess_ietf.c b/src/liblsquic/lsquic_enc_sess_ietf.c index 2773d48..fb9d5e7 100644 --- a/src/liblsquic/lsquic_enc_sess_ietf.c +++ b/src/liblsquic/lsquic_enc_sess_ietf.c @@ -572,7 +572,8 @@ gen_trans_params (struct enc_sess_iquic *enc_sess, unsigned char *buf, cce->cce_seqno = seqno + 1; cce->cce_flags = CCE_SEQNO; - enc_sess->esi_enpub->enp_generate_scid(enc_sess->esi_conn, + enc_sess->esi_enpub->enp_generate_scid( + enc_sess->esi_enpub->enp_gen_scid_ctx, enc_sess->esi_conn, &cce->cce_cid, enc_sess->esi_enpub->enp_settings.es_scid_len); /* Don't add to hash: migration must not start until *after* @@ -2638,6 +2639,7 @@ iquic_esfi_reset_dcid (enc_session_t *enc_session_p, pair = &enc_sess->esi_hsk_pairs[ENC_LEV_CLEAR]; cleanup_crypto_ctx(&pair->ykp_ctx[0]); cleanup_crypto_ctx(&pair->ykp_ctx[1]); + cleanup_hp(&enc_sess->esi_hsk_hps[ENC_LEV_CLEAR]); if (0 == setup_handshake_keys(enc_sess, new_dcid)) { diff --git a/src/liblsquic/lsquic_full_conn_ietf.c b/src/liblsquic/lsquic_full_conn_ietf.c index b6f22de..a0c1b8e 100644 --- a/src/liblsquic/lsquic_full_conn_ietf.c +++ b/src/liblsquic/lsquic_full_conn_ietf.c @@ -6353,9 +6353,9 @@ process_retire_connection_id_frame (struct ietf_full_conn *conn, && (cce->cce_flags & CCE_SEQNO) && cce->cce_seqno == seqno)) break; - + /* NOTE: https://github.com/litespeedtech/lsquic/issues/334 conn->ifc_active_cids_count -= seqno >= conn->ifc_first_active_cid_seqno; - + */ if (cce < END_OF_CCES(lconn)) { if (LSQUIC_CIDS_EQ(&cce->cce_cid, &packet_in->pi_dcid)) diff --git a/src/liblsquic/lsquic_ietf.h b/src/liblsquic/lsquic_ietf.h index d438de7..0f7ed2f 100644 --- a/src/liblsquic/lsquic_ietf.h +++ b/src/liblsquic/lsquic_ietf.h @@ -38,7 +38,7 @@ extern const unsigned char *const lsquic_retry_key_buf[N_IETF_RETRY_VERSIONS]; extern const unsigned char *const lsquic_retry_nonce_buf[N_IETF_RETRY_VERSIONS]; #define lsquic_version_2_retryver(ver_) ( \ (ver_) <= LSQVER_ID27 ? 0 : \ - (ver_) < LSQVER_I001 ? 1 : \ + (ver_) < LSQVER_I001 ? 1 : \ 2) #endif diff --git a/src/liblsquic/lsquic_packet_out.c b/src/liblsquic/lsquic_packet_out.c index a402404..271e3c8 100644 --- a/src/liblsquic/lsquic_packet_out.c +++ b/src/liblsquic/lsquic_packet_out.c @@ -454,8 +454,11 @@ lsquic_packet_out_turn_on_fin (struct lsquic_packet_out *packet_out, { len = pf->pf_parse_stream_frame(packet_out->po_data + frec->fe_off, frec->fe_len, &stream_frame); - assert(len >= 0); - if (len < 0) + + // Got a corner case because of short write, df_size == 0 && df_fin == 0 + // It is OK to just turn on the fin bit. + assert(len >= 0 || frec->fe_len == 5); + if (len < 0 && stream_frame.data_frame.df_size != 0) return -1; last_offset = stream_frame.data_frame.df_offset + stream_frame.data_frame.df_size; diff --git a/src/liblsquic/lsquic_parse_ietf_v1.c b/src/liblsquic/lsquic_parse_ietf_v1.c index 69c1542..0266e19 100644 --- a/src/liblsquic/lsquic_parse_ietf_v1.c +++ b/src/liblsquic/lsquic_parse_ietf_v1.c @@ -386,7 +386,8 @@ ietf_v1_gen_stream_frame (unsigned char *buf, size_t buf_len, /* Read as much as we can */ nr = gsf_read(stream, p + dlen, size, &fin); - assert(nr != 0); + if (nr == 0) + return 0; assert(nr <= size); if (dlen) diff --git a/src/liblsquic/lsquic_stream.c b/src/liblsquic/lsquic_stream.c index b68aaed..da1861d 100644 --- a/src/liblsquic/lsquic_stream.c +++ b/src/liblsquic/lsquic_stream.c @@ -3108,7 +3108,7 @@ write_stream_frame (struct frame_gen_ctx *fg_ctx, const size_t size, lsquic_packet_out_avail(packet_out), stream->id, stream->tosend_off, fg_ctx->fgc_fin(fg_ctx), size, fg_ctx->fgc_read, fg_ctx); - if (len < 0) + if (len <= 0) return len; #if LSQUIC_CONN_STATS @@ -3223,7 +3223,8 @@ stream_write_to_packet_std (struct frame_gen_ctx *fg_ctx, const size_t size) len = write_stream_frame(fg_ctx, size, packet_out); if (len > 0) return SWTP_OK; - assert(len < 0); + if (len == 0) + return SWTP_STOP; if (-len > (int) need_at_least) { LSQ_DEBUG("need more room (%d bytes) than initially calculated " @@ -4617,6 +4618,13 @@ lsquic_stream_get_ctx (const lsquic_stream_t *stream) } +void +lsquic_stream_set_ctx (lsquic_stream_t *stream, lsquic_stream_ctx_t *ctx) +{ + stream->st_ctx = ctx; +} + + int lsquic_stream_refuse_push (lsquic_stream_t *stream) { @@ -5067,7 +5075,8 @@ hq_filter_df (struct lsquic_stream *stream, struct data_frame *data_frame) (unsigned) data_frame->df_size - data_frame->df_read_off); else { - if (!(filter->hqfi_type == HQFT_HEADERS + if (!((filter->hqfi_type == HQFT_HEADERS + || filter->hqfi_type == HQFT_PUSH_PROMISE) && (filter->hqfi_flags & HQFI_FLAG_BLOCKED))) assert(data_frame->df_read_off == data_frame->df_size); return 0; diff --git a/src/liblsquic/lsquic_version.c b/src/liblsquic/lsquic_version.c index c643cb7..ac2bb1a 100644 --- a/src/liblsquic/lsquic_version.c +++ b/src/liblsquic/lsquic_version.c @@ -58,6 +58,17 @@ const char *const lsquic_ver2str[N_LSQVER] = { }; +const char *const lsquic_ver2altstr[N_LSQVER] = { + [LSQVER_043] = NULL, + [LSQVER_046] = NULL, + [LSQVER_050] = NULL, + [LSQVER_ID27] = "h3-27", + [LSQVER_ID29] = "h3-29", + [LSQVER_I001] = "h3", + [LSQVER_VERNEG] = "VERNEG", +}; + + enum lsquic_version lsquic_str2ver (const char *str, size_t len) { @@ -71,12 +82,18 @@ lsquic_str2ver (const char *str, size_t len) } for (ver = 0; ver < N_LSQVER; ++ver) + { if (strlen(lsquic_ver2str[ver]) == len && strncasecmp(lsquic_ver2str[ver], str, len) == 0) { return ver; } - + if (lsquic_ver2altstr[ver] && strlen(lsquic_ver2altstr[ver]) == len + && strncasecmp(lsquic_ver2altstr[ver], str, len) == 0) + { + return ver; + } + } return -1; }