This patch follows this previous bug fix:
BUG/MINOR: quic: reorder fragmented RX CRYPTO frames by their offsets
where a ebtree node has been added to qf_crypto struct. It has the same
meaning and type as ->offset_node.key field with ->offset_node an eb64tree node.
This patch simply removes ->offset which is no more useful.
This patch should be easily backported as far as 2.6 as the one mentioned above
to ease any further backport to come.
(cherry picked from commit
31c17ad837195c70fb6d4e427845ded1c6acffaa)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit
4a1a08be4f34feafb637115a1d8536ad70a2df33)
[cf: Some changes were made inlined in quic_tx.c because some functions does
not exist in 3.2 and lower]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit
565d73a3b1d6fa562408392bb55340a5e7b8b967)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
struct qf_crypto {
struct list list;
- uint64_t offset;
struct eb64_node offset_node;
uint64_t len;
const struct quic_enc_level *qel;
}
case QUIC_FT_CRYPTO: {
struct qf_crypto *f = &frm->crypto;
- len += 1 + quic_int_getsize(f->offset) + quic_int_getsize(f->len) + f->len;
+ len += 1 + quic_int_getsize(f->offset_node.key) + quic_int_getsize(f->len) + f->len;
break;
}
case QUIC_FT_NEW_TOKEN: {
{
const struct qf_crypto *crypto_frm = &frm->crypto;
chunk_appendf(buf, " cfoff=%llu cflen=%llu",
- (ull)crypto_frm->offset, (ull)crypto_frm->len);
+ (ull)crypto_frm->offset_node.key, (ull)crypto_frm->len);
break;
}
case QUIC_FT_RESET_STREAM:
const struct quic_enc_level *qel = crypto_frm->qel;
size_t offset, len;
- if (!quic_enc_int(pos, end, crypto_frm->offset) ||
+ if (!quic_enc_int(pos, end, crypto_frm->offset_node.key) ||
!quic_enc_int(pos, end, crypto_frm->len) || end - *pos < crypto_frm->len)
return 0;
len = crypto_frm->len;
- offset = crypto_frm->offset;
+ offset = crypto_frm->offset_node.key;
while (len) {
int idx;
size_t to_copy;
{
struct qf_crypto *crypto_frm = &frm->crypto;
- if (!quic_dec_int(&crypto_frm->offset, pos, end) ||
+ if (!quic_dec_int((uint64_t *)&crypto_frm->offset_node.key, pos, end) ||
!quic_dec_int(&crypto_frm->len, pos, end) || end - *pos < crypto_frm->len)
return 0;
TRACE_LEAVE(QUIC_EV_CONN_PRSAFRM, qc);
}
-
enum quic_rx_ret_frm ret = QUIC_RX_RET_FRM_DONE;
/* XXX TO DO: <cfdebug> is used only for the traces. */
struct quic_rx_crypto_frm cfdebug = {
- .offset_node.key = crypto_frm->offset,
+ .offset_node.key = crypto_frm->offset_node.key,
.len = crypto_frm->len,
};
struct quic_cstream *cstream = qel->cstream;
TRACE_ENTER(QUIC_EV_CONN_PRSHPKT, qc);
- if (unlikely(crypto_frm->offset < cstream->rx.offset)) {
+ if (unlikely(crypto_frm->offset_node.key < cstream->rx.offset)) {
size_t diff;
- if (crypto_frm->offset + crypto_frm->len <= cstream->rx.offset) {
+ if (crypto_frm->offset_node.key + crypto_frm->len <= cstream->rx.offset) {
/* Nothing to do */
TRACE_PROTO("Already received CRYPTO data",
QUIC_EV_CONN_RXPKT, qc, pkt, &cfdebug);
TRACE_PROTO("Partially already received CRYPTO data",
QUIC_EV_CONN_RXPKT, qc, pkt, &cfdebug);
- diff = cstream->rx.offset - crypto_frm->offset;
+ diff = cstream->rx.offset - crypto_frm->offset_node.key;
crypto_frm->len -= diff;
crypto_frm->data += diff;
- crypto_frm->offset = cstream->rx.offset;
+ crypto_frm->offset_node.key = cstream->rx.offset;
}
if (!quic_get_ncbuf(ncbuf) || ncb_is_null(ncbuf)) {
}
/* crypto_frm->offset > cstream-trx.offset */
- off_rel = crypto_frm->offset - cstream->rx.offset;
+ off_rel = crypto_frm->offset_node.key - cstream->rx.offset;
/* RFC 9000 7.5. Cryptographic Message Buffering
*
break;
}
case QUIC_FT_CRYPTO:
- frm->crypto.offset_node.key = frm->crypto.offset;
+ frm->crypto.offset_node.key = frm->crypto.offset_node.key;
eb64_insert(&cf_frms_tree, &frm->crypto.offset_node);
frm = NULL;
break;
goto leave;
}
- frm->crypto.offset = cf_offset;
+ frm->crypto.offset_node.key = cf_offset;
frm->crypto.len = cf_len;
frm->crypto.qel = qel;
LIST_APPEND(&qel->pktns->tx.frms, &frm->list);
TRACE_DEVEL(" New CRYPTO frame build (room, len)",
QUIC_EV_CONN_BCFRMS, qc, &room, len);
/* Compute the length of this CRYPTO frame header */
- hlen = 1 + quic_int_getsize(cf->crypto.offset);
+ hlen = 1 + quic_int_getsize(cf->crypto.offset_node.key);
/* Compute the data length of this CRYPTO frame. */
dlen = max_stream_data_size(room, hlen, cf->crypto.len);
TRACE_DEVEL(" CRYPTO data length (hlen, crypto.len, dlen)",
}
new_cf->crypto.len = dlen;
- new_cf->crypto.offset = cf->crypto.offset;
+ new_cf->crypto.offset_node.key = cf->crypto.offset_node.key;
new_cf->crypto.qel = qel;
TRACE_DEVEL("split frame", QUIC_EV_CONN_PRSAFRM, qc, new_cf);
if (cf->origin) {
LIST_APPEND(outlist, &new_cf->list);
/* Consume <dlen> bytes of the current frame. */
cf->crypto.len -= dlen;
- cf->crypto.offset += dlen;
+ cf->crypto.offset_node.key += dlen;
}
break;