diff --git a/include/haproxy/quic_frame-t.h b/include/haproxy/quic_frame-t.h index 9d35be4fb..aff0161d5 100644 --- a/include/haproxy/quic_frame-t.h +++ b/include/haproxy/quic_frame-t.h @@ -153,7 +153,6 @@ struct qf_stop_sending { struct qf_crypto { struct list list; - uint64_t offset; struct eb64_node offset_node; uint64_t len; const struct quic_enc_level *qel; diff --git a/include/haproxy/quic_frame.h b/include/haproxy/quic_frame.h index ab1d897b9..3994e8f53 100644 --- a/include/haproxy/quic_frame.h +++ b/include/haproxy/quic_frame.h @@ -86,7 +86,7 @@ static inline size_t qc_frm_len(struct quic_frame *frm) } 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: { diff --git a/src/quic_frame.c b/src/quic_frame.c index 209f03e8b..3d1f12838 100644 --- a/src/quic_frame.c +++ b/src/quic_frame.c @@ -115,7 +115,7 @@ void chunk_frm_appendf(struct buffer *buf, const struct quic_frame *frm) { 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: @@ -430,12 +430,12 @@ static int quic_build_crypto_frame(unsigned char **pos, const unsigned char *end 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; @@ -463,7 +463,7 @@ static int quic_parse_crypto_frame(struct quic_frame *frm, struct quic_conn *qc, { 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; @@ -1363,7 +1363,7 @@ size_t quic_strm_frm_fillbuf(size_t room, struct quic_frame *frm, size_t *split) } else if (frm->type == QUIC_FT_CRYPTO) { total = 1; - total += quic_int_getsize(frm->crypto.offset); + total += quic_int_getsize(frm->crypto.offset_node.key); payload = frm->crypto.len; } else { @@ -1438,12 +1438,12 @@ struct quic_frame *quic_strm_frm_split(struct quic_frame *frm, uint64_t split) } else if (frm->type == QUIC_FT_CRYPTO) { new->crypto.qel = frm->crypto.qel; - new->crypto.offset = frm->crypto.offset; + new->crypto.offset_node.key = frm->crypto.offset_node.key; new->crypto.len = split; /* Advance original frame to point to the remaining data. */ frm->crypto.len -= split; - frm->crypto.offset += split; + frm->crypto.offset_node.key += split; } else { /* Function must only be used with STREAM or CRYPTO frames. */ diff --git a/src/quic_rx.c b/src/quic_rx.c index f69915265..66b607cb4 100644 --- a/src/quic_rx.c +++ b/src/quic_rx.c @@ -662,7 +662,7 @@ static enum quic_rx_ret_frm qc_handle_crypto_frm(struct quic_conn *qc, enum quic_rx_ret_frm ret = QUIC_RX_RET_FRM_DONE; /* XXX TO DO: 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; @@ -671,10 +671,10 @@ static enum quic_rx_ret_frm qc_handle_crypto_frm(struct quic_conn *qc, 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); @@ -685,10 +685,10 @@ static enum quic_rx_ret_frm qc_handle_crypto_frm(struct quic_conn *qc, 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)) { @@ -697,7 +697,7 @@ static enum quic_rx_ret_frm qc_handle_crypto_frm(struct quic_conn *qc, } /* 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 * @@ -903,7 +903,7 @@ static int qc_parse_pkt_frms(struct quic_conn *qc, struct quic_rx_packet *pkt, 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; diff --git a/src/quic_ssl.c b/src/quic_ssl.c index b34cbf216..5cdb9dfc1 100644 --- a/src/quic_ssl.c +++ b/src/quic_ssl.c @@ -149,7 +149,7 @@ static int qc_ssl_crypto_data_cpy(struct quic_conn *qc, struct quic_enc_level *q 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);