"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/liblsquic/lsquic_engine.c" between
lsquic-2.22.1.tar.gz and lsquic-2.23.1.tar.gz

About: LSQUIC is LiteSpeed’s QUIC and HTTP/3 Library. A hint: HTTP/3 uses QUIC as the underlying transport protocol instead of TCP.

lsquic_engine.c  (lsquic-2.22.1):lsquic_engine.c  (lsquic-2.23.1)
skipping to change at line 623 skipping to change at line 623
engine->pub.enp_verify_ctx = api->ea_verify_ctx; engine->pub.enp_verify_ctx = api->ea_verify_ctx;
engine->pub.enp_kli = api->ea_keylog_if; engine->pub.enp_kli = api->ea_keylog_if;
engine->pub.enp_kli_ctx = api->ea_keylog_ctx; engine->pub.enp_kli_ctx = api->ea_keylog_ctx;
engine->pub.enp_engine = engine; engine->pub.enp_engine = engine;
if (hash_conns_by_addr(engine)) if (hash_conns_by_addr(engine))
engine->flags |= ENG_CONNS_BY_ADDR; engine->flags |= ENG_CONNS_BY_ADDR;
engine->conns_hash = lsquic_hash_create(); engine->conns_hash = lsquic_hash_create();
engine->pub.enp_tokgen = lsquic_tg_new(&engine->pub); engine->pub.enp_tokgen = lsquic_tg_new(&engine->pub);
if (!engine->pub.enp_tokgen) if (!engine->pub.enp_tokgen)
return NULL; return NULL;
if (engine->flags & ENG_SERVER)
for (i = 0; i < sizeof(engine->pub.enp_quic_ctx_sz)
/ sizeof(engine->pub.enp_quic_ctx_sz[0]); ++i)
{
int sz = lsquic_enc_sess_ietf_gen_quic_ctx(
&engine->pub.enp_settings,
i == 0 ? LSQVER_ID27 : LSQVER_ID28,
engine->pub.enp_quic_ctx_buf[i],
sizeof(engine->pub.enp_quic_ctx_buf));
if (sz < 0)
{
free(engine);
return NULL;
}
engine->pub.enp_quic_ctx_sz[i] = (unsigned) sz;
}
engine->pub.enp_crand = &engine->crand; engine->pub.enp_crand = &engine->crand;
if (engine->pub.enp_settings.es_noprogress_timeout) if (engine->pub.enp_settings.es_noprogress_timeout)
engine->pub.enp_noprog_timeout engine->pub.enp_noprog_timeout
= engine->pub.enp_settings.es_noprogress_timeout * 1000000; = engine->pub.enp_settings.es_noprogress_timeout * 1000000;
engine->pub.enp_mtu_probe_timer = 1000 engine->pub.enp_mtu_probe_timer = 1000
* (engine->pub.enp_settings.es_mtu_probe_timer * (engine->pub.enp_settings.es_mtu_probe_timer
? engine->pub.enp_settings.es_mtu_probe_timer ? engine->pub.enp_settings.es_mtu_probe_timer
: LSQUIC_DF_MTU_PROBE_TIMER); : LSQUIC_DF_MTU_PROBE_TIMER);
if (flags & ENG_SERVER) if (flags & ENG_SERVER)
{ {
skipping to change at line 1076 skipping to change at line 1092
static struct lsquic_hash_elem * static struct lsquic_hash_elem *
find_conn_by_addr (struct lsquic_hash *hash, const struct sockaddr *sa) find_conn_by_addr (struct lsquic_hash *hash, const struct sockaddr *sa)
{ {
unsigned short port; unsigned short port;
port = sa2port(sa); port = sa2port(sa);
return lsquic_hash_find(hash, &port, sizeof(port)); return lsquic_hash_find(hash, &port, sizeof(port));
} }
/* When connections are identified by the local address, we need to drop
* packets that use DCIDs that do not correspond to any of SCIDs. This
* can happen when peer retires a SCID. This mimics the normal behavior,
* when connections are looked up in engine->conns_hash by ID: when there
* is no match, the packet is dropped.
*/
static int
dcid_checks_out (const struct lsquic_conn *conn, const lsquic_cid_t *dcid)
{
const struct conn_cid_elem *cce;
if (LSQUIC_CIDS_EQ(CN_SCID(conn), dcid))
return 1;
/* Slow check for those rare cases */
for (cce = conn->cn_cces; cce < END_OF_CCES(conn); ++cce)
if ((conn->cn_cces_mask & (1 << (cce - conn->cn_cces)))
&& !(cce->cce_flags & CCE_PORT)
&& LSQUIC_CIDS_EQ(&cce->cce_cid, dcid))
{
LSQ_DEBUG("connection checks out");
return 1;
}
return 0;
}
static lsquic_conn_t * static lsquic_conn_t *
find_conn (lsquic_engine_t *engine, lsquic_packet_in_t *packet_in, find_conn (lsquic_engine_t *engine, lsquic_packet_in_t *packet_in,
struct packin_parse_state *ppstate, const struct sockaddr *sa_local) struct packin_parse_state *ppstate, const struct sockaddr *sa_local)
{ {
struct lsquic_hash_elem *el; struct lsquic_hash_elem *el;
lsquic_conn_t *conn; lsquic_conn_t *conn;
if (engine->flags & ENG_CONNS_BY_ADDR) if (engine->flags & ENG_CONNS_BY_ADDR)
{
el = find_conn_by_addr(engine->conns_hash, sa_local); el = find_conn_by_addr(engine->conns_hash, sa_local);
if ((packet_in->pi_flags & PI_CONN_ID)
&& !dcid_checks_out(lsquic_hashelem_getdata(el),
&packet_in->pi_conn_id))
{
LSQ_DEBUGC("DCID matches no SCID in connection %"CID_FMT": drop it",
CID_BITS(&packet_in->pi_conn_id));
return NULL;
}
}
else if (packet_in->pi_flags & PI_CONN_ID) else if (packet_in->pi_flags & PI_CONN_ID)
el = lsquic_hash_find(engine->conns_hash, el = lsquic_hash_find(engine->conns_hash,
packet_in->pi_conn_id.idbuf, packet_in->pi_conn_id.len); packet_in->pi_conn_id.idbuf, packet_in->pi_conn_id.len);
else else
{ {
LSQ_DEBUG("packet header does not have connection ID: discarding"); LSQ_DEBUG("packet header does not have connection ID: discarding");
return NULL; return NULL;
} }
if (!el) if (!el)
 End of changes. 4 change blocks. 
0 lines changed or deleted 53 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)