Skip to content

Commit

Permalink
Parent sends full network data in response to data request (ARMmbed#1806
Browse files Browse the repository at this point in the history
)

- Parent sends full network data to children in response to data
  request if Thread neighbor table is uninitialized.
- Fix Cppcheck warning by moving trace
  • Loading branch information
Arto Kinnunen authored Sep 4, 2018
1 parent cbe45b4 commit 7dbad5e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
16 changes: 14 additions & 2 deletions source/6LoWPAN/Thread/thread_router_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1991,10 +1991,22 @@ void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *
if (!entry_temp || !mle_tlv_read_tlv(MLE_TYPE_TLV_REQUEST, mle_msg->data_ptr, mle_msg->data_length, &requestTlv)) {
return;
}

uint8_t mode = mle_mode_write_from_mac_entry(entry_temp);
/* check if thread neighbor class is not initialized */
if ((thread_neighbor_entry_linkmargin_get(&cur->thread_info->neighbor_class, entry_temp->index) == 0) &&
(thread_neighbor_last_communication_time_get(&cur->thread_info->neighbor_class, entry_temp->index) == 0)) {
/*
* Thread neighbor class is not yet initialized and we receive data_request from such child.
* Always send full network data in this case
*/
mode |= MLE_THREAD_REQ_FULL_DATA_SET | MLE_THREAD_SECURED_DATA_REQUEST;
} else {
mode |= thread_neighbor_class_mode_write_from_entry(&cur->thread_info->neighbor_class, entry_temp->index);
}

thread_neighbor_class_update_link(&cur->thread_info->neighbor_class, entry_temp->index,linkMargin, false);
thread_neighbor_last_communication_time_update(&cur->thread_info->neighbor_class, entry_temp->index);
uint8_t mode = mle_mode_write_from_mac_entry(entry_temp);
mode |= thread_neighbor_class_mode_write_from_entry(&cur->thread_info->neighbor_class, entry_temp->index);
mle_build_and_send_data_response_msg(cur, mle_msg->packet_src_address, mle_msg->data_ptr, mle_msg->data_length, &requestTlv, mode);
}
break;
Expand Down
3 changes: 1 addition & 2 deletions source/Service_Libs/mdns/ns_fnet_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ fnet_bool_t fnet_netif_get_ip6_addr (fnet_netif_desc_t netif_desc, fnet_index_t
addr_info->type = FNET_NETIF_IP_ADDR_TYPE_AUTOCONFIGURABLE; /* How the address was acquired.*/
result = FNET_TRUE;
}
FNET_DEBUG("fnet_netif_get_ip6_addr(), if=%d: %s", (int8_t)netif->scope_id, trace_ipv6(addr_info->address.addr));
}

FNET_DEBUG("fnet_netif_get_ip6_addr(), if=%d: %s", (int8_t)netif->scope_id, trace_ipv6(addr_info->address.addr));

return result;
}

Expand Down

0 comments on commit 7dbad5e

Please sign in to comment.