From e237d779199dab262c54d104238006efa9abd766 Mon Sep 17 00:00:00 2001 From: George Wang Date: Wed, 27 Apr 2022 15:40:59 -0400 Subject: [PATCH] Release 3.0.5 --- src/liblsquic/lsquic_enc_sess_ietf.c | 4 +-- src/liblsquic/lsquic_full_conn_ietf.c | 5 ++-- src/liblsquic/lsquic_handshake.c | 42 +++++++++++++-------------- src/liblsquic/lsquic_parse_common.h | 5 ---- src/liblsquic/lsquic_qdec_hdl.c | 4 --- src/liblsquic/lsquic_stream.c | 3 +- 6 files changed, 28 insertions(+), 35 deletions(-) diff --git a/src/liblsquic/lsquic_enc_sess_ietf.c b/src/liblsquic/lsquic_enc_sess_ietf.c index fb9d5e7..115cd9f 100644 --- a/src/liblsquic/lsquic_enc_sess_ietf.c +++ b/src/liblsquic/lsquic_enc_sess_ietf.c @@ -1654,9 +1654,9 @@ check_server_tps_for_violations (const struct enc_sess_iquic *enc_sess, for (tpi = 0; tpi <= MAX_NUMERIC_TPI; ++tpi) if ((1 << tpi) & REDUCTION_PROHIBITED_TPS) - if (new_params->tp_numerics[tpi] > params_0rtt->tp_numerics[tpi]) + if (new_params->tp_numerics[tpi] < params_0rtt->tp_numerics[tpi]) { - LSQ_INFO("server's new TP %s increased in value from %"PRIu64 + LSQ_INFO("server's new TP %s decreased in value from %"PRIu64 " to %"PRIu64, lsquic_tpi2str[tpi], params_0rtt->tp_numerics[tpi], new_params->tp_numerics[tpi]); diff --git a/src/liblsquic/lsquic_full_conn_ietf.c b/src/liblsquic/lsquic_full_conn_ietf.c index b3fe124..15231b9 100644 --- a/src/liblsquic/lsquic_full_conn_ietf.c +++ b/src/liblsquic/lsquic_full_conn_ietf.c @@ -2900,11 +2900,12 @@ ietf_full_conn_ci_want_datagram_write (struct lsquic_conn *lconn, int is_want) if (conn->ifc_flags & IFC_DATAGRAMS) { old = !!(conn->ifc_mflags & MF_WANT_DATAGRAM_WRITE); - if (is_want) { + if (is_want) + { conn->ifc_mflags |= MF_WANT_DATAGRAM_WRITE; if (lsquic_send_ctl_can_send (&conn->ifc_send_ctl)) lsquic_engine_add_conn_to_tickable(conn->ifc_enpub, - &conn->ifc_conn); + &conn->ifc_conn); } else conn->ifc_mflags &= ~MF_WANT_DATAGRAM_WRITE; diff --git a/src/liblsquic/lsquic_handshake.c b/src/liblsquic/lsquic_handshake.c index f9f4800..4298141 100644 --- a/src/liblsquic/lsquic_handshake.c +++ b/src/liblsquic/lsquic_handshake.c @@ -1816,23 +1816,23 @@ get_valid_scfg (const struct lsquic_enc_session *enc_session, unsigned msg_len, server_config_sz; struct message_writer mw; - if (enc_session->enpub->enp_server_config->lsc_scfg && (enc_session->enpub->enp_server_config->lsc_scfg->info.expy > (uint64_t)t)) - return enc_session->enpub->enp_server_config; + if (enpub->enp_server_config->lsc_scfg && (enpub->enp_server_config->lsc_scfg->info.expy > (uint64_t)t)) + return enpub->enp_server_config; ret = shi->shi_lookup(shi_ctx, SERVER_SCFG_KEY, SERVER_SCFG_KEY_SIZE, &scfg_ptr, &real_len); if (ret == 1) { if (config_has_correct_size(enc_session, scfg_ptr, real_len) && - (enc_session->enpub->enp_server_config->lsc_scfg = scfg_ptr, - enc_session->enpub->enp_server_config->lsc_scfg->info.expy > (uint64_t)t)) + (enpub->enp_server_config->lsc_scfg = scfg_ptr, + enpub->enp_server_config->lsc_scfg->info.expy > (uint64_t)t)) { /* Why need to init here, because this memory may be read from SHM, * the struct is ready but AEAD_CTX is not ready. **/ - EVP_AEAD_CTX_init(&enc_session->enpub->enp_server_config->lsc_stk_ctx, EVP_aead_aes_128_gcm(), - enc_session->enpub->enp_server_config->lsc_scfg->info.skt_key, 16, 12, NULL); - return enc_session->enpub->enp_server_config; + EVP_AEAD_CTX_init(&enpub->enp_server_config->lsc_stk_ctx, EVP_aead_aes_128_gcm(), + enpub->enp_server_config->lsc_scfg->info.skt_key, 16, 12, NULL); + return enpub->enp_server_config; } else { @@ -1850,12 +1850,12 @@ get_valid_scfg (const struct lsquic_enc_session *enc_session, MSG_LEN_ADD(msg_len, sizeof(temp_scfg->orbt)); MSG_LEN_ADD(msg_len, sizeof(temp_scfg->expy)); - server_config_sz = sizeof(*enc_session->enpub->enp_server_config->lsc_scfg) + MSG_LEN_VAL(msg_len); - enc_session->enpub->enp_server_config->lsc_scfg = malloc(server_config_sz); - if (!enc_session->enpub->enp_server_config->lsc_scfg) + server_config_sz = sizeof(*enpub->enp_server_config->lsc_scfg) + MSG_LEN_VAL(msg_len); + enpub->enp_server_config->lsc_scfg = malloc(server_config_sz); + if (!enpub->enp_server_config->lsc_scfg) return NULL; - temp_scfg = &enc_session->enpub->enp_server_config->lsc_scfg->info; + temp_scfg = &enpub->enp_server_config->lsc_scfg->info; RAND_bytes(temp_scfg->skt_key, sizeof(temp_scfg->skt_key)); RAND_bytes(temp_scfg->sscid, sizeof(temp_scfg->sscid)); RAND_bytes(temp_scfg->priv_key, sizeof(temp_scfg->priv_key)); @@ -1866,7 +1866,7 @@ get_valid_scfg (const struct lsquic_enc_session *enc_session, temp_scfg->orbt = 0; temp_scfg->expy = t + settings->es_sttl; - MW_BEGIN(&mw, QTAG_SCFG, 8, enc_session->enpub->enp_server_config->lsc_scfg->scfg); + MW_BEGIN(&mw, QTAG_SCFG, 8, enpub->enp_server_config->lsc_scfg->scfg); MW_WRITE_BUFFER(&mw, QTAG_VER, enpub->enp_ver_tags_buf, enpub->enp_ver_tags_len); MW_WRITE_UINT32(&mw, QTAG_AEAD, temp_scfg->aead); @@ -1877,7 +1877,7 @@ get_valid_scfg (const struct lsquic_enc_session *enc_session, MW_WRITE_UINT64(&mw, QTAG_ORBT, temp_scfg->orbt); MW_WRITE_UINT64(&mw, QTAG_EXPY, temp_scfg->expy); MW_END(&mw); - assert(MW_P(&mw) == enc_session->enpub->enp_server_config->lsc_scfg->scfg + MSG_LEN_VAL(msg_len)); + assert(MW_P(&mw) == enpub->enp_server_config->lsc_scfg->scfg + MSG_LEN_VAL(msg_len)); temp_scfg->scfg_len = MSG_LEN_VAL(msg_len); @@ -1887,17 +1887,17 @@ get_valid_scfg (const struct lsquic_enc_session *enc_session, // shi->shi_delete(shi_ctx, SERVER_SCFG_KEY, SERVER_SCFG_KEY_SIZE); void *scfg_key = strdup(SERVER_SCFG_KEY); shi->shi_insert(shi_ctx, scfg_key, SERVER_SCFG_KEY_SIZE, - enc_session->enpub->enp_server_config->lsc_scfg, server_config_sz, t + settings->es_sttl); + enpub->enp_server_config->lsc_scfg, server_config_sz, t + settings->es_sttl); ret = shi->shi_lookup(shi_ctx, scfg_key, SERVER_SCFG_KEY_SIZE, &scfg_ptr, &real_len); if (ret == 1) { tmp_scfg_copy = scfg_ptr; - if (tmp_scfg_copy != enc_session->enpub->enp_server_config->lsc_scfg) + if (tmp_scfg_copy != enpub->enp_server_config->lsc_scfg) { - free(enc_session->enpub->enp_server_config->lsc_scfg); - enc_session->enpub->enp_server_config->lsc_scfg = tmp_scfg_copy; + free(enpub->enp_server_config->lsc_scfg); + enpub->enp_server_config->lsc_scfg = tmp_scfg_copy; } } else @@ -1906,12 +1906,12 @@ get_valid_scfg (const struct lsquic_enc_session *enc_session, LSQ_DEBUG("get_valid_scfg got an shi internal error.\n"); } - ret = EVP_AEAD_CTX_init(&enc_session->enpub->enp_server_config->lsc_stk_ctx, EVP_aead_aes_128_gcm(), - enc_session->enpub->enp_server_config->lsc_scfg->info.skt_key, - sizeof(enc_session->enpub->enp_server_config->lsc_scfg->info.skt_key), 12, NULL); + ret = EVP_AEAD_CTX_init(&enpub->enp_server_config->lsc_stk_ctx, EVP_aead_aes_128_gcm(), + enpub->enp_server_config->lsc_scfg->info.skt_key, + sizeof(enpub->enp_server_config->lsc_scfg->info.skt_key), 12, NULL); LSQ_DEBUG("get_valid_scfg::EVP_AEAD_CTX_init return %d.", ret); - return enc_session->enpub->enp_server_config; + return enpub->enp_server_config; } diff --git a/src/liblsquic/lsquic_parse_common.h b/src/liblsquic/lsquic_parse_common.h index 30ffb9b..f1d051d 100644 --- a/src/liblsquic/lsquic_parse_common.h +++ b/src/liblsquic/lsquic_parse_common.h @@ -68,11 +68,6 @@ int lsquic_ietf_v1_gen_ver_nego_pkt (unsigned char *buf, size_t bufsz, const lsquic_cid_t *scid, const lsquic_cid_t *dcid, unsigned versions, uint8_t); -int -lsquic_iquic_gen_retry_pkt (unsigned char *buf, size_t bufsz, - const struct lsquic_engine_public *, const lsquic_cid_t *scid, - const lsquic_cid_t *dcid, enum lsquic_version, const struct sockaddr *, - uint8_t random_nybble); #define GQUIC_RESET_SZ 33 ssize_t diff --git a/src/liblsquic/lsquic_qdec_hdl.c b/src/liblsquic/lsquic_qdec_hdl.c index e8c50de..73381a5 100644 --- a/src/liblsquic/lsquic_qdec_hdl.c +++ b/src/liblsquic/lsquic_qdec_hdl.c @@ -452,10 +452,6 @@ static void qdh_hblock_unblocked (void *stream_p) { struct lsquic_stream *const stream = stream_p; - union hblock_ctx *const u = stream->sm_hblock_ctx; - struct qpack_dec_hdl *qdh = u->ctx.qdh; - - LSQ_DEBUG("header block for stream %"PRIu64" unblocked", stream->id); lsquic_stream_qdec_unblocked(stream); } diff --git a/src/liblsquic/lsquic_stream.c b/src/liblsquic/lsquic_stream.c index 90dbfaf..906497d 100644 --- a/src/liblsquic/lsquic_stream.c +++ b/src/liblsquic/lsquic_stream.c @@ -2392,7 +2392,8 @@ lsquic_stream_dispatch_write_events (lsquic_stream_t *stream) unsigned short n_buffered; enum stream_q_flags q_flags; - if (!(stream->sm_qflags & SMQF_WRITE_Q_FLAGS)) + if (!(stream->sm_qflags & SMQF_WRITE_Q_FLAGS) + || (stream->stream_flags & STREAM_FINISHED)) return; q_flags = stream->sm_qflags & SMQF_WRITE_Q_FLAGS;