Skip to content

deps: update to ngtcp2 0.8.1 and nghttp3 0.7.0

This updates the two existing QUIC dependencies to the latest tagged versions as described in https://github.com/nodejs/node/pull/44619.

This obsoletes two commits from @jasnell's #44325 in order to make the QUIC PR simpler to review (with his permission).


@jasnell This is not the same update as in your PR. Instead, I opted for the latest tagged versions so that we won't have to play catch-up immediately afterwards. Unfortunately, it does not compile cleanly. As far as I can tell, the only compilation error is the use of ngtcp2_pkt_decode_version_cid, and this patch appears to resolve the compilation problem:

diff --git a/src/quic/endpoint.cc b/src/quic/endpoint.cc
index b6c855f91c..e8e10abb5c 100644
--- a/src/quic/endpoint.cc
+++ b/src/quic/endpoint.cc
@@ -1074,11 +1074,7 @@ void Endpoint::Receive(size_t nread,
 
   ngtcp2_vec vec = store;
 
-  quic_version pversion;
-  const uint8_t* pdcid;
-  size_t pdcidlen;
-  const uint8_t* pscid;
-  size_t pscidlen;
+  ngtcp2_version_cid pversion;
 
   // This is our first check to see if the received data can be processed as a
   // QUIC packet. If this fails, then the QUIC packet header is invalid and
@@ -1086,10 +1082,6 @@ void Endpoint::Receive(size_t nread,
   // valid QUIC header but there is still no guarantee that the packet can be
   // successfully processed.
   if (ngtcp2_pkt_decode_version_cid(&pversion,
-                                    &pdcid,
-                                    &pdcidlen,
-                                    &pscid,
-                                    &pscidlen,
                                     vec.base,
                                     vec.len,
                                     NGTCP2_MAX_CIDLEN) < 0) {
@@ -1100,7 +1092,7 @@ void Endpoint::Receive(size_t nread,
   // API allows non-standard lengths, and we may want to allow non-standard
   // lengths later. But for now, we're going to ignore any packet with a
   // non-standard CID length.
-  if (pdcidlen > NGTCP2_MAX_CIDLEN || pscidlen > NGTCP2_MAX_CIDLEN)
+  if (pversion.dcidlen > NGTCP2_MAX_CIDLEN || pversion.scidlen > NGTCP2_MAX_CIDLEN)
     return;  // Ignore the packet!
 
   // Each QUIC peer has two CIDs: The Source Connection ID (or scid), and the
@@ -1112,8 +1104,8 @@ void Endpoint::Receive(size_t nread,
   // The dcid and scid below are the values sent from the peer received in the
   // current packet, so in this case, dcid represents who the peer sent the
   // packet too (this endpoint) and the scid represents who sent the packet.
-  CID dcid(pdcid, pdcidlen);
-  CID scid(pscid, pscidlen);
+  CID dcid(pversion.dcid, pversion.dcidlen);
+  CID scid(pversion.scid, pversion.scidlen);
 
   DEBUG_ARGS(this, "Received packet DCID %s (destination)", dcid);
   DEBUG_ARGS(this, "Received packet SCID %s (source)", scid)
@@ -1149,7 +1141,7 @@ void Endpoint::Receive(size_t nread,
 
     // For the current version of QUIC, it is a short header if there is no
     // scid.
-    bool is_short_header = (pversion == NGTCP2_PROTO_VER_MAX && !scid);
+    bool is_short_header = (pversion.version == NGTCP2_PROTO_VER_MAX && !scid);
 
     // Handle possible reception of a stateless reset token... If it is a
     // stateless reset, the packet will be handled with no additional action
@@ -1160,7 +1152,7 @@ void Endpoint::Receive(size_t nread,
       return;  // Stateless reset! Don't do any further processing.
 
     if (acceptInitialPacket(
-            pversion, dcid, scid, std::move(store), addr, remote_address)) {
+            pversion.version, dcid, scid, std::move(store), addr, remote_address)) {
       // Packet was successfully received.
       return IncrementStat(&EndpointStats::packets_received);
     }

(However, it could be that the semantics of the return value changed... I don't understand the ngtcp2 API yet.)

Merge request reports

Loading