]> git.feebdaed.xyz Git - 0xmirror/nginx.git/commitdiff
QUIC: ignore version negotiation packets.
authorRoman Arutyunyan <arut@nginx.com>
Fri, 13 Dec 2024 09:25:26 +0000 (13:25 +0400)
committerRoman Arutyunyan <arutyunyan.roman@gmail.com>
Thu, 26 Dec 2024 14:58:05 +0000 (18:58 +0400)
Previously, such packets were treated as long header packets with unknown
version 0, and a version negotiation packet was sent in response.  This
could be used to set up an infinite traffic reflect loop with another nginx
instance.

Now version negotiation packets are ignored.  As per RFC 9000, Section 6.1:

  An endpoint MUST NOT send a Version Negotiation packet in response to
  receiving a Version Negotiation packet.

src/event/quic/ngx_event_quic_transport.c

index fba098caa95ee05bf6211053ac4f41f33b51f033..bb13447b55f1931106dcb5d150c7b6352c5ad347 100644 (file)
@@ -295,6 +295,11 @@ ngx_quic_parse_packet(ngx_quic_header_t *pkt)
         return NGX_ERROR;
     }
 
+    if (pkt->version == 0) {
+        /* version negotiation */
+        return NGX_ERROR;
+    }
+
     if (!ngx_quic_supported_version(pkt->version)) {
         return NGX_ABORT;
     }