Skip to content

Commit a18ccca

Browse files
committed
Release 4.0.2
1 parent b81a3fb commit a18ccca

20 files changed

+116
-78
lines changed

CHANGELOG

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2023-12-19
2+
- 4.0.2
3+
- More strict RFC compliance.
4+
- Minimize packet generated when send STREAM_BLOCKED frame
5+
- Fix memory management bugs.
6+
- Fix memory leak in unit tests.
7+
18
2023-05-14
29
- 4.0.1
310
- Fix send_ctl bug.

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ ENDIF()
272272
SET(LIBS lsquic ${BORINGSSL_LIB_ssl} ${BORINGSSL_LIB_crypto} ${ZLIB_LIB} ${LIBS})
273273

274274
IF (LSQUIC_BIN)
275-
FIND_PATH(EVENT_INCLUDE_DIR NAMES event2/event.h)
275+
FIND_PATH(EVENT_INCLUDE_DIR NAMES event2/event.h
276+
PATHS ${PROJECT_SOURCE_DIR}/../third-party/include)
276277
IF (EVENT_INCLUDE_DIR)
277278
INCLUDE_DIRECTORIES(${EVENT_INCLUDE_DIR})
278279
ELSE()
@@ -285,7 +286,8 @@ IF (LSQUIC_BIN)
285286
IF (CMAKE_SYSTEM_NAME STREQUAL Windows)
286287
FIND_LIBRARY(EVENT_LIB event)
287288
ELSE()
288-
FIND_LIBRARY(EVENT_LIB libevent${LIB_SUFFIX})
289+
FIND_LIBRARY(EVENT_LIB libevent${LIB_SUFFIX}
290+
PATHS ${PROJECT_SOURCE_DIR}/../third-party/lib)
289291
IF(NOT EVENT_LIB)
290292
FIND_LIBRARY(EVENT_LIB libevent.so)
291293
ENDIF()

bin/http_client.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,10 @@ http_client_on_conn_closed (lsquic_conn_t *conn)
348348
if (conn_h->client_ctx->hcc_flags & HCC_ABORT_ON_INCOMPLETE)
349349
{
350350
if (!(conn_h->client_ctx->hcc_flags & HCC_SEEN_FIN))
351-
abort();
351+
{
352+
LSQ_INFO("abort incomplete connection");
353+
exit(1);
354+
}
352355
}
353356
--conn_h->client_ctx->hcc_n_open_conns;
354357

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.1'
29+
release = u'4.0.2'
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 1
30+
#define LSQUIC_PATCH_VERSION 2
3131

3232
/**
3333
* Engine flags:

src/liblsquic/lsquic_di_hash.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,8 @@ hash_di_insert_frame (struct data_in *data_in,
438438
ins = lsquic_data_in_hash_insert_data_frame(data_in, data_frame,
439439
read_offset);
440440
assert(ins != INS_FRAME_OVERLAP);
441-
/* NOTE: other cases are handled by caller */
441+
/* NOTE: Only release packet and frame for INS_FRAME_OK,
442+
* other cases are handled by caller */
442443
if (ins == INS_FRAME_OK)
443444
{
444445
lsquic_packet_in_put(hdi->hdi_conn_pub->mm, new_frame->packet_in);

src/liblsquic/lsquic_engine.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3232,6 +3232,7 @@ lsquic_engine_packet_in (lsquic_engine_t *engine,
32323232
* by PI_OWN_DATA flag.
32333233
*/
32343234
packet_in->pi_data = (unsigned char *) packet_in_data;
3235+
packet_in->pi_pkt_size = packet_in_size;
32353236
if (0 != parse_packet_in_begin(packet_in, packet_end - packet_in_data,
32363237
engine->flags & ENG_SERVER,
32373238
engine->pub.enp_settings.es_scid_len, &ppstate))

src/liblsquic/lsquic_full_conn_ietf.c

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,46 +2491,6 @@ generate_max_stream_data_frame (struct ietf_full_conn *conn,
24912491
}
24922492

24932493

2494-
/* Return true if generated, false otherwise */
2495-
static int
2496-
generate_stream_blocked_frame (struct ietf_full_conn *conn,
2497-
struct lsquic_stream *stream)
2498-
{
2499-
struct lsquic_packet_out *packet_out;
2500-
unsigned need;
2501-
uint64_t off;
2502-
int sz;
2503-
2504-
off = lsquic_stream_combined_send_off(stream);
2505-
need = conn->ifc_conn.cn_pf->pf_stream_blocked_frame_size(stream->id, off);
2506-
packet_out = get_writeable_packet(conn, need);
2507-
if (!packet_out)
2508-
return 0;
2509-
sz = conn->ifc_conn.cn_pf->pf_gen_stream_blocked_frame(
2510-
packet_out->po_data + packet_out->po_data_sz,
2511-
lsquic_packet_out_avail(packet_out), stream->id, off);
2512-
if (sz < 0)
2513-
{
2514-
ABORT_ERROR("Generating STREAM_BLOCKED frame failed");
2515-
return 0;
2516-
}
2517-
LSQ_DEBUG("generated %d-byte STREAM_BLOCKED "
2518-
"frame; stream_id: %"PRIu64"; offset: %"PRIu64, sz, stream->id, off);
2519-
EV_LOG_CONN_EVENT(LSQUIC_LOG_CONN_ID, "generated %d-byte STREAM_BLOCKED "
2520-
"frame; stream_id: %"PRIu64"; offset: %"PRIu64, sz, stream->id, off);
2521-
if (0 != lsquic_packet_out_add_frame(packet_out, conn->ifc_pub.mm, 0,
2522-
QUIC_FRAME_STREAM_BLOCKED, packet_out->po_data_sz, sz))
2523-
{
2524-
ABORT_ERROR("adding frame to packet failed: %d", errno);
2525-
return 0;
2526-
}
2527-
lsquic_send_ctl_incr_pack_sz(&conn->ifc_send_ctl, packet_out, sz);
2528-
packet_out->po_frame_types |= 1 << QUIC_FRAME_STREAM_BLOCKED;
2529-
lsquic_stream_blocked_frame_sent(stream);
2530-
return 1;
2531-
}
2532-
2533-
25342494
static int
25352495
generate_stop_sending_frame_by_id (struct ietf_full_conn *conn,
25362496
lsquic_stream_id_t stream_id, enum http_error_code error_code)
@@ -2918,7 +2878,7 @@ process_stream_ready_to_send (struct ietf_full_conn *conn,
29182878
if (stream->sm_qflags & SMQF_SEND_MAX_STREAM_DATA)
29192879
r &= generate_max_stream_data_frame(conn, stream);
29202880
if (stream->sm_qflags & SMQF_SEND_BLOCKED)
2921-
r &= generate_stream_blocked_frame(conn, stream);
2881+
r &= lsquic_sendctl_gen_stream_blocked_frame(&conn->ifc_send_ctl, stream);
29222882
if (stream->sm_qflags & SMQF_SEND_RST)
29232883
r &= generate_rst_stream_frame(conn, stream);
29242884
if (stream->sm_qflags & SMQF_SEND_STOP_SENDING)

src/liblsquic/lsquic_mini_conn_ietf.c

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ ietf_mini_conn_ci_hsk_done (struct lsquic_conn *lconn,
734734
{
735735
case LSQ_HSK_OK:
736736
case LSQ_HSK_RESUMED_OK:
737-
conn->imc_flags |= IMC_HSK_OK;
737+
conn->imc_flags |= IMC_HSK_OK | IMC_IGNORE_INIT;
738738
conn->imc_conn.cn_flags |= LSCONN_HANDSHAKE_DONE;
739739
LSQ_DEBUG("handshake OK");
740740
break;
@@ -1436,6 +1436,14 @@ imico_parse_regular_packet (struct ietf_mini_conn *conn,
14361436
p = packet_in->pi_data + packet_in->pi_header_sz;
14371437
pend = packet_in->pi_data + packet_in->pi_data_sz;
14381438

1439+
if (p >= pend)
1440+
{
1441+
ietf_mini_conn_ci_abort_error(&conn->imc_conn, 0,
1442+
TEC_PROTOCOL_VIOLATION,
1443+
"packet %"PRIu64" has no frames",
1444+
packet_in->pi_packno);
1445+
return -1;
1446+
}
14391447
while (p < pend)
14401448
{
14411449
len = imico_process_packet_frame(conn, packet_in, p, pend - p);
@@ -1677,10 +1685,20 @@ ietf_mini_conn_ci_packet_in (struct lsquic_conn *lconn,
16771685
imico_maybe_validate_by_dcid(conn, &packet_in->pi_dcid);
16781686

16791687
pns = lsquic_hety2pns[ packet_in->pi_header_type ];
1680-
if (pns == PNS_INIT && (conn->imc_flags & IMC_IGNORE_INIT))
1688+
if (pns == PNS_INIT)
16811689
{
1682-
LSQ_DEBUG("ignore init packet"); /* Don't bother decrypting */
1683-
return;
1690+
if (conn->imc_flags & IMC_IGNORE_INIT)
1691+
{
1692+
LSQ_DEBUG("ignore init packet"); /* Don't bother decrypting */
1693+
return;
1694+
}
1695+
if (packet_in->pi_pkt_size
1696+
&& packet_in->pi_pkt_size < IQUIC_MIN_INIT_PACKET_SZ)
1697+
{
1698+
LSQ_DEBUG("ignore init packet smaller than minimum size required");
1699+
/* Don't bother decrypting */
1700+
return;
1701+
}
16841702
}
16851703

16861704
dec_packin = lconn->cn_esf_c->esf_decrypt_packet(lconn->cn_enc_session,
@@ -1718,7 +1736,15 @@ ietf_mini_conn_ci_packet_in (struct lsquic_conn *lconn,
17181736
return;
17191737
}
17201738
else if (pns == PNS_HSK)
1739+
{
1740+
if (!LSQUIC_CIDS_EQ(CN_SCID(&conn->imc_conn), &packet_in->pi_dcid))
1741+
{
1742+
ietf_mini_conn_ci_abort_error(lconn, 0, TEC_PROTOCOL_VIOLATION,
1743+
"protocol violation detected bad dcid for HSK pns");
1744+
return;
1745+
}
17211746
imico_peer_addr_validated(conn, "handshake PNS");
1747+
}
17221748

17231749
if (((conn->imc_flags >> IMCBIT_PNS_BIT_SHIFT) & 3) < pns)
17241750
{

0 commit comments

Comments
 (0)