Skip to content

Commit 292088e

Browse files
committed
MINOR: quic: remove ->offset qf_crypto struct field
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.
1 parent 2ed515c commit 292088e

File tree

5 files changed

+16
-17
lines changed

5 files changed

+16
-17
lines changed

include/haproxy/quic_frame-t.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ struct qf_stop_sending {
153153

154154
struct qf_crypto {
155155
struct list list;
156-
uint64_t offset;
157156
struct eb64_node offset_node;
158157
uint64_t len;
159158
const struct quic_enc_level *qel;

include/haproxy/quic_frame.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static inline size_t qc_frm_len(struct quic_frame *frm)
8686
}
8787
case QUIC_FT_CRYPTO: {
8888
struct qf_crypto *f = &frm->crypto;
89-
len += 1 + quic_int_getsize(f->offset) + quic_int_getsize(f->len) + f->len;
89+
len += 1 + quic_int_getsize(f->offset_node.key) + quic_int_getsize(f->len) + f->len;
9090
break;
9191
}
9292
case QUIC_FT_NEW_TOKEN: {

src/quic_frame.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void chunk_frm_appendf(struct buffer *buf, const struct quic_frame *frm)
115115
{
116116
const struct qf_crypto *crypto_frm = &frm->crypto;
117117
chunk_appendf(buf, " cfoff=%llu cflen=%llu",
118-
(ull)crypto_frm->offset, (ull)crypto_frm->len);
118+
(ull)crypto_frm->offset_node.key, (ull)crypto_frm->len);
119119
break;
120120
}
121121
case QUIC_FT_RESET_STREAM:
@@ -430,12 +430,12 @@ static int quic_build_crypto_frame(unsigned char **pos, const unsigned char *end
430430
const struct quic_enc_level *qel = crypto_frm->qel;
431431
size_t offset, len;
432432

433-
if (!quic_enc_int(pos, end, crypto_frm->offset) ||
433+
if (!quic_enc_int(pos, end, crypto_frm->offset_node.key) ||
434434
!quic_enc_int(pos, end, crypto_frm->len) || end - *pos < crypto_frm->len)
435435
return 0;
436436

437437
len = crypto_frm->len;
438-
offset = crypto_frm->offset;
438+
offset = crypto_frm->offset_node.key;
439439
while (len) {
440440
int idx;
441441
size_t to_copy;
@@ -463,7 +463,7 @@ static int quic_parse_crypto_frame(struct quic_frame *frm, struct quic_conn *qc,
463463
{
464464
struct qf_crypto *crypto_frm = &frm->crypto;
465465

466-
if (!quic_dec_int(&crypto_frm->offset, pos, end) ||
466+
if (!quic_dec_int((uint64_t *)&crypto_frm->offset_node.key, pos, end) ||
467467
!quic_dec_int(&crypto_frm->len, pos, end) || end - *pos < crypto_frm->len)
468468
return 0;
469469

@@ -1363,7 +1363,7 @@ size_t quic_strm_frm_fillbuf(size_t room, struct quic_frame *frm, size_t *split)
13631363
}
13641364
else if (frm->type == QUIC_FT_CRYPTO) {
13651365
total = 1;
1366-
total += quic_int_getsize(frm->crypto.offset);
1366+
total += quic_int_getsize(frm->crypto.offset_node.key);
13671367
payload = frm->crypto.len;
13681368
}
13691369
else {
@@ -1438,12 +1438,12 @@ struct quic_frame *quic_strm_frm_split(struct quic_frame *frm, uint64_t split)
14381438
}
14391439
else if (frm->type == QUIC_FT_CRYPTO) {
14401440
new->crypto.qel = frm->crypto.qel;
1441-
new->crypto.offset = frm->crypto.offset;
1441+
new->crypto.offset_node.key = frm->crypto.offset_node.key;
14421442
new->crypto.len = split;
14431443

14441444
/* Advance original frame to point to the remaining data. */
14451445
frm->crypto.len -= split;
1446-
frm->crypto.offset += split;
1446+
frm->crypto.offset_node.key += split;
14471447
}
14481448
else {
14491449
/* Function must only be used with STREAM or CRYPTO frames. */

src/quic_rx.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ static enum quic_rx_ret_frm qc_handle_crypto_frm(struct quic_conn *qc,
662662
enum quic_rx_ret_frm ret = QUIC_RX_RET_FRM_DONE;
663663
/* XXX TO DO: <cfdebug> is used only for the traces. */
664664
struct quic_rx_crypto_frm cfdebug = {
665-
.offset_node.key = crypto_frm->offset,
665+
.offset_node.key = crypto_frm->offset_node.key,
666666
.len = crypto_frm->len,
667667
};
668668
struct quic_cstream *cstream = qel->cstream;
@@ -671,10 +671,10 @@ static enum quic_rx_ret_frm qc_handle_crypto_frm(struct quic_conn *qc,
671671

672672
TRACE_ENTER(QUIC_EV_CONN_PRSHPKT, qc);
673673

674-
if (unlikely(crypto_frm->offset < cstream->rx.offset)) {
674+
if (unlikely(crypto_frm->offset_node.key < cstream->rx.offset)) {
675675
size_t diff;
676676

677-
if (crypto_frm->offset + crypto_frm->len <= cstream->rx.offset) {
677+
if (crypto_frm->offset_node.key + crypto_frm->len <= cstream->rx.offset) {
678678
/* Nothing to do */
679679
TRACE_PROTO("Already received CRYPTO data",
680680
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,
685685
TRACE_PROTO("Partially already received CRYPTO data",
686686
QUIC_EV_CONN_RXPKT, qc, pkt, &cfdebug);
687687

688-
diff = cstream->rx.offset - crypto_frm->offset;
688+
diff = cstream->rx.offset - crypto_frm->offset_node.key;
689689
crypto_frm->len -= diff;
690690
crypto_frm->data += diff;
691-
crypto_frm->offset = cstream->rx.offset;
691+
crypto_frm->offset_node.key = cstream->rx.offset;
692692
}
693693

694694
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,
697697
}
698698

699699
/* crypto_frm->offset > cstream-trx.offset */
700-
off_rel = crypto_frm->offset - cstream->rx.offset;
700+
off_rel = crypto_frm->offset_node.key - cstream->rx.offset;
701701

702702
/* RFC 9000 7.5. Cryptographic Message Buffering
703703
*
@@ -903,7 +903,7 @@ static int qc_parse_pkt_frms(struct quic_conn *qc, struct quic_rx_packet *pkt,
903903
break;
904904
}
905905
case QUIC_FT_CRYPTO:
906-
frm->crypto.offset_node.key = frm->crypto.offset;
906+
frm->crypto.offset_node.key = frm->crypto.offset_node.key;
907907
eb64_insert(&cf_frms_tree, &frm->crypto.offset_node);
908908
frm = NULL;
909909
break;

src/quic_ssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static int qc_ssl_crypto_data_cpy(struct quic_conn *qc, struct quic_enc_level *q
149149
goto leave;
150150
}
151151

152-
frm->crypto.offset = cf_offset;
152+
frm->crypto.offset_node.key = cf_offset;
153153
frm->crypto.len = cf_len;
154154
frm->crypto.qel = qel;
155155
LIST_APPEND(&qel->pktns->tx.frms, &frm->list);

0 commit comments

Comments
 (0)