]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Drop 0-RTT packets if not allowed
authorFrédéric Lécaille <flecaille@haproxy.com>
Wed, 27 Apr 2022 13:37:28 +0000 (15:37 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 28 Apr 2022 14:22:40 +0000 (16:22 +0200)
Drop the 0-RTT packets for a listener without early data configuration enabled.

src/xprt_quic.c

index a181c8f0e09258e57c049630c59cd98cad3d8f13..15bcd387bf9464ec64dfd6d1c08a2f4210107caf 100644 (file)
@@ -5042,8 +5042,12 @@ static void qc_lstnr_pkt_rcv(unsigned char *buf, const unsigned char *end,
                        goto err;
                }
 
-               if (pkt->type == QUIC_PACKET_TYPE_INITIAL &&
-                   dgram->len < QUIC_INITIAL_PACKET_MINLEN) {
+               if (pkt->type == QUIC_PACKET_TYPE_0RTT && !l->bind_conf->ssl_conf.early_data) {
+                       TRACE_PROTO("0-RTT packet not supported", QUIC_EV_CONN_LPKT, qc);
+                       drop_no_con = 1;
+               }
+               else if (pkt->type == QUIC_PACKET_TYPE_INITIAL &&
+                        dgram->len < QUIC_INITIAL_PACKET_MINLEN) {
                        TRACE_PROTO("Too short datagram with an Initial packet", QUIC_EV_CONN_LPKT, qc);
                        drop_no_con = 1;
                }