]> git.kaiwu.me - nginx.git/commitdiff
QUIC: Check if CID has been used in stateless reset check
authorMartin Duke <m.duke@f5.com>
Tue, 12 Oct 2021 08:56:49 +0000 (11:56 +0300)
committerMartin Duke <m.duke@f5.com>
Tue, 12 Oct 2021 08:56:49 +0000 (11:56 +0300)
Section 10.3.1 of RFC9000 requires this check.

src/event/quic/ngx_event_quic.c

index 478fc8461f9998b7a3e444aebf9c8d7863030ab9..1217d02309f030d2b37aab0c04100757bed338ce 100644 (file)
@@ -370,8 +370,11 @@ ngx_quic_process_stateless_reset(ngx_connection_t *c, ngx_quic_header_t *pkt)
     {
         cid = ngx_queue_data(q, ngx_quic_client_id_t, queue);
 
-        if (cid->seqnum == 0) {
-            /* no stateless reset token in initial connection id */
+        if (cid->seqnum == 0 || cid->refcnt == 0) {
+            /*
+             * No stateless reset token in initial connection id.
+             * Don't accept a token from an unused connection id.
+             */
             continue;
         }