]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: add version field on quic_rx_packet
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 17 Oct 2022 16:05:18 +0000 (18:05 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 19 Oct 2022 16:12:56 +0000 (18:12 +0200)
Add a new field version on quic_rx_packet structure. This is set on
header parsing in qc_lstnr_pkt_rcv() function.

This change has no functional impact. It is a part of a refactoring
series on qc_lstnr_pkt_rcv(). The objective is facilitate integration of
FD-owned socket patches.

This should be backported up to 2.6.

include/haproxy/quic_conn-t.h
src/quic_conn.c

index 8bfd6189832c2f4879ded41eb293041e028ca0be..75bd2d50a94e7e3640afe45ac005547df17cca30 100644 (file)
@@ -395,7 +395,11 @@ struct quic_dgram {
 struct quic_rx_packet {
        struct list list;
        struct list qc_rx_pkt_list;
+
+       /* QUIC version used in packet. */
+       const struct quic_version *version;
        struct quic_conn *qc;
+
        unsigned char type;
        /* Initial desctination connection ID. */
        struct quic_cid dcid;
index 44c944c014ad8dd2411d4bc3f2a40c65f062e703..dcf5eea5fdc036c0c8f72ad4ea54cc7f95b48ca7 100644 (file)
@@ -6032,6 +6032,7 @@ static void qc_lstnr_pkt_rcv(unsigned char *buf, const unsigned char *end,
                        TRACE_PROTO("VN packet sent", QUIC_EV_CONN_LPKT);
                        goto err;
                }
+               pkt->version = qv;
 
                /* For Initial packets, and for servers (QUIC clients connections),
                 * there is no Initial connection IDs storage.
@@ -7167,12 +7168,16 @@ struct task *quic_lstnr_dghdlr(struct task *t, void *ctx, unsigned int state)
                do {
                        struct quic_rx_packet *pkt;
 
+                       /* TODO replace zalloc -> alloc. */
                        pkt = pool_zalloc(pool_head_quic_rx_packet);
                        if (!pkt) {
                                TRACE_ERROR("RX packet allocation failed", QUIC_EV_CONN_LPKT);
+                               /* TODO count lost datagram. */
                                goto leave;
                        }
 
+                       pkt->version = NULL;
+
                        LIST_INIT(&pkt->qc_rx_pkt_list);
                        pkt->time_received = now_ms;
                        quic_rx_packet_refinc(pkt);