@@ -1403,6 +1403,30 @@ QuicBindingDropBlockedSourcePorts(
14031403 return FALSE;
14041404}
14051405
1406+ BOOLEAN
1407+ QuicPacketIsTypeHandshake (
1408+ _In_ const QUIC_RX_PACKET * Packet
1409+ )
1410+ {
1411+ CXPLAT_DBG_ASSERT (Packet -> ValidatedHeaderInv );
1412+
1413+ if (!Packet -> Invariant -> IsLongHeader ) {
1414+ return FALSE;
1415+ }
1416+
1417+ switch (Packet -> Invariant -> LONG_HDR .Version ) {
1418+ case QUIC_VERSION_1 :
1419+ case QUIC_VERSION_DRAFT_29 :
1420+ case QUIC_VERSION_MS_1 :
1421+ return Packet -> LH -> Type != QUIC_INITIAL_V1 ;
1422+
1423+ case QUIC_VERSION_2 :
1424+ return Packet -> LH -> Type != QUIC_INITIAL_V2 ;
1425+ }
1426+
1427+ return FALSE;
1428+ }
1429+
14061430//
14071431// Looks up or creates a connection to handle a chain of packets.
14081432// Returns TRUE if the packets were delivered, and FALSE if they should be
@@ -1421,15 +1445,18 @@ QuicBindingDeliverPackets(
14211445 CXPLAT_DBG_ASSERT (Packets -> ValidatedHeaderInv );
14221446
14231447 //
1424- // For client owned bindings (for which we always control the CID) or for
1425- // short header packets for server owned bindings, the packet's destination
1426- // connection ID (DestCid) is the key for looking up the corresponding
1427- // connection object. The DestCid encodes the partition ID (PID) that can
1428- // be used for partitioning the look up table.
1448+ // For situations where we fully control the destination CID, we want to
1449+ // use the DestCid based lookup. The DestCid encodes the partition ID (PID)
1450+ // that can be used for partitioning the look up table.
1451+ //
1452+ // We always control DestCid for client-owned bindings. For server-owned
1453+ // bindings, we control the DCIDs for all except the very first packet
1454+ // sent by the server. For simplicity, we do DestDcid-based lookup only
1455+ // for 1-RTT (short-header) and Handshake packets.
14291456 //
1430- // For long header packets for server owned bindings, the packet's DestCid
1431- // was not necessarily generated locally, so cannot be used for lookup.
1432- // Instead, a hash of the remote address/port and source CID is used.
1457+ // For other packets (Initial and 0-RTT) for server owned bindings, the
1458+ // packet's DestCid was not necessarily generated locally, so cannot be used
1459+ // for lookup. Instead, a hash of the remote address/port and source CID is used.
14331460 //
14341461 // If the lookup fails, and if there is a listener on the local 2-Tuple,
14351462 // then a new connection is created and inserted into the binding's lookup
@@ -1447,7 +1474,7 @@ QuicBindingDeliverPackets(
14471474 //
14481475
14491476 QUIC_CONNECTION * Connection ;
1450- if (!Binding -> ServerOwned || Packets -> IsShortHeader ) {
1477+ if (!Binding -> ServerOwned || Packets -> IsShortHeader || QuicPacketIsTypeHandshake ( Packets ) ) {
14511478 Connection =
14521479 QuicLookupFindConnectionByLocalCid (
14531480 & Binding -> Lookup ,
0 commit comments