Skip to content

Commit 2d3aff9

Browse files
author
Arto Kinnunen
authored
Delete parent mle-entry in case of parent lost or updated (ARMmbed#1707)
-Delete scanned parent MLE entry in child_id_req timeout. -Delete parent MLE entry if parent changed short address -Delete parent MLE entry if REED receives child_id_req from own parent -Delete parent MLE entry if child_update_req contains error status
1 parent b43db5f commit 2d3aff9

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

source/6LoWPAN/Thread/thread_host_bootstrap.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,13 +1026,12 @@ static bool thread_child_id_req_timeout(int8_t interface_id, uint16_t msgId, boo
10261026

10271027
entry_temp = mle_class_get_entry_by_ll64(cur->id, scanned_parent->linkMarginToParent, ll64, false, NULL);
10281028
if (entry_temp) {
1029+
mle_class_remove_entry(cur->id, entry_temp);
10291030
if (thread_check_is_this_my_parent(cur, entry_temp)) {
10301031
tr_debug("No parent resp - any-attach");
10311032
thread_bootstrap_connection_error(interface_id, CON_ERROR_NETWORK_ATTACH_FAIL, NULL);
10321033
goto exit;
10331034
}
1034-
// remove scanned_parent mle-entry as it was not my parent
1035-
mle_class_remove_entry(cur->id, entry_temp);
10361035
}
10371036
}
10381037

source/6LoWPAN/Thread/thread_mle_message_handler.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ static void thread_parse_advertisement(protocol_interface_info_entry_t *cur, mle
352352
/* Check parent status */
353353
if (!thread_attach_active_router(cur) && my_parent) {
354354
if (!thread_parse_advertisement_from_parent(cur, &leaderData, shortAddress)) {
355+
mle_class_remove_entry(cur->id, entry_temp);
355356
return;
356357
}
357358
}
@@ -770,6 +771,7 @@ static void thread_parse_child_update_response(protocol_interface_info_entry_t *
770771
if (mle_tlv_read_8_bit_tlv(MLE_TYPE_STATUS, mle_msg->data_ptr, mle_msg->data_length, &status) &&
771772
status == 1 && thread_check_is_this_my_parent(cur, entry_temp)) {
772773
tr_debug("parent has connection error");
774+
mle_class_remove_entry(cur->id, entry_temp);
773775
thread_bootstrap_connection_error(cur->id, CON_PARENT_CONNECT_DOWN, NULL);
774776
return;
775777
}

source/6LoWPAN/Thread/thread_router_bootstrap.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,10 +1571,14 @@ void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *
15711571
return;
15721572
}
15731573

1574-
// If we are in REED mode and receive child IR request from our parent, call connection error.
1574+
// If we are in REED mode and receive child ID request from our parent, call connection error.
15751575
if (thread_am_reed(cur)) {
15761576
if (thread_router_parent_address_check(cur, mle_msg->packet_src_address)) {
15771577
tr_debug("Child ID req from own parent -> connection error");
1578+
entry_temp = mle_class_get_entry_by_ll64(cur->id, linkMargin, mle_msg->packet_src_address, false, NULL);
1579+
if (entry_temp) {
1580+
mle_class_remove_entry(cur->id, entry_temp);
1581+
}
15781582
thread_bootstrap_connection_error(cur->id, CON_PARENT_CONNECT_DOWN, NULL);
15791583
return;
15801584
}
@@ -1903,7 +1907,8 @@ void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *
19031907

19041908
if (mle_tlv_read_8_bit_tlv(MLE_TYPE_STATUS, mle_msg->data_ptr, mle_msg->data_length, &status)) {
19051909
if (1 == status && thread_check_is_this_my_parent(cur, entry_temp)) {
1906-
tr_debug("parent has removed REED");
1910+
tr_debug("Parent has removed REED");
1911+
mle_class_remove_entry(cur->id, entry_temp);
19071912
thread_bootstrap_connection_error(cur->id, CON_PARENT_CONNECT_DOWN, NULL);
19081913
}
19091914
return;
@@ -2251,7 +2256,6 @@ int thread_router_bootstrap_route_tlv_push(protocol_interface_info_entry_t *cur,
22512256
thread_routing_leader_connection_validate(cur->thread_info,routing->networkFragmentationTimer);
22522257
routing->networkFragmentationTimer = 0;
22532258
if (thread_validate_own_routeid_from_new_mask(router_id_mask, thread_router_id_from_addr(mac16)) != 0) {
2254-
22552259
tr_debug("RouterID not valid any More");
22562260
thread_bootstrap_connection_error(cur->id, CON_ERROR_NETWORK_KICK, NULL);
22572261
return 0;

0 commit comments

Comments
 (0)