Skip to content

Commit

Permalink
Squashed 'features/nanostack/sal-stack-nanostack/' changes from 43c7ec2
Browse files Browse the repository at this point in the history
…..82bbdcc

82bbdcc Merge branch 'release_internal' into release_external
7c7568d address error sent when matching entry found. (ARMmbed#1695)
0860ae7 Keep parent mle_entry in child_update_req timeout (ARMmbed#1693)
92044d6 Changed BBR router upgrade status (ARMmbed#1661)
e4a9657 Compiler warning clean-up (ARMmbed#1690)
a573bc4 Detection of duplicate address entries updated (ARMmbed#1686)
f28cce8 pbbr route handling updated (ARMmbed#1681)
389fab0 MLE parent request timeout fixes (ARMmbed#1676)
feb1784 Remove fragment/PMTU handling dropped by RFC 8200
073f7e8 entry keep alive flag set to true if entry already exists. (ARMmbed#1675)
1584759 Extra Thread-specific address check handling
934687b Tighten core "for us" check for unicast addresses
58a60e7 address query logic implemented(ARMmbed#1667)
c25df78 Fix for Router advertisement process in REED (ARMmbed#1658)
f8b227f Thread DHCP address allocation fix (ARMmbed#1657)
41ca387 removed the dependence of AE message relay on DUA prefix (ARMmbed#1655)
9e7e9e0 REED parser refactoring for MLE advertisement (ARMmbed#1654)
4fda90e Clear data request flag in child_id_req timeout (ARMmbed#1649)
5af4a39 updated mleid rloc sync in leader. (ARMmbed#1645)
564d3fe Added filter callback for MLE messages (ARMmbed#1638)
9f85599 Security bits handled correctly (ARMmbed#1642)
9e6c3a1 Update Thread MLE neighbor list cleanup, attempt #2 (ARMmbed#1640)
1060c34 file version checking handled after other errors. (ARMmbed#1641)
9c6b876 added nvm support for leader router id allocation. (ARMmbed#1626)
4f5e97d Revert "Update Thread MLE neighbor list cleanup (ARMmbed#1637)" (ARMmbed#1639)
a20a0ba Update Thread MLE neighbor list cleanup (ARMmbed#1637)
32cfb6b Fix to partition selection rules (ARMmbed#1633)
0d655ed Update MLE receiver in Child ID req timeout error (ARMmbed#1634)
2378dad Discard late Child ID responses (ARMmbed#1630)
3e8b4ce Multicast registration time fix (ARMmbed#1631)
f5530b1 Thread key ID change during attach (ARMmbed#1627)
1b7fdc0 Skip discovery request if MLE table is full (ARMmbed#1625)
4022ad9 Add new test API for clearing Thread stack values (ARMmbed#1624)
ffb47a2 additional reed advertisement (ARMmbed#1609)
cfb1e81 Thread tx failure handling update (ARMmbed#1620)
15846ed refactored network data sync as leader (ARMmbed#1615)
a5c67fd data request resent if leader after resync does not receive data response.(ARMmbed#1614)
f8a39da documentation fix: (ARMmbed#1608)
b69ba04 Allow MLE entry forced saving to MAC (ARMmbed#1600)
0e85099 Update router id sequence number in router sync (ARMmbed#1594)
f2cd4cf Read the short addr as 16-bit value before calling mac api (ARMmbed#1585)
912cf02 purge old partition data when child id response is received (ARMmbed#1588)
648ef89 Remove unnecessary call to mac (ARMmbed#1583)
09cff0e Fix uninitialised memory defect found by valgrind (ARMmbed#1582)
a1acffc Update Thread publishing during address change (ARMmbed#1581)
d2ddb1a Send new a/sd immediately after address change (ARMmbed#1576)
c18d1fd added check for parent info before processing child update (ARMmbed#1577)
96e86b6 implemented Sleepy End Device child update requests. (ARMmbed#1570)
33cb7cb Flag check updated. (ARMmbed#1572)
9f8e7f2 Merge pull request ARMmbed#1566 from ARMmbed/ut_fix
565da92 Update socket_api_test.cpp
59545f9 Update socket_api_test.cpp
09414e1 ML-EID is now added to address registration tlv. (ARMmbed#1565)
beddb01 unittest fix for newer release of cpputest

git-subtree-dir: features/nanostack/sal-stack-nanostack
git-subtree-split: 82bbdcc
  • Loading branch information
Juhani Puurula committed May 11, 2018
1 parent 7197b5f commit 8e546a3
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 8e546a3

Please sign in to comment.