@@ -1951,51 +1951,7 @@ void picoquic_demote_path(picoquic_cnx_t* cnx, int path_index, uint64_t current_
1951
1951
}
1952
1952
}
1953
1953
1954
- /* Promote path to default. This happens when a new path is verified, at the end
1955
- * of a migration, and becomes the new default path.
1956
- */
1957
-
1958
- void picoquic_promote_path_to_default (picoquic_cnx_t * cnx , int path_index , uint64_t current_time )
1959
- {
1960
- if (path_index > 0 && path_index < cnx -> nb_paths ) {
1961
- picoquic_path_t * path_x = cnx -> path [path_index ];
1962
-
1963
- if (cnx -> path [path_index ]-> path_is_preferred_path ) {
1964
- /* this is a migration to the preferred path requested by the server */
1965
- if (cnx -> client_mode ) {
1966
- cnx -> remote_parameters .migration_disabled = 0 ;
1967
- }
1968
- else {
1969
- cnx -> local_parameters .migration_disabled = 0 ;
1970
- }
1971
- }
1972
1954
1973
- if (cnx -> quic -> F_log != NULL || cnx -> f_binlog != NULL ) {
1974
- char src_ip [128 ];
1975
- char dst_ip [128 ];
1976
-
1977
- picoquic_log_app_message (cnx , "Path %d promoted to default at T=%fs, Local: %s, Remote: %s" ,
1978
- path_index , (double )(current_time - cnx -> start_time ) / 1000000.0 ,
1979
- picoquic_addr_text ((struct sockaddr * ) & cnx -> path [path_index ]-> first_tuple -> local_addr , src_ip , sizeof (src_ip )),
1980
- picoquic_addr_text ((struct sockaddr * ) & cnx -> path [path_index ]-> first_tuple -> peer_addr , dst_ip , sizeof (dst_ip )));
1981
- }
1982
-
1983
- /* Set the congestion algorithm for the new path */
1984
- if (cnx -> congestion_alg != NULL ) {
1985
- cnx -> congestion_alg -> alg_init (cnx , path_x , cnx -> congestion_alg_option_string , current_time );
1986
- }
1987
-
1988
- /* Mark old path as demoted */
1989
- picoquic_demote_path (cnx , 0 , current_time , 0 , NULL );
1990
-
1991
- /* Swap */
1992
- cnx -> path [path_index ] = cnx -> path [0 ];
1993
- cnx -> path [0 ] = path_x ;
1994
-
1995
- /* Update the secret */
1996
- (void )picoquic_register_net_secret (cnx );
1997
- }
1998
- }
1999
1955
2000
1956
/* set the challenge used for a tuple */
2001
1957
void picoquic_set_tuple_challenge (picoquic_tuple_t * tuple , uint64_t current_time , int use_constant_challenges )
@@ -2331,6 +2287,7 @@ int picoquic_probe_new_tuple(picoquic_cnx_t* cnx, picoquic_path_t* path_x, struc
2331
2287
/* There was no NAT ongoing NAT rebinding, we created one, we need to initiate path challenges. */
2332
2288
picoquic_set_tuple_challenge (tuple , current_time , cnx -> quic -> use_constant_challenges );
2333
2289
tuple -> challenge_required = 1 ;
2290
+ tuple -> to_preferred_address = to_preferred_address ;
2334
2291
}
2335
2292
}
2336
2293
}
@@ -2343,7 +2300,7 @@ int picoquic_probe_new_path_ex(picoquic_cnx_t* cnx, const struct sockaddr* addr_
2343
2300
{
2344
2301
int path_id = -1 ;
2345
2302
2346
- if (!cnx -> is_multipath_enabled ) {
2303
+ if (!cnx -> is_multipath_enabled || to_preferred_address ) {
2347
2304
return picoquic_probe_new_tuple (cnx , cnx -> path [0 ], addr_peer , addr_local , if_index , current_time , to_preferred_address );
2348
2305
}
2349
2306
@@ -2368,7 +2325,6 @@ int picoquic_probe_new_path_ex(picoquic_cnx_t* cnx, const struct sockaddr* addr_
2368
2325
path_x -> path_is_published = 1 ;
2369
2326
picoquic_register_path (cnx , path_x );
2370
2327
picoquic_set_path_challenge (cnx , path_id , current_time );
2371
- path_x -> path_is_preferred_path = to_preferred_address ;
2372
2328
path_x -> is_nat_challenge = 0 ;
2373
2329
// path_x->first_tuple->if_index = if_index;
2374
2330
}
@@ -3954,9 +3910,8 @@ picoquic_cnx_t* picoquic_create_cnx(picoquic_quic_t* quic,
3954
3910
memcpy (& cnx -> local_parameters , & quic -> default_tp , sizeof (picoquic_tp_t ));
3955
3911
/* If the default parameters include preferred address, document it */
3956
3912
if (cnx -> local_parameters .prefered_address .is_defined ) {
3957
- /* Create an additional CID -- this depends on the multipath variant being already negotiated */
3958
- uint64_t unique_path_id = (cnx -> is_multipath_enabled ) ? 1 : 0 ;
3959
- picoquic_local_cnxid_t * cnxid1 = picoquic_create_local_cnxid (cnx , unique_path_id , NULL , start_time );
3913
+ /* Create an additional CID -- always for path 0, even if multipath */
3914
+ picoquic_local_cnxid_t * cnxid1 = picoquic_create_local_cnxid (cnx , 0 , NULL , start_time );
3960
3915
if (cnxid1 != NULL ){
3961
3916
/* copy the connection ID into the local parameter */
3962
3917
cnx -> local_parameters .prefered_address .connection_id = cnxid1 -> cnx_id ;
0 commit comments