Skip to content

Commit 41b84e4

Browse files
Juha Heiskanenjuhhei01
authored andcommitted
Added check when weighting rule update must do network scan.
Network scan is only enabled if current network weighting is smaller than we support a rule when weighting has stringer rule than partition ID. Change-Id: I1322e90f0e76425c97dfc189faa1f842695b2053
1 parent 0215058 commit 41b84e4

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

source/6LoWPAN/Thread/thread_common.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,9 @@ thread_leader_data_t *thread_leader_data_generate(void)
379379
{
380380
thread_leader_data_t *leader_data;
381381
leader_data = ns_dyn_mem_alloc(sizeof(thread_leader_data_t));
382+
if (leader_data) {
383+
memset(leader_data,0,sizeof(thread_leader_data_t));
384+
}
382385
return leader_data;
383386
}
384387

source/6LoWPAN/Thread/thread_management_if.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#include "6LoWPAN/Thread/thread_tmfcop_lib.h"
6363
#include "6LoWPAN/Thread/thread_constants.h"
6464
#include "6LoWPAN/Thread/thread_extension_bootstrap.h"
65+
#include "6LoWPAN/Thread/thread_extension.h"
6566
#include "6LoWPAN/Bootstraps/protocol_6lowpan.h"
6667
#include "RPL/rpl_control.h" // insanity - bootstraps shouldn't be doing each others' clean-up
6768
#include "MLE/mle.h"
@@ -1455,10 +1456,21 @@ int thread_management_partition_weighting_set(int8_t interface_id, uint8_t parti
14551456
return 0;
14561457
}
14571458

1459+
bool trig_network_scan = false;
1460+
if (cur->thread_info->thread_leader_data) {
1461+
if (cur->thread_info->thread_leader_data->weighting < partition_weighting) {
1462+
trig_network_scan = true;
1463+
}
1464+
}
1465+
14581466
cur->thread_info->partition_weighting = partition_weighting;
1467+
14591468
if (cur->lowpan_info & INTERFACE_NWK_ACTIVE) {
1460-
// bootstrap active and weighting has changed
1461-
thread_bootstrap_reset_restart(interface_id);
1469+
if (trig_network_scan && thread_extension_enabled(cur)) {
1470+
thread_nvm_store_link_info_clear();
1471+
// bootstrap active and weighting has changed
1472+
thread_bootstrap_reset_restart(interface_id);
1473+
}
14621474
}
14631475

14641476
return 0;

0 commit comments

Comments
 (0)