Skip to content

Commit

Permalink
Merge branch 'release_internal' into release_external
Browse files Browse the repository at this point in the history
* release_internal: (52 commits)
  address error sent when matching entry found. (#1695)
  Keep parent mle_entry in child_update_req timeout (#1693)
  Changed BBR router upgrade status (#1661)
  Compiler warning clean-up (#1690)
  Detection of duplicate address entries updated (#1686)
  pbbr route handling updated (#1681)
  MLE parent request timeout fixes (#1676)
  Remove fragment/PMTU handling dropped by RFC 8200
  entry keep alive flag set to true if entry already exists. (#1675)
  Extra Thread-specific address check handling
  Tighten core "for us" check for unicast addresses
  address query logic implemented(#1667)
  Fix for Router advertisement process in REED (#1658)
  Thread DHCP address allocation fix (#1657)
  removed the dependence of AE message relay on DUA prefix (#1655)
  REED parser refactoring for MLE advertisement (#1654)
  Clear data request flag in child_id_req timeout (#1649)
  updated mleid rloc sync in leader. (#1645)
  Added filter callback for MLE messages (#1638)
  Security bits handled correctly (#1642)
  ...
  • Loading branch information
Juhani Puurula committed May 8, 2018
2 parents 43c7ec2 + 7c7568d commit 82bbdcc
Show file tree
Hide file tree
Showing 62 changed files with 848 additions and 509 deletions.
1 change: 1 addition & 0 deletions nanostack/net_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,7 @@ extern void net_get_version_information(uint8_t *ptr);
*
* Note! In Thread mode parent buffer size is automatically set during Thread initialization.
*
* \param interface_id Network interface ID.
* \param big_packet_threshold Indicate how long packets are considered big. For Thread, must be 106 bytes.
* \param small_packets_per_child_count Number of small packets stored for each sleepy children. For Thread, must be at least 1.
* \param big_packets_total_count Total number of big packets parent can store for all sleepy children. For Thread, must be at least 1.
Expand Down
8 changes: 8 additions & 0 deletions nanostack/net_test_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#define NET_TEST_API_H_

#include "ns_types.h"
#include "Service_Libs/mle_service/mle_service_api.h"

/**
* \brief Makes TCP protocol drop given number of packets from a particular state (TX side).
Expand Down Expand Up @@ -56,4 +57,11 @@ int8_t arm_nwk_test_tcp_drop_rx(int state, uint8_t count);
*/
void arm_nwk_test_tcp_drop_reset(void);

/**
* \brief Set callback for MLE message receiving filter.
*
* Testing API for setting MLE receive callback for message filtering purposes.
*/
void arm_nwk_test_mle_receive_filter_set(mle_service_filter_cb *response_filter_cb);

#endif //NET_TEST_API_H_
13 changes: 13 additions & 0 deletions nanostack/net_thread_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,19 @@ int thread_test_increment_key_sequence_counter(int8_t interface_id);
*/
int thread_test_key_sequence_counter_update(int8_t interface_id, uint32_t thrKeySequenceCounter);

/**
* \brief Resets cached values from stack
*
Resets link configuration from cache and from NVM.
*
*
* \param interface_id Network Interface
*
* \return 0, OK
* \return <0 Error
*/
int thread_test_stack_cache_reset(int8_t interface_id);

/**
* \brief Set new Thread key rotation value
*
Expand Down
12 changes: 6 additions & 6 deletions source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ static int mle_router_accept_request_build(protocol_interface_info_entry_t *cur,

static void protocol_6lowpan_link_reject_handler(protocol_interface_info_entry_t *cur, uint8_t *ll64)
{
mle_neigh_table_entry_t *entry_temp = mle_class_get_entry_by_ll64(cur->id, 0, ll64, false);
mle_neigh_table_entry_t *entry_temp = mle_class_get_entry_by_ll64(cur->id, 0, ll64, false, NULL);
tr_debug("MLE link reject");
if (entry_temp) {
mle_class_remove_entry(cur->id, entry_temp);
Expand Down Expand Up @@ -1081,7 +1081,7 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml
mle_6lowpan_data->link_req_token_bucket--;
} else {
//Update only old information based on link request
entry_temp = mle_class_get_entry_by_ll64(interface_id, linkMargin, mle_msg->packet_src_address, false);
entry_temp = mle_class_get_entry_by_ll64(interface_id, linkMargin, mle_msg->packet_src_address, false, NULL);
if (entry_temp) {
mle_neigh_time_and_mode_update(entry_temp,mle_msg->data_ptr, mle_msg->data_length);
mle_neigh_entry_update_by_mle_tlv_list(interface_id, entry_temp, mle_msg->data_ptr, mle_msg->data_length, cur->mac, own_mac16);
Expand Down Expand Up @@ -1118,12 +1118,12 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml

tr_debug("Accept & Request");

entry_temp = mle_class_get_entry_by_ll64(interface_id, linkMargin, mle_msg->packet_src_address, false);
entry_temp = mle_class_get_entry_by_ll64(interface_id, linkMargin, mle_msg->packet_src_address, false, NULL);

if (!entry_temp) {
// If there is space for neighbors try to allocate new entry
if (mle_6lowpan_neighbor_limit_check(interface_id, mle_msg, true)) {
entry_temp = mle_class_get_entry_by_ll64(interface_id, linkMargin, mle_msg->packet_src_address, true);
entry_temp = mle_class_get_entry_by_ll64(interface_id, linkMargin, mle_msg->packet_src_address, true, NULL);
}
}

Expand Down Expand Up @@ -1185,7 +1185,7 @@ void mle_6lowpan_message_handler(int8_t interface_id, mle_message_t *mle_msg, ml
mode = *t_ptr;
}

entry_temp = mle_class_get_entry_by_ll64(interface_id, linkMargin, mle_msg->packet_src_address, false);
entry_temp = mle_class_get_entry_by_ll64(interface_id, linkMargin, mle_msg->packet_src_address, false, NULL);
if (!entry_temp) {
if ((mode & MLE_DEV_MASK) == MLE_FFD_DEV) {
// If there is space for neighbors synchronizes to new router
Expand Down Expand Up @@ -2787,7 +2787,7 @@ bool lowpan_neighbour_data_clean(int8_t interface_id, const uint8_t *link_local_
{
bool return_value = false;
#ifndef NO_MLE
mle_neigh_table_entry_t * neigh_entry = mle_class_get_entry_by_ll64(interface_id, 0, link_local_address, false);
mle_neigh_table_entry_t * neigh_entry = mle_class_get_entry_by_ll64(interface_id, 0, link_local_address, false, NULL);
if (neigh_entry) {
//Remove entry
if (neigh_entry->priorityFlag) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ static int8_t set_6lowpan_nwk_down(protocol_interface_info_entry_t *cur)
#endif
}
}
uint16_t pan_id = cur->mac_parameters->pan_id;
if (cur->lowpan_info & INTERFACE_NWK_BOOTSRAP_PANA_AUTHENTICATION) {
pana_reset_values(cur->mac_parameters->pan_id);
}

if (cur->interface_mode == INTERFACE_UP) {
if (cur->mac_api) {
mlme_reset_t reset;
Expand All @@ -105,9 +108,6 @@ static int8_t set_6lowpan_nwk_down(protocol_interface_info_entry_t *cur)
reassembly_interface_reset(cur->id);

icmp_nd_routers_init();
if (cur->lowpan_info & INTERFACE_NWK_BOOTSRAP_PANA_AUTHENTICATION) {
pana_reset_values(pan_id);
}

if (cur->pana_sec_info_temp) {
ns_dyn_mem_free(cur->pana_sec_info_temp);
Expand Down
9 changes: 6 additions & 3 deletions source/6LoWPAN/MAC/mac_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,9 @@ void mac_helper_coordinator_address_set(protocol_interface_info_entry_t *interfa
if (adr_type == ADDR_802_15_4_SHORT) {
memcpy(interface->mac_parameters->mac_cordinator_info.mac_mlme_coord_address, adr_ptr, 2);
interface->mac_parameters->mac_cordinator_info.cord_adr_mode = MAC_ADDR_MODE_16_BIT;
uint16_t short_addr = common_read_16_bit(interface->mac_parameters->mac_cordinator_info.mac_mlme_coord_address);
set_req.attr = macCoordShortAddress;
set_req.value_pointer = &interface->mac_parameters->mac_cordinator_info.mac_mlme_coord_address;
set_req.value_pointer = &short_addr;
set_req.value_size = 2;
} else if (adr_type == ADDR_802_15_4_LONG) {
memcpy(interface->mac_parameters->mac_cordinator_info.mac_mlme_coord_address, adr_ptr, 8);
Expand Down Expand Up @@ -767,8 +768,10 @@ static uint8_t mac_helper_header_security_aux_header_length(uint8_t keyIdmode) {
switch (keyIdmode) {
case MAC_KEY_ID_MODE_SRC8_IDX:
header_length += 4; //64-bit key source first part
/* fall through */
case MAC_KEY_ID_MODE_SRC4_IDX:
header_length += 4; //32-bit key source inline
/* fall through */
case MAC_KEY_ID_MODE_IDX:
header_length += 1;
break;
Expand Down Expand Up @@ -830,13 +833,13 @@ void mac_helper_devicetable_remove(mac_api_t *mac_api, uint8_t attribute_index)
mac_api->mlme_req(mac_api,MLME_SET , &set_req);
}

void mac_helper_devicetable_set(mle_neigh_table_entry_t *entry_temp, protocol_interface_info_entry_t *cur, uint32_t frame_counter, uint8_t keyID)
void mac_helper_devicetable_set(mle_neigh_table_entry_t *entry_temp, protocol_interface_info_entry_t *cur, uint32_t frame_counter, uint8_t keyID, bool force_set)
{
if (!cur->mac_api) {
return;
}

if (cur->mac_parameters->SecurityEnabled && cur->mac_parameters->mac_default_key_index != keyID) {
if (!force_set && cur->mac_parameters->SecurityEnabled && cur->mac_parameters->mac_default_key_index != keyID) {
tr_debug("Do not set counter by index %u != %u", cur->mac_parameters->mac_default_key_index, keyID);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/MAC/mac_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ int8_t mac_helper_link_frame_counter_set(int8_t interface_id, uint32_t seq_ptr);

void mac_helper_devicetable_remove(struct mac_api_s *mac_api, uint8_t attribute_index);

void mac_helper_devicetable_set(struct mle_neigh_table_entry_t *entry_temp, struct protocol_interface_info_entry *cur, uint32_t frame_counter, uint8_t keyID);
void mac_helper_devicetable_set(struct mle_neigh_table_entry_t *entry_temp, struct protocol_interface_info_entry *cur, uint32_t frame_counter, uint8_t keyID, bool force_set);

int8_t mac_helper_mac_mlme_max_retry_set(int8_t interface_id, uint8_t mac_retry_set);

Expand Down
8 changes: 5 additions & 3 deletions source/6LoWPAN/MAC/mac_pairwise_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ int mac_pairwise_key_interface_unregister(int8_t interface_id)
int mac_pairwise_key_add(int8_t interface_id, uint32_t valid_life_time, const uint8_t eui64[static 8], const uint8_t key[static 16])
{
protocol_interface_info_entry_t *interface = protocol_stack_interface_info_get_by_id(interface_id);
bool new_entry_created;

if (!interface || !interface->mac_api) {
return -1;
}
Expand All @@ -264,7 +266,7 @@ int mac_pairwise_key_add(int8_t interface_id, uint32_t valid_life_time, const ui
}

//Allocate mle entry
mle_neigh_table_entry_t *mle_entry = mle_class_get_entry_by_mac64(interface_id, 0, eui64, true);
mle_neigh_table_entry_t *mle_entry = mle_class_get_entry_by_mac64(interface_id, 0, eui64, true, &new_entry_created);
if (!mle_entry) {
return -1;
}
Expand All @@ -282,7 +284,7 @@ int mac_pairwise_key_add(int8_t interface_id, uint32_t valid_life_time, const ui
}

//Set device descriptor
mac_helper_devicetable_set(mle_entry, interface, 0, interface->mac_parameters->mac_default_key_index);
mac_helper_devicetable_set(mle_entry, interface, 0, interface->mac_parameters->mac_default_key_index, new_entry_created);

//set key descriptor
if (mac_helper_security_pairwisekey_set(interface, key, eui64, key_desc->key_decriptor_attribute) != 0) {
Expand All @@ -308,7 +310,7 @@ int mac_pairwise_key_del(int8_t interface_id, const uint8_t eui64[static 8])
return -1;
}
//Get from mle
mle_neigh_table_entry_t *mle_entry = mle_class_get_entry_by_mac64(interface_id, 0, eui64, true);
mle_neigh_table_entry_t *mle_entry = mle_class_get_entry_by_mac64(interface_id, 0, eui64, true, NULL);
if (!mle_entry) {
return -1;
}
Expand Down
4 changes: 2 additions & 2 deletions source/6LoWPAN/Thread/thread_bbr_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ static bool thread_bbr_activated(thread_bbr_t *this, uint32_t seconds)
return true;
}
// We will try to become router. This is done only in 120 seconds intervals if failed
thread_router_bootstrap_router_id_request(cur, 0);
thread_router_bootstrap_router_id_request(cur, THREAD_BBR_ROUTER_ID_REQUEST_STATUS);
this->router_upgrade_delay_timer = 120;
return false;
}
Expand All @@ -755,8 +755,8 @@ bool thread_bbr_routing_enabled(protocol_interface_info_entry_t *cur)

void thread_bbr_network_data_update_notify(protocol_interface_info_entry_t *cur)
{
(void) cur;
thread_mdns_network_data_update_notify();
thread_extension_bbr_route_update(cur);
}
#endif /* HAVE_THREAD_BORDER_ROUTER*/

Expand Down
Loading

0 comments on commit 82bbdcc

Please sign in to comment.