@@ -333,11 +333,7 @@ int thread_bootstrap_partition_process(protocol_interface_info_entry_t *cur, uin
333
333
tr_debug ("Dropping advertisement from old partition without sequence number increase" );
334
334
return -2 ;
335
335
}
336
- if (heard_partition_routers == 0 && active_routers == 1 ) {
337
- //heard a REED and I am in a singleton partition so merge
338
- tr_debug ("Heard a REED and I am a singleton - merge" );
339
- return 2 ;
340
- }
336
+
341
337
/*Rule 0: If we are going to form Higher partition than heard we dont try to attach to lower ones
342
338
*/
343
339
if (thread_extension_enabled (cur ) &&
@@ -351,6 +347,12 @@ int thread_bootstrap_partition_process(protocol_interface_info_entry_t *cur, uin
351
347
}
352
348
}
353
349
350
+ if ((heard_partition_routers == 0 && active_routers == 1 ) && thread_am_router (cur )) {
351
+ //heard a REED and I am a lonely router in a singleton partition, so merge
352
+ tr_debug ("Heard a REED and I am a singleton - merge" );
353
+ return 2 ;
354
+ }
355
+
354
356
//Rule 1: A non-singleton Thread Network Partition always has higher priority than a singleton Thread Network Partition
355
357
if (heard_partition_routers > 1 && active_routers == 1 ) {
356
358
tr_debug ("Heard a nonsingleton and i am a singleton" );
@@ -1815,7 +1817,7 @@ static void thread_dhcp_client_gua_error_cb(int8_t interface, uint8_t dhcp_addr[
1815
1817
}
1816
1818
}
1817
1819
1818
- static bool thread_dhcpv6_address_valid (uint8_t * prefixPtr , if_address_list_t * list )
1820
+ bool thread_dhcpv6_address_entry_available (uint8_t * prefixPtr , if_address_list_t * list )
1819
1821
{
1820
1822
bool addressReady = false;
1821
1823
ns_list_foreach (if_address_entry_t , entry , list ) {
@@ -2509,8 +2511,8 @@ int thread_bootstrap_network_data_process(protocol_interface_info_entry_t *cur,
2509
2511
memcpy (addr , cur -> thread_info -> threadPrivatePrefixInfo .ulaPrefix , 8 );
2510
2512
memcpy (& addr [8 ], ADDR_SHORT_ADR_SUFFIC , 6 );
2511
2513
common_write_16_bit (genericService .routerID , & addr [14 ]);
2512
- thread_dhcp_client_global_address_delete (cur -> id , addr , prefixTlv .Prefix );
2513
2514
tr_debug ("Delete DHCPv6 given address" );
2515
+ thread_dhcp_client_global_address_delete (cur -> id , addr , prefixTlv .Prefix );
2514
2516
}
2515
2517
}
2516
2518
@@ -2737,7 +2739,7 @@ void thread_bootstrap_network_prefixes_process(protocol_interface_info_entry_t *
2737
2739
bool validToLearnRoutes , validToLearOnMeshRoute ;
2738
2740
thread_network_server_data_entry_t * weHostService = NULL ;
2739
2741
uint16_t routerId ;
2740
- tr_debug ("Network Data:" );
2742
+ tr_debug ("Network Data process :" );
2741
2743
routerId = cur -> mac_parameters -> mac_short_address ;
2742
2744
thread_network_data_cache_entry_t * networkData ;
2743
2745
networkData = & cur -> thread_info -> networkDataStorage ;
@@ -2800,14 +2802,14 @@ void thread_bootstrap_network_prefixes_process(protocol_interface_info_entry_t *
2800
2802
}
2801
2803
}
2802
2804
2803
- if (!thread_dhcpv6_address_valid (curPrefix -> servicesPrefix , & cur -> ip_addresses )) {
2805
+ if (!thread_dhcpv6_address_entry_available (curPrefix -> servicesPrefix , & cur -> ip_addresses )) {
2804
2806
thread_addr_write_mesh_local_16 (addr , curBorderRouter -> routerID , cur -> thread_info );
2805
-
2807
+ /* Do not allow multiple DHCP solicits from one prefix => delete previous */
2808
+ thread_dhcp_client_global_address_delete (cur -> id , NULL , curPrefix -> servicesPrefix );
2806
2809
if (thread_dhcp_client_get_global_address (cur -> id , addr , curPrefix -> servicesPrefix , cur -> mac , thread_dhcp_client_gua_error_cb ) == 0 ) {
2807
2810
tr_debug ("GP Address Requested" );
2808
2811
}
2809
2812
}
2810
-
2811
2813
} else {
2812
2814
/* All end device types perform RLOC16 -> 0xfffe
2813
2815
replacement if stable network data was requested. */
@@ -2820,7 +2822,7 @@ void thread_bootstrap_network_prefixes_process(protocol_interface_info_entry_t *
2820
2822
}
2821
2823
2822
2824
if (curBorderRouter -> P_preferred ) {
2823
- if (!thread_dhcpv6_address_valid (curPrefix -> servicesPrefix , & cur -> ip_addresses )) {
2825
+ if (!thread_dhcpv6_address_entry_available (curPrefix -> servicesPrefix , & cur -> ip_addresses )) {
2824
2826
icmpv6_slaac_address_add (cur , curPrefix -> servicesPrefix , curPrefix -> servicesPrefixLen , 0xffffffff , 0xffffffff , true, SLAAC_IID_DEFAULT );
2825
2827
}
2826
2828
}
0 commit comments