Skip to content

Commit fd6ce04

Browse files
author
Juha Heiskanen
committed
Thread Child ml16 update clear old address queue's and registered address.
Change-Id: I7a735c941467de51997e7881d4f6c830fc7ac9b4
1 parent 99e6efa commit fd6ce04

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

source/6LoWPAN/Thread/thread_mle_message_handler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ static void thread_update_mle_entry(protocol_interface_info_entry_t *cur, mle_me
285285
if (short_address != entry_temp->mac16) {
286286
if (thread_router_addr_from_addr(entry_temp->mac16) == cur->thread_info->routerShortAddress) {
287287
thread_dynamic_storage_child_info_clear(cur->id, entry_temp);
288-
protocol_6lowpan_release_short_link_address_from_neighcache(cur, entry_temp->mac16);
288+
289289
}
290290
entry_temp->mac16 = short_address;
291291
/* throw MLME_GET request, short address is changed automatically in get request callback */

source/6LoWPAN/Thread/thread_network_synch.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
#include "Common_Protocols/icmpv6_radv.h"
6565
#include "MLE/mle.h"
6666
#include "Service_Libs/mac_neighbor_table/mac_neighbor_table.h"
67+
#include "6LoWPAN/lowpan_adaptation_interface.h"
6768
#include "6LoWPAN/MAC/mac_helper.h"
6869

6970
#define TRACE_GROUP "tsyn"
@@ -192,15 +193,29 @@ void thread_dynamic_storage_child_info_store(protocol_interface_info_entry_t *cu
192193

193194
void thread_dynamic_storage_child_info_clear(int8_t interface_id, struct mac_neighbor_table_entry *child)
194195
{
196+
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);
197+
if (!cur) {
198+
return;
199+
}
195200
thread_sync_child_info_t *child_info = thread_dynamic_storage_child_info_find(interface_id, child);
196201

202+
197203
if (child_info) {
198204
// Clear child information
199205
memset(child_info, 0, sizeof(thread_sync_child_info_t));
200206
tr_debug("Dynamic storage: cleared child; mac16=%04x", child->mac16);
201-
return;
202207
}
203-
return;
208+
uint8_t temp_address[2];
209+
common_write_16_bit(child->mac16, temp_address);
210+
//Release Old short address entries
211+
lowpan_adaptation_free_messages_from_queues_by_address(cur, temp_address, ADDR_802_15_4_SHORT);
212+
/* As we are losing a link to a child address, we can assume that if we have an IP neighbour cache
213+
* mapping to that address, it is no longer valid. We must have been their parent, and they must be
214+
* finding a new parent, and hence a new 16-bit address. (Losing a link to a router address would not
215+
* invalidate our IP->16-bit mapping.)
216+
*/
217+
protocol_6lowpan_release_short_link_address_from_neighcache(cur, child->mac16);
218+
204219
}
205220

206221
static thread_sync_child_info_t *thread_dynamic_storage_child_info_find(int8_t interface_id, mac_neighbor_table_entry_t *child)

source/6LoWPAN/Thread/thread_router_bootstrap.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -969,13 +969,6 @@ int thread_router_bootstrap_reset_child_info(protocol_interface_info_entry_t *cu
969969
tr_debug("Child free %x", child->mac16);
970970
thread_dynamic_storage_child_info_clear(cur->id, child);
971971

972-
/* As we are losing a link to a child address, we can assume that if we have an IP neighbour cache
973-
* mapping to that address, it is no longer valid. We must have been their parent, and they must be
974-
* finding a new parent, and hence a new 16-bit address. (Losing a link to a router address would not
975-
* invalidate our IP->16-bit mapping.)
976-
*/
977-
protocol_6lowpan_release_short_link_address_from_neighcache(cur, child->mac16);
978-
979972
// If Child's RLOC16 appears in the Network Data send the RLOC16 to the Leader
980973
if (thread_network_data_services_registered(&cur->thread_info->networkDataStorage, child->mac16)) {
981974
tr_debug("Remove references to Child's RLOC16 from the Network Data");
@@ -1824,7 +1817,6 @@ void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *
18241817
// Was this previously our child? If yes, update.
18251818
if ((entry_temp->mac16 & THREAD_CHILD_MASK) && thread_router_addr_from_addr(entry_temp->mac16) == cur->thread_info->routerShortAddress) {
18261819
thread_dynamic_storage_child_info_clear(cur->id, entry_temp);
1827-
protocol_6lowpan_release_short_link_address_from_neighcache(cur, entry_temp->mac16);
18281820
}
18291821
update_mac_mib = true;
18301822
entry_temp->mac16 = shortAddress; // short address refreshed

test/nanostack/unittest/6LoWPAN/adaptation_interface/test_adaptation_interface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ bool test_lowpan_adaptation_interface_mpx_register()
13721372

13731373

13741374
if (0 != lowpan_adaptation_free_messages_from_queues_by_address(&entry, test_buf2->dst_sa.address,
1375-
test_buf2->dst_sa.addr_type)) {
1375+
test_buf2->dst_sa.addr_type)) {
13761376
lowpan_adaptation_interface_free(0);
13771377
free(test_buf);
13781378
free(test_buf2);

0 commit comments

Comments
 (0)