@@ -249,44 +249,25 @@ impl<Config: endpoint::Config> Manager<Config> {
249
249
) -> Result < ( Id , AmplificationOutcome ) , DatagramDropReason > {
250
250
let valid_initial_received = self . valid_initial_received ( ) ;
251
251
252
- if let Some ( ( id, path) ) = self . path_mut ( path_handle) {
253
- let source_cid_changed = datagram
254
- . source_connection_id
255
- . is_some_and ( |scid| scid != path. peer_connection_id && valid_initial_received) ;
256
-
257
- if source_cid_changed {
258
- //= https://www.rfc-editor.org/rfc/rfc9000#section-7.2
259
- //# Once a client has received a valid Initial packet from the server, it MUST
260
- //# discard any subsequent packet it receives on that connection with a
261
- //# different Source Connection ID.
262
-
263
- //= https://www.rfc-editor.org/rfc/rfc9000#section-7.2
264
- //# Any further changes to the Destination Connection ID are only
265
- //# permitted if the values are taken from NEW_CONNECTION_ID frames; if
266
- //# subsequent Initial packets include a different Source Connection ID,
267
- //# they MUST be discarded.
268
-
269
- return Err ( DatagramDropReason :: InvalidSourceConnectionId ) ;
270
- }
271
-
272
- // Update the address if it was resolved
273
- //
274
- // NOTE: We don't update the server address since this would cause the client to drop
275
- // packets from the server.
276
-
277
- //= https://www.rfc-editor.org/rfc/rfc9000#section-9
278
- //# If a client receives packets from an unknown server address, the client MUST discard these packets.
279
-
252
+ let matched_path = if handshake_confirmed {
253
+ self . path_mut ( path_handle)
254
+ } else {
280
255
//= https://www.rfc-editor.org/rfc/rfc9000#section-9
281
- //# If the peer sent the disable_active_migration transport parameter, an endpoint also MUST NOT send
282
- //# packets (including probing packets; see Section 9.1) from a different local address to the address
283
- //# the peer used during the handshake, unless the endpoint has acted on a preferred_address transport
284
- //# parameter from the peer.
285
- if Config :: ENDPOINT_TYPE . is_client ( ) {
286
- path. handle . maybe_update ( path_handle) ;
287
- }
256
+ //# The design of QUIC relies on endpoints retaining a stable address
257
+ //# for the duration of the handshake. An endpoint MUST NOT initiate
258
+ //# connection migration before the handshake is confirmed, as defined
259
+ //# in section 4.1.2 of [QUIC-TLS].
260
+
261
+ // NOTE: while we must not _initiate_ a migration before the handshake is done,
262
+ // it doesn't mean we can't handle the packet. So instead we pick the default path.
263
+ let path_id = self . active_path_id ( ) ;
264
+ let path = self . active_path_mut ( ) ;
265
+ Some ( ( path_id, path) )
266
+ } ;
288
267
289
- let amplification_outcome = path. on_bytes_received ( datagram. payload_len ) ;
268
+ if let Some ( ( id, path) ) = matched_path {
269
+ let amplification_outcome =
270
+ path. on_datagram_received ( path_handle, datagram, valid_initial_received) ?;
290
271
return Ok ( ( id, amplification_outcome) ) ;
291
272
}
292
273
@@ -297,15 +278,6 @@ impl<Config: endpoint::Config> Manager<Config> {
297
278
return Err ( DatagramDropReason :: UnknownServerAddress ) ;
298
279
}
299
280
300
- //= https://www.rfc-editor.org/rfc/rfc9000#section-9
301
- //# The design of QUIC relies on endpoints retaining a stable address
302
- //# for the duration of the handshake. An endpoint MUST NOT initiate
303
- //# connection migration before the handshake is confirmed, as defined
304
- //# in section 4.1.2 of [QUIC-TLS].
305
- if !handshake_confirmed {
306
- return Err ( DatagramDropReason :: ConnectionMigrationDuringHandshake ) ;
307
- }
308
-
309
281
//= https://www.rfc-editor.org/rfc/rfc9000#section-9
310
282
//# If the peer
311
283
//# violates this requirement, the endpoint MUST either drop the incoming
0 commit comments