@@ -1821,7 +1821,7 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
1821
1821
return false;
1822
1822
}
1823
1823
1824
- if (!rpl_control_is_dodag_parent_candidate (cur , ll_address , 0 )) {
1824
+ if (!rpl_control_is_dodag_parent_candidate (cur , ll_address , cur -> ws_info -> cfg -> gen . rpl_parent_candidate_max )) {
1825
1825
//NUD Not needed for if neighbour is not parent candidate
1826
1826
return false;
1827
1827
}
@@ -2381,7 +2381,7 @@ static bool ws_rpl_candidate_soft_filtering(protocol_interface_info_entry_t *cur
2381
2381
{
2382
2382
//Already many candidates
2383
2383
uint16_t candidate_list_size = rpl_control_candidate_list_size (cur , instance );
2384
- if (candidate_list_size > cur -> ws_info -> cfg -> gen .rpl_parent_candidate_max ) {
2384
+ if (candidate_list_size >= cur -> ws_info -> cfg -> gen .rpl_parent_candidate_max ) {
2385
2385
return false;
2386
2386
}
2387
2387
@@ -2427,6 +2427,19 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle,
2427
2427
ws_neighbor_temp_class_t * entry = ws_llc_get_multicast_temp_entry (cur , mac64 );
2428
2428
2429
2429
if (!ws_rpl_candidate_soft_filtering (cur , instance )) {
2430
+
2431
+ //Acept only better than own rank here
2432
+ if (candidate_rank >= rpl_control_current_rank (instance )) {
2433
+ //Do not accept no more siblings
2434
+ return false;
2435
+ }
2436
+
2437
+ uint16_t candidate_list_size = rpl_control_candidate_list_size (cur , instance );
2438
+ if (candidate_list_size > cur -> ws_info -> cfg -> gen .rpl_parent_candidate_max + 1 ) {
2439
+ //Accept only 1 better 1 time
2440
+ return false;
2441
+ }
2442
+
2430
2443
if (!neigh_buffer .neighbor ) {
2431
2444
//Do not accept any new in that Place
2432
2445
return false;
@@ -2459,42 +2472,6 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle,
2459
2472
if (neigh_buffer .neighbor ) {
2460
2473
return true;
2461
2474
}
2462
- #if 0
2463
- if (!rpl_control_find_worst_neighbor (cur , instance , replacing )) {
2464
- return false;
2465
- }
2466
-
2467
- // +2 Is for PAN ID space
2468
- memcpy (mac64 + 2 , replacing + 8 , 8 );
2469
- mac64 [2 ] ^= 2 ;
2470
-
2471
- if (ws_etx_read (cur , ADDR_802_15_4_LONG , mac64 ) == 0xffff ) {
2472
- //Not proped yet because ETX is 0xffff
2473
- return false;
2474
- }
2475
-
2476
- uint16_t etx = 0 ;
2477
- if (neigh_buffer .neighbor ) {
2478
- etx = etx_local_etx_read (cur -> id , neigh_buffer .neighbor -> index );
2479
- }
2480
-
2481
- // Accept now only better one's when max candidates selected and max candidate list size is reached
2482
- if (!rpl_possible_better_candidate (cur , instance , replacing , candidate_rank , etx )) {
2483
- return false;
2484
- }
2485
- //TODO if replacing has poor ETX, put it in blacklist as "poor ETX" to prevent reselection
2486
- //Mark That We can try remove replaced link
2487
- replace_ok = true;
2488
-
2489
- neigh_create :
2490
-
2491
-
2492
- if (neigh_buffer .neighbor ) {
2493
- //Use Already discovered entry
2494
- create_ok = true;
2495
- goto neigh_create_ok ;
2496
- }
2497
- #endif
2498
2475
2499
2476
if (!entry ) {
2500
2477
//No Multicast Entry Available
0 commit comments