Skip to content

Commit 42047d3

Browse files
authored
Merge pull request #13585 from artokin/nanostack_release_v12_5_2_feature_wisun
[feature-wisun] Nanostack release v12.5.2
2 parents 6db4a01 + 99bd22c commit 42047d3

File tree

10 files changed

+86
-11
lines changed

10 files changed

+86
-11
lines changed

features/nanostack/sal-stack-nanostack/nanostack/net_ws_test.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,19 @@ void ws_test_skip_edfe_data_send(int8_t interface_id, bool skip);
204204
*/
205205
int8_t ws_test_drop_edfe_data_frames(int8_t interface_id, uint8_t number_of_dropped_frames);
206206

207+
/**
208+
* Set neighbour temporary timeout value.
209+
*
210+
* Made only for test purpose for test EDFE certificatiomn test harness.
211+
*
212+
* \param interface_id Network interface ID.
213+
* \param temporary_lifetime 0 to disable test harness, 240-2200 enable longer temporary neighbour lifetime. Values bigger than 2200 will be capped to 2200.
214+
*
215+
* \return 0 Success
216+
* \return <0 Failure
217+
*/
218+
int ws_test_neighbour_temporary_lifetime_set(int8_t interface_id, uint32_t temporary_lifetime);
219+
207220
#ifdef __cplusplus
208221
}
209222
#endif

features/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ mac_neighbor_table_entry_t *ws_bootstrap_mac_neighbor_add(struct protocol_interf
139139
}
140140
// TODO only call these for new neighbour
141141
mlme_device_descriptor_t device_desc;
142-
neighbor->lifetime = WS_NEIGHBOUR_TEMPORARY_ENTRY_LIFETIME;
143-
neighbor->link_lifetime = WS_NEIGHBOUR_TEMPORARY_ENTRY_LIFETIME;
142+
neighbor->lifetime = ws_cfg_neighbour_temporary_lifetime_get();
143+
neighbor->link_lifetime = ws_cfg_neighbour_temporary_lifetime_get();
144144
mac_helper_device_description_write(interface, &device_desc, neighbor->mac64, neighbor->mac16, 0, false);
145145
mac_helper_devicetable_set(&device_desc, interface, neighbor->index, interface->mac_parameters->mac_default_key_index, true);
146146

@@ -1828,7 +1828,7 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent
18281828
continue;
18291829
}
18301830

1831-
if (cur->link_lifetime != WS_NEIGHBOR_LINK_TIMEOUT) {
1831+
if (cur->link_lifetime < WS_NEIGHBOUR_TEMPORARY_NEIGH_MAX_LIFETIME) {
18321832
continue;
18331833
}
18341834

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

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

features/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_cfg_settings.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ typedef struct ws_cfg_nw_size_s {
5555
ws_sec_prot_cfg_t sec_prot; /**< Security protocols configuration */
5656
} ws_cfg_nw_size_t;
5757

58+
static uint32_t ws_test_temporary_entry_lifetime = 0;
5859
typedef int8_t (*ws_cfg_default_set)(void *cfg);
5960
typedef int8_t (*ws_cfg_validate)(void *cfg, void *new_cfg);
6061
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
12751276
return ret_value;
12761277
}
12771278

1279+
uint32_t ws_cfg_neighbour_temporary_lifetime_get(void)
1280+
{
1281+
if (ws_test_temporary_entry_lifetime) {
1282+
return ws_test_temporary_entry_lifetime;
1283+
}
1284+
return WS_NEIGHBOUR_TEMPORARY_ENTRY_LIFETIME;
1285+
}
1286+
void ws_cfg_neighbour_temporary_lifetime_set(uint32_t lifetime)
1287+
{
1288+
if (lifetime >= WS_NEIGHBOUR_TEMPORARY_NEIGH_MAX_LIFETIME || lifetime == 0) {
1289+
if (lifetime > WS_NEIGHBOR_LINK_TIMEOUT) {
1290+
lifetime = WS_NEIGHBOR_LINK_TIMEOUT;
1291+
}
1292+
ws_test_temporary_entry_lifetime = lifetime;
1293+
}
1294+
}
1295+
12781296
#endif //HAVE_WS

features/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_cfg_settings.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,7 @@ int8_t ws_cfg_sec_prot_get(ws_sec_prot_cfg_t *cfg, uint8_t *flags);
187187
int8_t ws_cfg_sec_prot_validate(ws_sec_prot_cfg_t *cfg, ws_sec_prot_cfg_t *new_cfg);
188188
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);
189189

190+
uint32_t ws_cfg_neighbour_temporary_lifetime_get(void);
191+
void ws_cfg_neighbour_temporary_lifetime_set(uint32_t lifetime);
192+
190193
#endif // WS_CFG_STORAGE_H_

features/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_common_defines.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ typedef struct ws_bs_ie {
241241

242242
#define WS_NEIGHBOR_LINK_TIMEOUT 2200
243243

244+
#define WS_NEIGHBOUR_TEMPORARY_NEIGH_MAX_LIFETIME 240
244245
#define WS_NEIGHBOUR_TEMPORARY_ENTRY_LIFETIME 5
245246
#define WS_NEIGHBOUR_DHCP_ENTRY_LIFETIME 60
246247
#define WS_NEIGHBOR_TEMPORARY_LINK_MIN_TIMEOUT_LARGE 520

features/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_empty_functions.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,4 +422,26 @@ int ws_device_min_sens_set(
422422
return -1;
423423
}
424424

425+
int ws_test_neighbour_temporary_lifetime_set(int8_t interface_id, uint32_t temporary_lifetime)
426+
{
427+
(void) interface_id;
428+
(void) temporary_lifetime;
429+
return -1;
430+
}
431+
432+
void ws_test_skip_edfe_data_send(int8_t interface_id, bool skip)
433+
{
434+
(void) interface_id;
435+
(void) skip;
436+
}
437+
438+
439+
int8_t ws_test_drop_edfe_data_frames(int8_t interface_id, uint8_t number_of_dropped_frames)
440+
{
441+
(void) interface_id;
442+
(void) number_of_dropped_frames;
443+
return -1;
444+
}
445+
446+
425447
#endif // no HAVE_WS

features/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_llc_data_service.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ static void ws_llc_mac_confirm_cb(const mac_api_t *api, const mcps_data_conf_t *
537537
ws_llc_mpx_eapol_send(base, message);
538538
}
539539
} else {
540-
if (neighbor_info.ws_neighbor && neighbor_info.neighbor && neighbor_info.neighbor->link_lifetime != WS_NEIGHBOR_LINK_TIMEOUT) {
540+
if (neighbor_info.ws_neighbor && neighbor_info.neighbor && neighbor_info.neighbor->link_lifetime < WS_NEIGHBOUR_TEMPORARY_NEIGH_MAX_LIFETIME) {
541541
//Remove temp neighbour
542542
tr_debug("Remove Temp Entry by TX confirm");
543543
mac_neighbor_table_neighbor_remove(mac_neighbor_info(interface), neighbor_info.neighbor);

features/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_test_api.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,17 @@ int ws_test_6lowpan_fragmentation_mtu_size_set(int8_t interface_id, uint16_t mtu
164164
return 0;
165165
}
166166

167+
int ws_test_neighbour_temporary_lifetime_set(int8_t interface_id, uint32_t temporary_lifetime)
168+
{
169+
protocol_interface_info_entry_t *cur;
170+
171+
cur = protocol_stack_interface_info_get_by_id(interface_id);
172+
if (!cur || !ws_info(cur)) {
173+
return -1;
174+
}
175+
176+
ws_cfg_neighbour_temporary_lifetime_set(temporary_lifetime);
177+
return 0;
178+
}
179+
167180
#endif // HAVE_WS

features/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mcps_sap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,6 +1794,9 @@ int8_t mcps_generic_edfe_frame_init(protocol_interface_rf_mac_setup_s *rf_ptr, c
17941794
//Data Here
17951795
mac_pre_build_frame_t *buffer;
17961796
if (response->wait_response) {
1797+
if (rf_ptr->active_pd_data_request == NULL) {
1798+
return -1;
1799+
}
17971800
buffer = rf_ptr->active_pd_data_request;
17981801
buffer->message_builded = false;
17991802
} else {

features/nanostack/sal-stack-nanostack/source/libNET/src/net_dns.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,17 @@ int8_t net_dns_server_search_list_set(int8_t interface_id, const uint8_t address
150150
info_ptr->dns_search_list_ptr = NULL;
151151
}
152152

153-
if (!info_ptr->dns_search_list_ptr) {
154-
info_ptr->dns_search_list_ptr = ns_dyn_mem_alloc(dns_search_list_len);
155-
}
153+
if (dns_search_list_len) {
154+
if (!info_ptr->dns_search_list_ptr) {
155+
info_ptr->dns_search_list_ptr = ns_dyn_mem_alloc(dns_search_list_len);
156+
}
156157

157-
if (!info_ptr->dns_search_list_ptr) {
158-
return -2;
158+
if (!info_ptr->dns_search_list_ptr) {
159+
return -2;
160+
}
161+
memcpy(info_ptr->dns_search_list_ptr, dns_search_list_ptr, dns_search_list_len);
159162
}
160163

161-
memcpy(info_ptr->dns_search_list_ptr, dns_search_list_ptr, dns_search_list_len);
162164
info_ptr->dns_search_list_len = dns_search_list_len;
163165
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);
164166

0 commit comments

Comments
 (0)