Skip to content

Commit c387fda

Browse files
author
Juha Heiskanen
committed
NS Probe limiter accept only 2 probe at 16 seconds period.
Change-Id: If5e9cc443fa8a43ff4b8b00dadc0a2d97d887e1f
1 parent a58c71b commit c387fda

File tree

4 files changed

+37
-1
lines changed

4 files changed

+37
-1
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,11 +1663,16 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
16631663
activate_nud = true;
16641664
} else {
16651665

1666+
if (cur->ws_info->ns_probed_timer > 7) {
1667+
return false;//Accept 1 probe start / every seconds call
1668+
}
1669+
16661670
ws_bootsrap_create_ll_address(ll_address, entry_ptr->mac64);
16671671
if (!rpl_control_probe_parent_candidate(cur, ll_address)) {
16681672
return false;
16691673
}
16701674

1675+
16711676
uint32_t probe_period = WS_PROBE_INIT_BASE_SECONDS << etx_entry->etx_samples;
16721677
uint32_t time_block = 1 << etx_entry->etx_samples;
16731678
if (time_from_start >= probe_period) {
@@ -1697,7 +1702,14 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
16971702
ws_neighbor->accelerated_etx_probe = false;
16981703
entry->timer = 1;
16991704
}
1705+
17001706
entry->nud_process = nud_proces;
1707+
if (!nud_proces) {
1708+
cur->ws_info->ns_probed_timer += 8;
1709+
if (cur->ws_info->ns_probed_timer > 32) {
1710+
cur->ws_info->ns_probed_timer = 32;
1711+
}
1712+
}
17011713

17021714
return true;
17031715
}
@@ -2141,6 +2153,11 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle,
21412153
return false;
21422154
}
21432155

2156+
if (cur->ws_info->ns_probed_timer > 8) {
2157+
//2 probe have been done so Try to avoid put more before accept new one's
2158+
return false;
2159+
}
2160+
21442161
if (blacklist_reject(ll_parent_address)) {
21452162
// Rejected by blacklist
21462163
return false;
@@ -2158,6 +2175,7 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle,
21582175

21592176
ws_bootstrap_neighbor_info_request(cur, mac64, &neigh_buffer, false);
21602177

2178+
21612179
if (rpl_control_candidate_list_size(cur, instance) < cur->ws_info->rpl_parent_candidate_max) {
21622180
//Not reach max value yet accept then all go to create neigh table
21632181
goto neigh_create;
@@ -2637,6 +2655,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
26372655
cur->ws_info->trickle_pc_running = false;
26382656
cur->ws_info->trickle_pas_running = false;
26392657
cur->ws_info->trickle_pcs_running = false;
2658+
cur->ws_info->ns_probed_timer = 0;
26402659

26412660
if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
26422661
tr_info("Border router start network");
@@ -2953,6 +2972,15 @@ void ws_bootstrap_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t s
29532972
ws_bootstrap_event_discovery_start(cur);
29542973
}
29552974
}
2975+
2976+
//Probe limiter timer
2977+
if (cur->ws_info->ns_probed_timer) {
2978+
if (cur->ws_info->ns_probed_timer > seconds) {
2979+
cur->ws_info->ns_probed_timer -= seconds;
2980+
} else {
2981+
cur->ws_info->ns_probed_timer = 0;
2982+
}
2983+
}
29562984
}
29572985

29582986
void ws_primary_parent_update(protocol_interface_info_entry_t *interface, mac_neighbor_table_entry_t *neighbor)

source/6LoWPAN/ws/ws_common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ typedef struct ws_info_s {
9191
// default fhss parameters for this device
9292
uint8_t fhss_uc_dwell_interval;
9393
uint8_t fhss_bc_dwell_interval;
94+
//NS Probe lmiter
95+
uint32_t ns_probed_timer;
96+
9497
uint32_t fhss_bc_interval;
9598
uint8_t fhss_uc_channel_function;
9699
uint8_t fhss_bc_channel_function;

source/RPL/rpl_policy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ uint16_t rpl_policy_dio_parent_selection_delay(rpl_domain_t *domain)
238238
{
239239
(void)domain;
240240

241-
return 15; /* seconds */
241+
return 19; /* seconds */
242242
}
243243

244244
uint16_t rpl_policy_repair_initial_dis_delay(rpl_domain_t *domain)

source/Service_Libs/etx/etx.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ void etx_transm_attempts_update(int8_t interface_id, uint8_t attempts, bool succ
202202
if (!entry) {
203203
return;
204204
}
205+
205206
if (entry->etx_samples < 7) {
206207
entry->etx_samples++;
207208
}
@@ -216,6 +217,10 @@ void etx_transm_attempts_update(int8_t interface_id, uint8_t attempts, bool succ
216217
}
217218

218219
etx_calculation(entry, storage->attempts_count, storage->received_acks, attribute_index);
220+
221+
if (entry->etx_samples < 7 && !success) {
222+
entry->etx_samples = 7; //Stop Probing to failure
223+
}
219224
return;
220225
}
221226

0 commit comments

Comments
 (0)