mirror of
https://gitea.invidious.io/iv-org/litespeed-quic.git
synced 2024-08-15 00:53:43 +00:00
Release 4.0.2
This commit is contained in:
parent
b81a3fb15f
commit
a18ccca39e
20 changed files with 116 additions and 78 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 19863c2ed8bf28d648213460093d1991def4e643
|
||||
Subproject commit 521792711f2839f05565fd3dd617708cfb5b80ee
|
|
@ -438,7 +438,8 @@ hash_di_insert_frame (struct data_in *data_in,
|
|||
ins = lsquic_data_in_hash_insert_data_frame(data_in, data_frame,
|
||||
read_offset);
|
||||
assert(ins != INS_FRAME_OVERLAP);
|
||||
/* NOTE: other cases are handled by caller */
|
||||
/* NOTE: Only release packet and frame for INS_FRAME_OK,
|
||||
* other cases are handled by caller */
|
||||
if (ins == INS_FRAME_OK)
|
||||
{
|
||||
lsquic_packet_in_put(hdi->hdi_conn_pub->mm, new_frame->packet_in);
|
||||
|
|
|
@ -3232,6 +3232,7 @@ lsquic_engine_packet_in (lsquic_engine_t *engine,
|
|||
* by PI_OWN_DATA flag.
|
||||
*/
|
||||
packet_in->pi_data = (unsigned char *) packet_in_data;
|
||||
packet_in->pi_pkt_size = packet_in_size;
|
||||
if (0 != parse_packet_in_begin(packet_in, packet_end - packet_in_data,
|
||||
engine->flags & ENG_SERVER,
|
||||
engine->pub.enp_settings.es_scid_len, &ppstate))
|
||||
|
|
|
@ -2491,46 +2491,6 @@ generate_max_stream_data_frame (struct ietf_full_conn *conn,
|
|||
}
|
||||
|
||||
|
||||
/* Return true if generated, false otherwise */
|
||||
static int
|
||||
generate_stream_blocked_frame (struct ietf_full_conn *conn,
|
||||
struct lsquic_stream *stream)
|
||||
{
|
||||
struct lsquic_packet_out *packet_out;
|
||||
unsigned need;
|
||||
uint64_t off;
|
||||
int sz;
|
||||
|
||||
off = lsquic_stream_combined_send_off(stream);
|
||||
need = conn->ifc_conn.cn_pf->pf_stream_blocked_frame_size(stream->id, off);
|
||||
packet_out = get_writeable_packet(conn, need);
|
||||
if (!packet_out)
|
||||
return 0;
|
||||
sz = conn->ifc_conn.cn_pf->pf_gen_stream_blocked_frame(
|
||||
packet_out->po_data + packet_out->po_data_sz,
|
||||
lsquic_packet_out_avail(packet_out), stream->id, off);
|
||||
if (sz < 0)
|
||||
{
|
||||
ABORT_ERROR("Generating STREAM_BLOCKED frame failed");
|
||||
return 0;
|
||||
}
|
||||
LSQ_DEBUG("generated %d-byte STREAM_BLOCKED "
|
||||
"frame; stream_id: %"PRIu64"; offset: %"PRIu64, sz, stream->id, off);
|
||||
EV_LOG_CONN_EVENT(LSQUIC_LOG_CONN_ID, "generated %d-byte STREAM_BLOCKED "
|
||||
"frame; stream_id: %"PRIu64"; offset: %"PRIu64, sz, stream->id, off);
|
||||
if (0 != lsquic_packet_out_add_frame(packet_out, conn->ifc_pub.mm, 0,
|
||||
QUIC_FRAME_STREAM_BLOCKED, packet_out->po_data_sz, sz))
|
||||
{
|
||||
ABORT_ERROR("adding frame to packet failed: %d", errno);
|
||||
return 0;
|
||||
}
|
||||
lsquic_send_ctl_incr_pack_sz(&conn->ifc_send_ctl, packet_out, sz);
|
||||
packet_out->po_frame_types |= 1 << QUIC_FRAME_STREAM_BLOCKED;
|
||||
lsquic_stream_blocked_frame_sent(stream);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
generate_stop_sending_frame_by_id (struct ietf_full_conn *conn,
|
||||
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,
|
|||
if (stream->sm_qflags & SMQF_SEND_MAX_STREAM_DATA)
|
||||
r &= generate_max_stream_data_frame(conn, stream);
|
||||
if (stream->sm_qflags & SMQF_SEND_BLOCKED)
|
||||
r &= generate_stream_blocked_frame(conn, stream);
|
||||
r &= lsquic_sendctl_gen_stream_blocked_frame(&conn->ifc_send_ctl, stream);
|
||||
if (stream->sm_qflags & SMQF_SEND_RST)
|
||||
r &= generate_rst_stream_frame(conn, stream);
|
||||
if (stream->sm_qflags & SMQF_SEND_STOP_SENDING)
|
||||
|
|
|
@ -734,7 +734,7 @@ ietf_mini_conn_ci_hsk_done (struct lsquic_conn *lconn,
|
|||
{
|
||||
case LSQ_HSK_OK:
|
||||
case LSQ_HSK_RESUMED_OK:
|
||||
conn->imc_flags |= IMC_HSK_OK;
|
||||
conn->imc_flags |= IMC_HSK_OK | IMC_IGNORE_INIT;
|
||||
conn->imc_conn.cn_flags |= LSCONN_HANDSHAKE_DONE;
|
||||
LSQ_DEBUG("handshake OK");
|
||||
break;
|
||||
|
@ -1436,6 +1436,14 @@ imico_parse_regular_packet (struct ietf_mini_conn *conn,
|
|||
p = packet_in->pi_data + packet_in->pi_header_sz;
|
||||
pend = packet_in->pi_data + packet_in->pi_data_sz;
|
||||
|
||||
if (p >= pend)
|
||||
{
|
||||
ietf_mini_conn_ci_abort_error(&conn->imc_conn, 0,
|
||||
TEC_PROTOCOL_VIOLATION,
|
||||
"packet %"PRIu64" has no frames",
|
||||
packet_in->pi_packno);
|
||||
return -1;
|
||||
}
|
||||
while (p < pend)
|
||||
{
|
||||
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,
|
|||
imico_maybe_validate_by_dcid(conn, &packet_in->pi_dcid);
|
||||
|
||||
pns = lsquic_hety2pns[ packet_in->pi_header_type ];
|
||||
if (pns == PNS_INIT && (conn->imc_flags & IMC_IGNORE_INIT))
|
||||
if (pns == PNS_INIT)
|
||||
{
|
||||
LSQ_DEBUG("ignore init packet"); /* Don't bother decrypting */
|
||||
return;
|
||||
if (conn->imc_flags & IMC_IGNORE_INIT)
|
||||
{
|
||||
LSQ_DEBUG("ignore init packet"); /* Don't bother decrypting */
|
||||
return;
|
||||
}
|
||||
if (packet_in->pi_pkt_size
|
||||
&& packet_in->pi_pkt_size < IQUIC_MIN_INIT_PACKET_SZ)
|
||||
{
|
||||
LSQ_DEBUG("ignore init packet smaller than minimum size required");
|
||||
/* Don't bother decrypting */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
|||
return;
|
||||
}
|
||||
else if (pns == PNS_HSK)
|
||||
{
|
||||
if (!LSQUIC_CIDS_EQ(CN_SCID(&conn->imc_conn), &packet_in->pi_dcid))
|
||||
{
|
||||
ietf_mini_conn_ci_abort_error(lconn, 0, TEC_PROTOCOL_VIOLATION,
|
||||
"protocol violation detected bad dcid for HSK pns");
|
||||
return;
|
||||
}
|
||||
imico_peer_addr_validated(conn, "handshake PNS");
|
||||
}
|
||||
|
||||
if (((conn->imc_flags >> IMCBIT_PNS_BIT_SHIFT) & 3) < pns)
|
||||
{
|
||||
|
|
|
@ -364,6 +364,7 @@ maybe_shrink_packet_out_bufs (struct lsquic_mm *mm, unsigned idx)
|
|||
#endif
|
||||
|
||||
|
||||
#if LSQUIC_USE_POOLS
|
||||
/* If average maximum falls under 1/4 of all objects allocated, release
|
||||
* half of the objects allocated.
|
||||
*/
|
||||
|
@ -398,6 +399,7 @@ maybe_shrink_packet_in_bufs (struct lsquic_mm *mm, unsigned idx)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
|
|
|
@ -148,28 +148,16 @@ lsquic_frame_types_to_str (char *buf, size_t bufsz, enum quic_ft_bit);
|
|||
enum packno_bits
|
||||
{
|
||||
PACKNO_BITS_0 = 0,
|
||||
PACKNO_BITS_1 = 1,
|
||||
PACKNO_BITS_2 = 2,
|
||||
PACKNO_BITS_3 = 3,
|
||||
};
|
||||
|
||||
|
||||
/* GQUIC maps 0, 1, 2, 3 -> 1, 2, 4, 6 */
|
||||
enum
|
||||
{
|
||||
GQUIC_PACKNO_LEN_1 = PACKNO_BITS_0,
|
||||
GQUIC_PACKNO_LEN_2 = PACKNO_BITS_1,
|
||||
GQUIC_PACKNO_LEN_4 = PACKNO_BITS_2,
|
||||
GQUIC_PACKNO_LEN_6 = PACKNO_BITS_3,
|
||||
};
|
||||
|
||||
|
||||
/* IQUIC maps 0, 1, 2, 3 -> 1, 2, 3, 4 (as of ID-17) */
|
||||
enum
|
||||
{
|
||||
IQUIC_PACKNO_LEN_1 = PACKNO_BITS_0,
|
||||
PACKNO_BITS_1 = 1,
|
||||
GQUIC_PACKNO_LEN_2 = PACKNO_BITS_1,
|
||||
IQUIC_PACKNO_LEN_2 = PACKNO_BITS_1,
|
||||
PACKNO_BITS_2 = 2,
|
||||
GQUIC_PACKNO_LEN_4 = PACKNO_BITS_2,
|
||||
IQUIC_PACKNO_LEN_3 = PACKNO_BITS_2,
|
||||
PACKNO_BITS_3 = 3,
|
||||
GQUIC_PACKNO_LEN_6 = PACKNO_BITS_3,
|
||||
IQUIC_PACKNO_LEN_4 = PACKNO_BITS_3,
|
||||
};
|
||||
|
||||
|
|
|
@ -93,6 +93,7 @@ typedef struct lsquic_packet_in
|
|||
} pi_flags;
|
||||
/* pi_token and pi_token_size are set in Initial and Retry packets */
|
||||
unsigned short pi_token_size; /* Size of the token */
|
||||
unsigned short pi_pkt_size; /* Size of the whole packet */
|
||||
unsigned char pi_token; /* Offset to token */
|
||||
/* pi_odcid and pi_odcid_len are only set in Retry packets for I-D < 25 */
|
||||
unsigned char pi_odcid; /* Offset to Original DCID */
|
||||
|
|
|
@ -2132,7 +2132,7 @@ lsquic_send_ctl_next_packet_to_send (struct lsquic_send_ctl *ctl,
|
|||
else
|
||||
packet_out->po_lflags &= ~POL_LIMITED;
|
||||
|
||||
if (UNLIKELY(!(ctl->sc_conn_pub->lconn->cn_flags & LSCONN_HANDSHAKE_DONE))
|
||||
if (UNLIKELY(packet_out->po_header_type == HETY_INITIAL)
|
||||
&& (!(ctl->sc_conn_pub->lconn->cn_flags & LSCONN_SERVER)
|
||||
|| (packet_out->po_frame_types
|
||||
& IQUIC_FRAME_ACKABLE_MASK))
|
||||
|
@ -2966,6 +2966,42 @@ lsquic_send_ctl_get_packet_for_stream (lsquic_send_ctl_t *ctl,
|
|||
}
|
||||
|
||||
|
||||
/* Return true if generated, false otherwise */
|
||||
int
|
||||
lsquic_sendctl_gen_stream_blocked_frame (struct lsquic_send_ctl *ctl,
|
||||
struct lsquic_stream *stream)
|
||||
{
|
||||
struct lsquic_packet_out *packet_out;
|
||||
const struct parse_funcs *const pf = stream->conn_pub->lconn->cn_pf;
|
||||
unsigned need;
|
||||
uint64_t off;
|
||||
int sz;
|
||||
|
||||
off = lsquic_stream_combined_send_off(stream);
|
||||
need = pf->pf_stream_blocked_frame_size(stream->id, off);
|
||||
packet_out = lsquic_send_ctl_get_packet_for_stream(ctl, need,
|
||||
stream->conn_pub->path, stream);
|
||||
if (!packet_out)
|
||||
return 0;
|
||||
sz = pf->pf_gen_stream_blocked_frame(
|
||||
packet_out->po_data + packet_out->po_data_sz,
|
||||
lsquic_packet_out_avail(packet_out), stream->id, off);
|
||||
if (sz < 0)
|
||||
return 0;
|
||||
LSQ_DEBUG("generated %d-byte STREAM_BLOCKED "
|
||||
"frame; stream_id: %"PRIu64"; offset: %"PRIu64, sz, stream->id, off);
|
||||
EV_LOG_CONN_EVENT(LSQUIC_LOG_CONN_ID, "generated %d-byte STREAM_BLOCKED "
|
||||
"frame; stream_id: %"PRIu64"; offset: %"PRIu64, sz, stream->id, off);
|
||||
if (0 != lsquic_packet_out_add_frame(packet_out, &ctl->sc_enpub->enp_mm, 0,
|
||||
QUIC_FRAME_STREAM_BLOCKED, packet_out->po_data_sz, sz))
|
||||
return 0;
|
||||
lsquic_send_ctl_incr_pack_sz(ctl, packet_out, sz);
|
||||
packet_out->po_frame_types |= 1 << QUIC_FRAME_STREAM_BLOCKED;
|
||||
lsquic_stream_blocked_frame_sent(stream);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#ifdef NDEBUG
|
||||
static
|
||||
#elif __GNUC__
|
||||
|
@ -3775,9 +3811,9 @@ lsquic_send_ctl_resize (struct lsquic_send_ctl *ctl)
|
|||
size = lsquic_packet_out_total_sz(lconn, packet_out);
|
||||
if (size > packet_out->po_path->np_pack_size)
|
||||
{
|
||||
send_ctl_resize_q(ctl, *q, packet_out->po_path);
|
||||
path_ids |= 1 << packet_out->po_path->np_path_id;
|
||||
q_idxs |= 1 << (q - queues);
|
||||
send_ctl_resize_q(ctl, *q, packet_out->po_path);
|
||||
goto redo_q;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -236,6 +236,10 @@ lsquic_send_ctl_get_packet_for_stream (lsquic_send_ctl_t *,
|
|||
unsigned need_at_least, const struct network_path *,
|
||||
const struct lsquic_stream *);
|
||||
|
||||
int
|
||||
lsquic_sendctl_gen_stream_blocked_frame (struct lsquic_send_ctl *ctl,
|
||||
struct lsquic_stream *stream);
|
||||
|
||||
struct lsquic_packet_out *
|
||||
lsquic_send_ctl_get_packet_for_crypto (struct lsquic_send_ctl *ctl,
|
||||
unsigned need_at_least, enum packnum_space, const struct network_path *);
|
||||
|
|
|
@ -3695,10 +3695,15 @@ stream_write (lsquic_stream_t *stream, struct lsquic_reader *reader,
|
|||
}
|
||||
while (nwritten < len
|
||||
&& stream->sm_n_buffered < stream->sm_n_allocated);
|
||||
return nwritten;
|
||||
}
|
||||
else
|
||||
return stream_write_to_packets(stream, reader, thresh, swo);
|
||||
nwritten = stream_write_to_packets(stream, reader, thresh, swo);
|
||||
if ((stream->sm_qflags & SMQF_SEND_BLOCKED) &&
|
||||
(stream->sm_bflags & SMBF_IETF))
|
||||
{
|
||||
lsquic_sendctl_gen_stream_blocked_frame(stream->conn_pub->send_ctl, stream);
|
||||
}
|
||||
return nwritten;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit df068e6feec3268a32a1edbbec4a4636d200ee90
|
||||
Subproject commit 32e96f10593c7cb8553cd8c9c12721100ae9e924
|
Loading…
Add table
Add a link
Reference in a new issue