diff --git a/CHANGELOG b/CHANGELOG index caf6479..c93f71b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +2020-09-23 + - 2.20.1 + - [BUGFIX] Typo in new "validate peer addr by DCID" code. It is + a benign bug (works either way), but better to fix it. + - Simplify Stream Priority Iterator (SPI). + - Minor documentation updates. + 2020-09-15 - 2.20.0 - [FEATURE] QUIC and HTTP/3 Internet Draft 30 support. @@ -6,7 +13,7 @@ - [BUGFIX] Do not send MAX_STREAM_DATA frames on crypto streams. - [BUGFIX] Fail with CRYPTO_BUFFER_EXCEEDED when too much CRYPTO data comes in. - - [BUFFIX] Spin bit is now strictly per path; value is reset on + - [BUGFIX] Spin bit is now strictly per path; value is reset on DCID change. - [BUGFIX] Check that max value of max_streams_uni and max_streams_bidi TPs is 2^60. diff --git a/docs/apiref.rst b/docs/apiref.rst index 7113af2..bce76eb 100644 --- a/docs/apiref.rst +++ b/docs/apiref.rst @@ -52,7 +52,7 @@ developed by the IETF. Both types are included in a single enum: .. member:: LSQVER_ID28 - IETF QUIC version ID 28 + IETF QUIC version ID 28; this version is deprecated. .. member:: LSQVER_ID29 diff --git a/docs/conf.py b/docs/conf.py index 131098d..1ebcd55 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,7 +26,7 @@ author = u'LiteSpeed Technologies' # The short X.Y version version = u'2.20' # The full version, including alpha/beta/rc tags -release = u'2.20.0' +release = u'2.20.1' # -- General configuration --------------------------------------------------- diff --git a/include/lsquic.h b/include/lsquic.h index f80f580..5cf5ea4 100644 --- a/include/lsquic.h +++ b/include/lsquic.h @@ -25,7 +25,7 @@ extern "C" { #define LSQUIC_MAJOR_VERSION 2 #define LSQUIC_MINOR_VERSION 20 -#define LSQUIC_PATCH_VERSION 0 +#define LSQUIC_PATCH_VERSION 1 /** * Engine flags: @@ -82,7 +82,7 @@ enum lsquic_version LSQVER_ID27, /** - * IETF QUIC Draft-28 + * IETF QUIC Draft-28; this version is deprecated. */ LSQVER_ID28, diff --git a/src/liblsquic/lsquic_full_conn.c b/src/liblsquic/lsquic_full_conn.c index 75f9bdf..96e63ba 100644 --- a/src/liblsquic/lsquic_full_conn.c +++ b/src/liblsquic/lsquic_full_conn.c @@ -2867,7 +2867,7 @@ process_streams_ready_to_send (struct full_conn *conn) lsquic_spi_init(&spi, TAILQ_FIRST(&conn->fc_pub.sending_streams), TAILQ_LAST(&conn->fc_pub.sending_streams, lsquic_streams_tailq), (uintptr_t) &TAILQ_NEXT((lsquic_stream_t *) NULL, next_send_stream), - SMQF_SENDING_FLAGS, &conn->fc_conn, "send", NULL, NULL); + &conn->fc_conn, "send", NULL, NULL); for (stream = lsquic_spi_first(&spi); stream; stream = lsquic_spi_next(&spi)) @@ -3055,7 +3055,7 @@ process_streams_read_events (struct full_conn *conn) lsquic_spi_init(&spi, TAILQ_FIRST(&conn->fc_pub.read_streams), TAILQ_LAST(&conn->fc_pub.read_streams, lsquic_streams_tailq), (uintptr_t) &TAILQ_NEXT((lsquic_stream_t *) NULL, next_read_stream), - SMQF_WANT_READ, &conn->fc_conn, "read", NULL, NULL); + &conn->fc_conn, "read", NULL, NULL); needs_service = 0; for (stream = lsquic_spi_first(&spi); stream; @@ -3082,7 +3082,7 @@ process_streams_read_events (struct full_conn *conn) lsquic_spi_init(&spi, TAILQ_FIRST(&conn->fc_pub.read_streams), TAILQ_LAST(&conn->fc_pub.read_streams, lsquic_streams_tailq), (uintptr_t) &TAILQ_NEXT((lsquic_stream_t *) NULL, next_read_stream), - SMQF_WANT_READ, &conn->fc_conn, "read-new", + &conn->fc_conn, "read-new", filter_out_old_streams, &fctx); for (stream = lsquic_spi_first(&spi); stream; stream = lsquic_spi_next(&spi)) @@ -3114,7 +3114,7 @@ process_streams_write_events (struct full_conn *conn, int high_prio) lsquic_spi_init(&spi, TAILQ_FIRST(&conn->fc_pub.write_streams), TAILQ_LAST(&conn->fc_pub.write_streams, lsquic_streams_tailq), (uintptr_t) &TAILQ_NEXT((lsquic_stream_t *) NULL, next_write_stream), - SMQF_WANT_WRITE|SMQF_WANT_FLUSH, &conn->fc_conn, + &conn->fc_conn, high_prio ? "write-high" : "write-low", NULL, NULL); if (high_prio) diff --git a/src/liblsquic/lsquic_full_conn_ietf.c b/src/liblsquic/lsquic_full_conn_ietf.c index cee9c51..f3b2c9f 100644 --- a/src/liblsquic/lsquic_full_conn_ietf.c +++ b/src/liblsquic/lsquic_full_conn_ietf.c @@ -2714,7 +2714,7 @@ process_streams_ready_to_send (struct ietf_full_conn *conn) lsquic_spi_init(&spi, TAILQ_FIRST(&conn->ifc_pub.sending_streams), TAILQ_LAST(&conn->ifc_pub.sending_streams, lsquic_streams_tailq), (uintptr_t) &TAILQ_NEXT((lsquic_stream_t *) NULL, next_send_stream), - SMQF_SENDING_FLAGS, &conn->ifc_conn, "send", NULL, NULL); + &conn->ifc_conn, "send", NULL, NULL); for (stream = lsquic_spi_first(&spi); stream; stream = lsquic_spi_next(&spi)) @@ -3960,7 +3960,7 @@ process_streams_read_events (struct ietf_full_conn *conn) lsquic_spi_init(&spi, TAILQ_FIRST(&conn->ifc_pub.read_streams), TAILQ_LAST(&conn->ifc_pub.read_streams, lsquic_streams_tailq), (uintptr_t) &TAILQ_NEXT((lsquic_stream_t *) NULL, next_read_stream), - SMQF_WANT_READ, &conn->ifc_conn, labels[iters], NULL, NULL); + &conn->ifc_conn, labels[iters], NULL, NULL); needs_service = 0; for (stream = lsquic_spi_first(&spi); stream; @@ -4047,7 +4047,7 @@ process_streams_write_events (struct ietf_full_conn *conn, int high_prio) lsquic_spi_init(&spi, TAILQ_FIRST(&conn->ifc_pub.write_streams), TAILQ_LAST(&conn->ifc_pub.write_streams, lsquic_streams_tailq), (uintptr_t) &TAILQ_NEXT((lsquic_stream_t *) NULL, next_write_stream), - SMQF_WANT_WRITE|SMQF_WANT_FLUSH, &conn->ifc_conn, + &conn->ifc_conn, high_prio ? "write-high" : "write-low", NULL, NULL); if (high_prio) diff --git a/src/liblsquic/lsquic_mini_conn_ietf.c b/src/liblsquic/lsquic_mini_conn_ietf.c index ab793a9..bf2329b 100644 --- a/src/liblsquic/lsquic_mini_conn_ietf.c +++ b/src/liblsquic/lsquic_mini_conn_ietf.c @@ -1242,7 +1242,7 @@ imico_maybe_validate_by_dcid (struct ietf_mini_conn *conn, if (dcid->len >= 8) /* Generic code with unnecessary loop as future-proofing */ for (i = 0; i < conn->imc_conn.cn_n_cces; ++i) - if ((conn->imc_conn.cn_cces_mask & (i << 1)) + if ((conn->imc_conn.cn_cces_mask & (1 << i)) && (conn->imc_conn.cn_cces[i].cce_flags & CCE_SEQNO) && LSQUIC_CIDS_EQ(&conn->imc_conn.cn_cces[i].cce_cid, dcid)) { diff --git a/src/liblsquic/lsquic_spi.c b/src/liblsquic/lsquic_spi.c index ed69c9c..184c66c 100644 --- a/src/liblsquic/lsquic_spi.c +++ b/src/liblsquic/lsquic_spi.c @@ -53,7 +53,7 @@ add_stream_to_spi (struct stream_prio_iter *iter, lsquic_stream_t *stream) void lsquic_spi_init (struct stream_prio_iter *iter, struct lsquic_stream *first, struct lsquic_stream *last, uintptr_t next_ptr_offset, - enum stream_q_flags onlist_mask, const struct lsquic_conn *conn, + const struct lsquic_conn *conn, const char *name, int (*filter)(void *filter_ctx, struct lsquic_stream *), void *filter_ctx) @@ -67,9 +67,7 @@ lsquic_spi_init (struct stream_prio_iter *iter, struct lsquic_stream *first, iter->spi_set[1] = 0; iter->spi_set[2] = 0; iter->spi_set[3] = 0; - iter->spi_onlist_mask = onlist_mask; iter->spi_cur_prio = 0; - iter->spi_prev_stream = NULL; iter->spi_next_stream = NULL; iter->spi_n_added = 0; @@ -195,41 +193,12 @@ find_and_set_next_priority (struct stream_prio_iter *iter) } -/* Each stream returned by the iterator is processed in some fashion. If, - * as a result of this, the stream gets taken off the original list, we - * have to follow suit and remove it from the iterator's set of streams. - */ -static void -maybe_evict_prev (struct stream_prio_iter *iter) -{ - unsigned set, bit; - - if (0 == (iter->spi_prev_stream->sm_qflags & iter->spi_onlist_mask)) - { - SPI_DEBUG("evict stream %"PRIu64, iter->spi_prev_stream->id); - TAILQ_REMOVE(&iter->spi_streams[ iter->spi_prev_prio ], - iter->spi_prev_stream, next_prio_stream); - if (TAILQ_EMPTY(&iter->spi_streams[ iter->spi_prev_prio ])) - { - set = iter->spi_prev_prio >> 6; - bit = iter->spi_prev_prio & 0x3F; - iter->spi_set[ set ] &= ~(1ULL << bit); - SPI_DEBUG("priority %u now has no elements", iter->spi_prev_prio); - } - iter->spi_prev_stream = NULL; - } -} - - lsquic_stream_t * lsquic_spi_first (struct stream_prio_iter *iter) { lsquic_stream_t *stream; unsigned set, bit; - if (iter->spi_prev_stream) - maybe_evict_prev(iter); - iter->spi_cur_prio = 0; set = iter->spi_cur_prio >> 6; bit = iter->spi_cur_prio & 0x3F; @@ -244,8 +213,6 @@ lsquic_spi_first (struct stream_prio_iter *iter) } stream = TAILQ_FIRST(&iter->spi_streams[ iter->spi_cur_prio ]); - iter->spi_prev_prio = iter->spi_cur_prio; - iter->spi_prev_stream = stream; iter->spi_next_stream = TAILQ_NEXT(stream, next_prio_stream); if (LSQ_LOG_ENABLED(LSQ_LOG_DEBUG) && !lsquic_stream_is_critical(stream)) SPI_DEBUG("%s: return stream %"PRIu64", priority %u", __func__, @@ -259,14 +226,9 @@ lsquic_spi_next (struct stream_prio_iter *iter) { lsquic_stream_t *stream; - if (iter->spi_prev_stream) - maybe_evict_prev(iter); - stream = iter->spi_next_stream; if (stream) { - assert(iter->spi_prev_prio == iter->spi_cur_prio); - iter->spi_prev_stream = stream; iter->spi_next_stream = TAILQ_NEXT(stream, next_prio_stream); if (LSQ_LOG_ENABLED(LSQ_LOG_DEBUG) && !lsquic_stream_is_critical(stream)) SPI_DEBUG("%s: return stream %"PRIu64", priority %u", __func__, @@ -281,8 +243,6 @@ lsquic_spi_next (struct stream_prio_iter *iter) } stream = TAILQ_FIRST(&iter->spi_streams[ iter->spi_cur_prio ]); - iter->spi_prev_prio = iter->spi_cur_prio; - iter->spi_prev_stream = stream; iter->spi_next_stream = TAILQ_NEXT(stream, next_prio_stream); if (LSQ_LOG_ENABLED(LSQ_LOG_DEBUG) && !lsquic_stream_is_critical(stream)) diff --git a/src/liblsquic/lsquic_spi.h b/src/liblsquic/lsquic_spi.h index a91a4c0..de8b491 100644 --- a/src/liblsquic/lsquic_spi.h +++ b/src/liblsquic/lsquic_spi.h @@ -22,12 +22,9 @@ struct stream_prio_iter const struct lsquic_conn *spi_conn; /* Used for logging */ const char *spi_name; /* Used for logging */ uint64_t spi_set[4]; /* 256 bits */ - enum stream_q_flags spi_onlist_mask; unsigned spi_n_added; unsigned char spi_cur_prio; - unsigned char spi_prev_prio; - struct lsquic_stream *spi_prev_stream, - *spi_next_stream; + struct lsquic_stream *spi_next_stream; struct lsquic_streams_tailq spi_streams[256]; }; @@ -35,7 +32,7 @@ struct stream_prio_iter void lsquic_spi_init (struct stream_prio_iter *, struct lsquic_stream *first, struct lsquic_stream *last, uintptr_t next_ptr_offset, - enum stream_q_flags onlist_mask, const struct lsquic_conn *, + const struct lsquic_conn *, const char *name, int (*filter)(void *filter_ctx, struct lsquic_stream *), void *filter_ctx); diff --git a/tests/test_spi.c b/tests/test_spi.c index 7f35fd4..edf341e 100644 --- a/tests/test_spi.c +++ b/tests/test_spi.c @@ -62,23 +62,18 @@ test_same_priority (unsigned priority) new_stream(priority), }; struct lsquic_streams_tailq streams; - unsigned flags = 0xF00; /* Arbitrary value */ lsquic_stream_t *stream; TAILQ_INIT(&streams); TAILQ_INSERT_TAIL(&streams, stream_arr[0], next_write_stream); - stream_arr[0]->sm_qflags |= flags; TAILQ_INSERT_TAIL(&streams, stream_arr[1], next_write_stream); - stream_arr[1]->sm_qflags |= flags; TAILQ_INSERT_TAIL(&streams, stream_arr[2], next_write_stream); - stream_arr[2]->sm_qflags |= flags; TAILQ_INSERT_TAIL(&streams, stream_arr[3], next_write_stream); - stream_arr[3]->sm_qflags |= flags; lsquic_spi_init(&spi, TAILQ_FIRST(&streams), TAILQ_LAST(&streams, lsquic_streams_tailq), (uintptr_t) &TAILQ_NEXT((lsquic_stream_t *) NULL, next_write_stream), - flags, &lconn, __func__, NULL, NULL); + &lconn, __func__, NULL, NULL); stream = lsquic_spi_first(&spi); assert(stream == stream_arr[0]); @@ -94,7 +89,7 @@ test_same_priority (unsigned priority) /* Test reinitialization: */ lsquic_spi_init(&spi, stream_arr[0], stream_arr[1], (uintptr_t) &TAILQ_NEXT((lsquic_stream_t *) NULL, next_write_stream), - flags, &lconn, __func__, NULL, NULL); + &lconn, __func__, NULL, NULL); stream = lsquic_spi_first(&spi); assert(stream == stream_arr[0]); stream = lsquic_spi_next(&spi); @@ -110,7 +105,6 @@ static void test_different_priorities (int *priority) { struct lsquic_streams_tailq streams; - unsigned flags = 0xC000; /* Arbitrary value */ lsquic_stream_t *stream; int prio, prev_prio, count, n_streams = 0; @@ -121,15 +115,13 @@ test_different_priorities (int *priority) assert(*priority < 256); stream = new_stream(*priority); TAILQ_INSERT_TAIL(&streams, stream, next_send_stream); - stream->sm_qflags |= flags; ++n_streams; } lsquic_spi_init(&spi, TAILQ_FIRST(&streams), TAILQ_LAST(&streams, lsquic_streams_tailq), (uintptr_t) &TAILQ_NEXT((lsquic_stream_t *) NULL, next_send_stream), - flags, &lconn, __func__, NULL, NULL); - + &lconn, __func__, NULL, NULL); for (prev_prio = -1, count = 0, stream = lsquic_spi_first(&spi); stream; stream = lsquic_spi_next(&spi), ++count) { @@ -222,7 +214,7 @@ test_drop (const struct drop_test *test) lsquic_spi_init(&spi, TAILQ_FIRST(&streams), TAILQ_LAST(&streams, lsquic_streams_tailq), (uintptr_t) &TAILQ_NEXT((lsquic_stream_t *) NULL, next_write_stream), - SMQF_WRITE_Q_FLAGS, &lconn, __func__, NULL, NULL); + &lconn, __func__, NULL, NULL); if (drop_high) lsquic_spi_drop_high(&spi); @@ -265,7 +257,6 @@ static void test_different_priorities_filter_odd (int *priority) { struct lsquic_streams_tailq streams; - unsigned flags = 0xC000; /* Arbitrary value */ lsquic_stream_t *stream; int prio, prev_prio, count, n_streams = 0; @@ -276,7 +267,6 @@ test_different_priorities_filter_odd (int *priority) assert(*priority < 256); stream = new_stream(*priority); TAILQ_INSERT_TAIL(&streams, stream, next_send_stream); - stream->stream_flags |= flags; ++n_streams; } @@ -285,7 +275,7 @@ test_different_priorities_filter_odd (int *priority) lsquic_spi_init(&spi, TAILQ_FIRST(&streams), TAILQ_LAST(&streams, lsquic_streams_tailq), (uintptr_t) &TAILQ_NEXT((lsquic_stream_t *) NULL, next_send_stream), - flags, &lconn, __func__, filter_out_odd_priorities, &my_filter_ctx); + &lconn, __func__, filter_out_odd_priorities, &my_filter_ctx); for (prev_prio = -1, count = 0, stream = lsquic_spi_first(&spi); stream; stream = lsquic_spi_next(&spi), ++count)