From 3e26698f8966ef84a7cab9ad74db40a9c3b0fb1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Wed, 27 Apr 2022 15:37:28 +0200 Subject: [PATCH] MINOR: quic: Drop 0-RTT packets if not allowed Drop the 0-RTT packets for a listener without early data configuration enabled. --- src/xprt_quic.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/xprt_quic.c b/src/xprt_quic.c index a181c8f0e..15bcd387b 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -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; }