Merge commit '769796ee45960a01489665d1af0325e6680b2211' into feature-wisun

* commit '769796ee45960a01489665d1af0325e6680b2211':
  Squashed 'features/nanostack/sal-stack-nanostack/' changes from b969fa3779..9a1b35398c
pull/13585/head
Arto Kinnunen 2020-09-10 13:26:48 +03:00
commit 99bd22cfaf
10 changed files with 87 additions and 12 deletions

View File

@ -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

View File

@ -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);
@ -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;
}
@ -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;
}

View File

@ -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);
@ -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

View File

@ -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_

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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 {

View File

@ -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;
}
memcpy(info_ptr->dns_search_list_ptr, dns_search_list_ptr, dns_search_list_len);
}
if (!info_ptr->dns_search_list_ptr) {
return -2;
}
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);