Skip to content

[feature-wisun] Nanostack release v12.5.2 #13585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions features/nanostack/sal-stack-nanostack/nanostack/net_ws_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,19 @@ void ws_test_skip_edfe_data_send(int8_t interface_id, bool skip);
*/
int8_t ws_test_drop_edfe_data_frames(int8_t interface_id, uint8_t number_of_dropped_frames);

/**
* Set neighbour temporary timeout value.
*
* Made only for test purpose for test EDFE certificatiomn test harness.
*
* \param interface_id Network interface ID.
* \param temporary_lifetime 0 to disable test harness, 240-2200 enable longer temporary neighbour lifetime. Values bigger than 2200 will be capped to 2200.
*
* \return 0 Success
* \return <0 Failure
*/
int ws_test_neighbour_temporary_lifetime_set(int8_t interface_id, uint32_t temporary_lifetime);

#ifdef __cplusplus
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ mac_neighbor_table_entry_t *ws_bootstrap_mac_neighbor_add(struct protocol_interf
}
// TODO only call these for new neighbour
mlme_device_descriptor_t device_desc;
neighbor->lifetime = WS_NEIGHBOUR_TEMPORARY_ENTRY_LIFETIME;
neighbor->link_lifetime = WS_NEIGHBOUR_TEMPORARY_ENTRY_LIFETIME;
neighbor->lifetime = ws_cfg_neighbour_temporary_lifetime_get();
neighbor->link_lifetime = ws_cfg_neighbour_temporary_lifetime_get();
mac_helper_device_description_write(interface, &device_desc, neighbor->mac64, neighbor->mac16, 0, false);
mac_helper_devicetable_set(&device_desc, interface, neighbor->index, interface->mac_parameters->mac_default_key_index, true);

Expand Down Expand Up @@ -1828,7 +1828,7 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent
continue;
}

if (cur->link_lifetime != WS_NEIGHBOR_LINK_TIMEOUT) {
if (cur->link_lifetime < WS_NEIGHBOUR_TEMPORARY_NEIGH_MAX_LIFETIME) {
continue;
}

Expand Down Expand Up @@ -1959,7 +1959,7 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr,
ws_neighbor_class_entry_t *ws_neighbor = ws_neighbor_class_entry_get(&cur->ws_info->neighbor_storage, entry_ptr->index);
etx_storage_t *etx_entry = etx_storage_entry_get(cur->id, entry_ptr->index);

if (!entry_ptr->trusted_device || !ws_neighbor || !etx_entry || ws_neighbor->negative_aro_send || entry_ptr->link_lifetime != WS_NEIGHBOR_LINK_TIMEOUT) {
if (!entry_ptr->trusted_device || !ws_neighbor || !etx_entry || ws_neighbor->negative_aro_send || entry_ptr->link_lifetime < WS_NEIGHBOUR_TEMPORARY_NEIGH_MAX_LIFETIME) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ typedef struct ws_cfg_nw_size_s {
ws_sec_prot_cfg_t sec_prot; /**< Security protocols configuration */
} ws_cfg_nw_size_t;

static uint32_t ws_test_temporary_entry_lifetime = 0;
typedef int8_t (*ws_cfg_default_set)(void *cfg);
typedef int8_t (*ws_cfg_validate)(void *cfg, void *new_cfg);
typedef int8_t (*ws_cfg_set)(protocol_interface_info_entry_t *cur, void *cfg, void *new_cfg, uint8_t *flags);
Expand Down Expand Up @@ -1275,4 +1276,21 @@ int8_t ws_cfg_settings_set(protocol_interface_info_entry_t *cur, ws_cfg_t *new_c
return ret_value;
}

uint32_t ws_cfg_neighbour_temporary_lifetime_get(void)
{
if (ws_test_temporary_entry_lifetime) {
return ws_test_temporary_entry_lifetime;
}
return WS_NEIGHBOUR_TEMPORARY_ENTRY_LIFETIME;
}
void ws_cfg_neighbour_temporary_lifetime_set(uint32_t lifetime)
{
if (lifetime >= WS_NEIGHBOUR_TEMPORARY_NEIGH_MAX_LIFETIME || lifetime == 0) {
if (lifetime > WS_NEIGHBOR_LINK_TIMEOUT) {
lifetime = WS_NEIGHBOR_LINK_TIMEOUT;
}
ws_test_temporary_entry_lifetime = lifetime;
}
}

#endif //HAVE_WS
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,7 @@ int8_t ws_cfg_sec_prot_get(ws_sec_prot_cfg_t *cfg, uint8_t *flags);
int8_t ws_cfg_sec_prot_validate(ws_sec_prot_cfg_t *cfg, ws_sec_prot_cfg_t *new_cfg);
int8_t ws_cfg_sec_prot_set(protocol_interface_info_entry_t *cur, ws_sec_prot_cfg_t *cfg, ws_sec_prot_cfg_t *new_cfg, uint8_t *flags);

uint32_t ws_cfg_neighbour_temporary_lifetime_get(void);
void ws_cfg_neighbour_temporary_lifetime_set(uint32_t lifetime);

#endif // WS_CFG_STORAGE_H_
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ typedef struct ws_bs_ie {

#define WS_NEIGHBOR_LINK_TIMEOUT 2200

#define WS_NEIGHBOUR_TEMPORARY_NEIGH_MAX_LIFETIME 240
#define WS_NEIGHBOUR_TEMPORARY_ENTRY_LIFETIME 5
#define WS_NEIGHBOUR_DHCP_ENTRY_LIFETIME 60
#define WS_NEIGHBOR_TEMPORARY_LINK_MIN_TIMEOUT_LARGE 520
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,26 @@ int ws_device_min_sens_set(
return -1;
}

int ws_test_neighbour_temporary_lifetime_set(int8_t interface_id, uint32_t temporary_lifetime)
{
(void) interface_id;
(void) temporary_lifetime;
return -1;
}

void ws_test_skip_edfe_data_send(int8_t interface_id, bool skip)
{
(void) interface_id;
(void) skip;
}


int8_t ws_test_drop_edfe_data_frames(int8_t interface_id, uint8_t number_of_dropped_frames)
{
(void) interface_id;
(void) number_of_dropped_frames;
return -1;
}


#endif // no HAVE_WS
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ static void ws_llc_mac_confirm_cb(const mac_api_t *api, const mcps_data_conf_t *
ws_llc_mpx_eapol_send(base, message);
}
} else {
if (neighbor_info.ws_neighbor && neighbor_info.neighbor && neighbor_info.neighbor->link_lifetime != WS_NEIGHBOR_LINK_TIMEOUT) {
if (neighbor_info.ws_neighbor && neighbor_info.neighbor && neighbor_info.neighbor->link_lifetime < WS_NEIGHBOUR_TEMPORARY_NEIGH_MAX_LIFETIME) {
//Remove temp neighbour
tr_debug("Remove Temp Entry by TX confirm");
mac_neighbor_table_neighbor_remove(mac_neighbor_info(interface), neighbor_info.neighbor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,17 @@ int ws_test_6lowpan_fragmentation_mtu_size_set(int8_t interface_id, uint16_t mtu
return 0;
}

int ws_test_neighbour_temporary_lifetime_set(int8_t interface_id, uint32_t temporary_lifetime)
{
protocol_interface_info_entry_t *cur;

cur = protocol_stack_interface_info_get_by_id(interface_id);
if (!cur || !ws_info(cur)) {
return -1;
}

ws_cfg_neighbour_temporary_lifetime_set(temporary_lifetime);
return 0;
}

#endif // HAVE_WS
Original file line number Diff line number Diff line change
Expand Up @@ -1794,6 +1794,9 @@ int8_t mcps_generic_edfe_frame_init(protocol_interface_rf_mac_setup_s *rf_ptr, c
//Data Here
mac_pre_build_frame_t *buffer;
if (response->wait_response) {
if (rf_ptr->active_pd_data_request == NULL) {
return -1;
}
buffer = rf_ptr->active_pd_data_request;
buffer->message_builded = false;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,17 @@ int8_t net_dns_server_search_list_set(int8_t interface_id, const uint8_t address
info_ptr->dns_search_list_ptr = NULL;
}

if (!info_ptr->dns_search_list_ptr) {
info_ptr->dns_search_list_ptr = ns_dyn_mem_alloc(dns_search_list_len);
}
if (dns_search_list_len) {
if (!info_ptr->dns_search_list_ptr) {
info_ptr->dns_search_list_ptr = ns_dyn_mem_alloc(dns_search_list_len);
}

if (!info_ptr->dns_search_list_ptr) {
return -2;
if (!info_ptr->dns_search_list_ptr) {
return -2;
}
memcpy(info_ptr->dns_search_list_ptr, dns_search_list_ptr, dns_search_list_len);
}

memcpy(info_ptr->dns_search_list_ptr, dns_search_list_ptr, dns_search_list_len);
info_ptr->dns_search_list_len = dns_search_list_len;
tr_info("DNS Search List: %s Lifetime: %lu", trace_array(info_ptr->dns_search_list_ptr, info_ptr->dns_search_list_len), (unsigned long) info_ptr->lifetime);

Expand Down