Add "quic_cids" new pool to allocate the ->cids trees of quic_conn objects.
Replace ->cids member of quic_conn objects by pointer to "quic_cids" and
adapt the code consequently. Nothing special.
struct quic_cid odcid; /* First DCID used by client on its Initial packet. */
struct quic_cid dcid; /* DCID of our endpoint - not updated when a new DCID is used */
struct quic_cid scid; /* first SCID of our endpoint - not updated when a new SCID is used */
- struct eb_root cids; /* tree of quic_connection_id - used to match a received packet DCID with a connection */
+ struct eb_root *cids; /* tree of quic_connection_id - used to match a received packet DCID with a connection */
uint64_t next_cid_seq_num;
/* Initial encryption level */
{
struct eb64_node *node;
- node = eb64_first(&conn->cids);
+ node = eb64_first(conn->cids);
while (node) {
struct quic_connection_id *conn_id;
static BIO_METHOD *ha_quic_meth;
DECLARE_STATIC_POOL(pool_head_quic_conn, "quic_conn", sizeof(struct quic_conn));
+DECLARE_STATIC_POOL(pool_head_quic_cids, "quic_cids", sizeof(struct eb_root));
DECLARE_POOL(pool_head_quic_connection_id,
"quic_connection_id", sizeof(struct quic_connection_id));
DECLARE_POOL(pool_head_quic_crypto_buf, "quic_crypto_buf", sizeof(struct quic_crypto_buf));
qc->streams_by_id = EB_ROOT_UNIQUE;
/* Required to call free_quic_conn_cids() from quic_conn_release() */
- qc->cids = EB_ROOT;
+ qc->cids = NULL;
qc_init_fd(qc);
LIST_INIT(&qc->back_refs);
goto err;
}
+ qc->cids = pool_alloc(pool_head_quic_cids);
+ if (!qc->cids) {
+ TRACE_ERROR("Could not allocate a new CID tree", QUIC_EV_CONN_INIT, qc);
+ goto err;
+ }
+
+ *qc->cids = EB_ROOT;
/* QUIC Server (or listener). */
if (server) {
struct proxy *prx;
/* remove the connection from receiver cids trees */
free_quic_conn_cids(qc);
+ pool_free(pool_head_quic_cids, qc->cids);
/* free the SSL sock context */
qc_free_ssl_sock_ctx(&qc->xprt_ctx);
*/
qc_detach_th_ctx_list(qc, 0);
- node = eb64_first(&qc->cids);
+ node = eb64_first(qc->cids);
BUG_ON(!node || eb64_next(node)); /* One and only one CID must be present before affinity rebind. */
conn_id = eb64_entry(node, struct quic_connection_id, seq_num);
* the Destination Connection ID field of the packet in which the frame is contained.
* The peer MAY treat this as a connection error of type PROTOCOL_VIOLATION.
*/
- node = eb64_lookup(&qc->cids, rcid_frm->seq_num);
+ node = eb64_lookup(qc->cids, rcid_frm->seq_num);
if (!node) {
TRACE_PROTO("CID already retired", QUIC_EV_CONN_PSTRM, qc, frm);
goto out;
pool_free(pool_head_quic_connection_id, conn_id);
TRACE_PROTO("CID retired", QUIC_EV_CONN_PSTRM, qc);
- conn_id = new_quic_cid(&qc->cids, qc, NULL, NULL);
+ conn_id = new_quic_cid(qc->cids, qc, NULL, NULL);
if (!conn_id) {
TRACE_ERROR("CID allocation error", QUIC_EV_CONN_IO_CB, qc);
}
* packet. <conn_id> must be inserted in the CIDs tree for this
* connection.
*/
- eb64_insert(&qc->cids, &conn_id->seq_num);
+ eb64_insert(qc->cids, &conn_id->seq_num);
/* Initialize the next CID sequence number to be used for this connection. */
qc->next_cid_seq_num = 1;
}
goto err;
}
- conn_id = new_quic_cid(&qc->cids, qc, NULL, NULL);
+ conn_id = new_quic_cid(qc->cids, qc, NULL, NULL);
if (!conn_id) {
qc_frm_free(qc, &frm);
TRACE_ERROR("CID allocation error", QUIC_EV_CONN_IO_CB, qc);
/* The first CID sequence number value used to allocated CIDs by this function is 1,
* 0 being the sequence number of the CID for this connection.
*/
- node = eb64_lookup_ge(&qc->cids, 1);
+ node = eb64_lookup_ge(qc->cids, 1);
while (node) {
struct quic_connection_id *conn_id;