MINOR: quic: add version field on quic_rx_packet
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.
diff --git a/include/haproxy/quic_conn-t.h b/include/haproxy/quic_conn-t.h
index 8bfd618..75bd2d5 100644
--- a/include/haproxy/quic_conn-t.h
+++ b/include/haproxy/quic_conn-t.h
@@ -395,7 +395,11 @@
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;
diff --git a/src/quic_conn.c b/src/quic_conn.c
index 44c944c..dcf5eea 100644
--- a/src/quic_conn.c
+++ b/src/quic_conn.c
@@ -6032,6 +6032,7 @@
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 @@
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);