Skip to content

Commit 12a43ba

Browse files
author
Arto Kinnunen
committed
Merge commit 'd2d0895795de64321d486208316838415ed80d65' into mbed-os-5.15
* commit 'd2d0895795de64321d486208316838415ed80d65': Squashed 'features/nanostack/sal-stack-nanostack/' changes from d879e6d..09d9e24
2 parents f5633c4 + d2d0895 commit 12a43ba

32 files changed

+548
-157
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/nanostack/ws_bbr_api.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ int ws_bbr_start(int8_t interface_id, int8_t backbone_interface_id);
9797
#define BBR_BB_WAIT 0x0004 /**< Wait backbone availability before starting Wi-SUN network */
9898
#define BBR_DEFAULT_ROUTE 0x0008 /**< Add default route parameter to DIO */
9999
#define BBR_REQUIRE_DAO_REFRESH 0x0010 /**< Do not increment PAN version number when active forces DAO update from nodes*/
100+
#define BBR_GUA_SLAAC 0x0020 /**< in Global prefix use SLAAC address generation to reduce traffic during bootstrap */
100101

101102
/**
102103
* Configure border router features.

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,8 @@ static void ws_bbr_rpl_status_check(protocol_interface_info_entry_t *cur)
492492

493493
uint8_t local_prefix[8] = {0};
494494
uint8_t global_prefix[8] = {0};
495+
uint8_t prefix_flags = 0;
496+
uint32_t prefix_lifetime = 0;
495497

496498
//tr_info("BBR status check");
497499

@@ -596,7 +598,6 @@ static void ws_bbr_rpl_status_check(protocol_interface_info_entry_t *cur)
596598
}
597599
// TODO add global prefix
598600
if (memcmp(global_prefix, ADDR_UNSPECIFIED, 8) != 0) {
599-
600601
tr_info("RPL global prefix activate %s", trace_ipv6_prefix(global_prefix, 64));
601602
// Add default route to RPL
602603
// Enable default routing to backbone
@@ -606,8 +607,12 @@ static void ws_bbr_rpl_status_check(protocol_interface_info_entry_t *cur)
606607
return;
607608
}
608609
}
610+
if (configuration & BBR_GUA_SLAAC) {
611+
prefix_flags |= PIO_A;
612+
prefix_lifetime = WS_ULA_LIFETIME;
613+
}
609614
ws_bbr_dhcp_server_start(cur, global_prefix, cur->ws_info->cfg->bbr.dhcp_address_lifetime);
610-
rpl_control_update_dodag_prefix(protocol_6lowpan_rpl_root_dodag, global_prefix, 64, 0, 0, 0, false);
615+
rpl_control_update_dodag_prefix(protocol_6lowpan_rpl_root_dodag, global_prefix, 64, prefix_flags, prefix_lifetime, prefix_lifetime, false);
611616
// no check for failure should have
612617

613618
if (configuration & BBR_GUA_ROUTE) {
@@ -626,7 +631,11 @@ static void ws_bbr_rpl_status_check(protocol_interface_info_entry_t *cur)
626631
* There is no status checks on prefix adds so this makes sure they are not lost
627632
* DHCP validation should be done also
628633
*/
629-
rpl_control_update_dodag_prefix(protocol_6lowpan_rpl_root_dodag, current_global_prefix, 64, 0, 0, 0, false);
634+
if (configuration & BBR_GUA_SLAAC) {
635+
prefix_flags |= PIO_A;
636+
prefix_lifetime = WS_ULA_LIFETIME;
637+
}
638+
rpl_control_update_dodag_prefix(protocol_6lowpan_rpl_root_dodag, current_global_prefix, 64, prefix_flags, prefix_lifetime, prefix_lifetime, false);
630639

631640
if (configuration & BBR_GUA_ROUTE) {
632641
// Add also global prefix and route to RPL

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

Lines changed: 94 additions & 42 deletions
Large diffs are not rendered by default.

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

Lines changed: 21 additions & 6 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);
@@ -86,11 +87,8 @@ static void ws_cfg_network_size_config_set_xlarge(ws_cfg_nw_size_t *cfg);
8687
static void ws_cfg_network_size_config_set_certificate(ws_cfg_nw_size_t *cfg);
8788
static int8_t ws_cfg_network_size_default_set(ws_gen_cfg_t *cfg);
8889
static int8_t ws_cfg_gen_default_set(ws_gen_cfg_t *cfg);
89-
static int8_t ws_cfg_phy_default_set(ws_phy_cfg_t *cfg);
90-
static int8_t ws_cfg_timing_default_set(ws_timing_cfg_t *cfg);
9190
static int8_t ws_cfg_bbr_default_set(ws_bbr_cfg_t *cfg);
9291
static int8_t ws_cfg_mpl_default_set(ws_mpl_cfg_t *cfg);
93-
static int8_t ws_cfg_fhss_default_set(ws_fhss_cfg_t *cfg);
9492
static int8_t ws_cfg_sec_timer_default_set(ws_sec_timer_cfg_t *cfg);
9593
static int8_t ws_cfg_sec_prot_default_set(ws_sec_prot_cfg_t *cfg);
9694

@@ -600,7 +598,7 @@ int8_t ws_cfg_gen_set(protocol_interface_info_entry_t *cur, ws_gen_cfg_t *cfg, w
600598
return CFG_SETTINGS_OK;
601599
}
602600

603-
static int8_t ws_cfg_phy_default_set(ws_phy_cfg_t *cfg)
601+
int8_t ws_cfg_phy_default_set(ws_phy_cfg_t *cfg)
604602
{
605603
// FHSS configuration
606604
cfg->regulatory_domain = REG_DOMAIN_EU;
@@ -680,7 +678,7 @@ int8_t ws_cfg_phy_set(protocol_interface_info_entry_t *cur, ws_phy_cfg_t *cfg, w
680678
return CFG_SETTINGS_OK;
681679
}
682680

683-
static int8_t ws_cfg_timing_default_set(ws_timing_cfg_t *cfg)
681+
int8_t ws_cfg_timing_default_set(ws_timing_cfg_t *cfg)
684682
{
685683
// Configure the Wi-SUN timing trickle parameters
686684
cfg->disc_trickle_imin = TRICKLE_IMIN_60_SECS; // 60 seconds
@@ -900,7 +898,7 @@ int8_t ws_cfg_mpl_set(protocol_interface_info_entry_t *cur, ws_mpl_cfg_t *cfg, w
900898
return CFG_SETTINGS_OK;
901899
}
902900

903-
static int8_t ws_cfg_fhss_default_set(ws_fhss_cfg_t *cfg)
901+
int8_t ws_cfg_fhss_default_set(ws_fhss_cfg_t *cfg)
904902
{
905903
// Set defaults for the device. user can modify these.
906904
cfg->fhss_uc_fixed_channel = 0xffff;
@@ -1275,4 +1273,21 @@ int8_t ws_cfg_settings_set(protocol_interface_info_entry_t *cur, ws_cfg_t *new_c
12751273
return ret_value;
12761274
}
12771275

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

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,12 @@ int8_t ws_cfg_gen_get(ws_gen_cfg_t *cfg, uint8_t *flags);
159159
int8_t ws_cfg_gen_validate(ws_gen_cfg_t *cfg, ws_gen_cfg_t *new_cfg);
160160
int8_t ws_cfg_gen_set(protocol_interface_info_entry_t *cur, ws_gen_cfg_t *cfg, ws_gen_cfg_t *new_cfg, uint8_t *flags);
161161

162+
int8_t ws_cfg_phy_default_set(ws_phy_cfg_t *cfg);
162163
int8_t ws_cfg_phy_get(ws_phy_cfg_t *cfg, uint8_t *flags);
163164
int8_t ws_cfg_phy_validate(ws_phy_cfg_t *cfg, ws_phy_cfg_t *new_cfg);
164165
int8_t ws_cfg_phy_set(protocol_interface_info_entry_t *cur, ws_phy_cfg_t *cfg, ws_phy_cfg_t *new_cfg, uint8_t *flags);
165166

167+
int8_t ws_cfg_timing_default_set(ws_timing_cfg_t *cfg);
166168
int8_t ws_cfg_timing_get(ws_timing_cfg_t *cfg, uint8_t *flags);
167169
int8_t ws_cfg_timing_validate(ws_timing_cfg_t *cfg, ws_timing_cfg_t *new_cfg);
168170
int8_t ws_cfg_timing_set(protocol_interface_info_entry_t *cur, ws_timing_cfg_t *cfg, ws_timing_cfg_t *new_cfg, uint8_t *flags);
@@ -175,6 +177,7 @@ int8_t ws_cfg_mpl_get(ws_mpl_cfg_t *cfg, uint8_t *flags);
175177
int8_t ws_cfg_mpl_validate(ws_mpl_cfg_t *cfg, ws_mpl_cfg_t *new_cfg);
176178
int8_t ws_cfg_mpl_set(protocol_interface_info_entry_t *cur, ws_mpl_cfg_t *cfg, ws_mpl_cfg_t *new_cfg, uint8_t *flags);
177179

180+
int8_t ws_cfg_fhss_default_set(ws_fhss_cfg_t *cfg);
178181
int8_t ws_cfg_fhss_get(ws_fhss_cfg_t *cfg, uint8_t *flags);
179182
int8_t ws_cfg_fhss_validate(ws_fhss_cfg_t *cfg, ws_fhss_cfg_t *new_cfg);
180183
int8_t ws_cfg_fhss_set(protocol_interface_info_entry_t *cur, ws_fhss_cfg_t *cfg, ws_fhss_cfg_t *new_cfg, uint8_t *flags);
@@ -187,4 +190,7 @@ int8_t ws_cfg_sec_prot_get(ws_sec_prot_cfg_t *cfg, uint8_t *flags);
187190
int8_t ws_cfg_sec_prot_validate(ws_sec_prot_cfg_t *cfg, ws_sec_prot_cfg_t *new_cfg);
188191
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);
189192

193+
uint32_t ws_cfg_neighbour_temporary_lifetime_get(void);
194+
void ws_cfg_neighbour_temporary_lifetime_set(uint32_t lifetime);
195+
190196
#endif // WS_CFG_STORAGE_H_

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

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,24 @@ uint8_t ws_common_temporary_entry_size(uint8_t mac_table_size)
390390
}
391391
}
392392

393+
static void ws_common_neighbour_address_reg_link_update(protocol_interface_info_entry_t *interface, const uint8_t *eui64)
394+
{
395+
/*
396+
* ARO registration from child can update the link timeout so we don't need to send extra NUD if ARO received
397+
*/
398+
mac_neighbor_table_entry_t *mac_neighbor = mac_neighbor_entry_get_by_mac64(mac_neighbor_info(interface), eui64, false, false);
399+
400+
if (mac_neighbor) {
401+
if (mac_neighbor->link_lifetime != WS_NEIGHBOR_LINK_TIMEOUT) {
402+
//Set Stable timeout for temporary entry here
403+
mac_neighbor->link_lifetime = WS_NEIGHBOR_LINK_TIMEOUT;
404+
tr_info("Added new neighbor %s : index:%u", trace_array(eui64, 8), mac_neighbor->index);
405+
}
406+
//Refresh
407+
mac_neighbor->lifetime = mac_neighbor->link_lifetime;
408+
}
409+
}
410+
393411
uint8_t ws_common_allow_child_registration(protocol_interface_info_entry_t *interface, const uint8_t *eui64)
394412
{
395413
uint8_t child_count = 0;
@@ -402,14 +420,7 @@ uint8_t ws_common_allow_child_registration(protocol_interface_info_entry_t *inte
402420

403421
//Validate Is EUI64 already allocated for any address
404422
if (ipv6_neighbour_has_registered_by_eui64(&interface->ipv6_neighbour_cache, eui64)) {
405-
/*
406-
* ARO registration from child can update the link timeout so we don't need to send extra NUD if ARO received
407-
*/
408-
mac_neighbor_table_entry_t *mac_neighbor = mac_neighbor_entry_get_by_mac64(mac_neighbor_info(interface), eui64, false, false);
409-
410-
if (mac_neighbor) {
411-
mac_neighbor_table_neighbor_refresh(mac_neighbor_info(interface), mac_neighbor, mac_neighbor->link_lifetime);
412-
}
423+
ws_common_neighbour_address_reg_link_update(interface, eui64);
413424
tr_info("Child registration from old child");
414425
return ARO_SUCCESS;
415426
}
@@ -431,7 +442,8 @@ uint8_t ws_common_allow_child_registration(protocol_interface_info_entry_t *inte
431442
tr_warn("Child registration not allowed %d/%d, max:%d", child_count, max_child_count, mac_neighbor_info(interface)->list_total_size);
432443
return ARO_FULL;
433444
}
434-
ws_bootstrap_neighbor_set_stable(interface, eui64);
445+
446+
ws_common_neighbour_address_reg_link_update(interface, eui64);
435447
tr_info("Child registration allowed %d/%d, max:%d", child_count, max_child_count, mac_neighbor_info(interface)->list_total_size);
436448
return ARO_SUCCESS;
437449
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ typedef struct parent_info_s {
4242
uint16_t pan_id; /**< PAN ID */
4343
uint8_t addr[8]; /**< address */
4444
uint8_t link_quality; /**< LQI value measured during reception of the MPDU */
45+
uint8_t tx_fail;
4546
int8_t signal_dbm; /**< This extension for normal IEEE 802.15.4 Data indication */
4647
ws_pan_information_t pan_information;
4748
ws_utt_ie_t ws_utt;

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

Lines changed: 11 additions & 1 deletion
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
@@ -254,7 +255,8 @@ typedef struct ws_bs_ie {
254255
#define WS_NEIGHBOR_ETX_SAMPLE_MAX 3
255256
#define WS_NEIGHBOR_FIRST_ETX_SAMPLE_MIN_COUNT 3 //This can't be bigger than WS_NEIGHBOR_ETX_SAMPLE_MAX
256257

257-
#define WS_PROBE_INIT_BASE_SECONDS 8
258+
#define WS_SMALL_PROBE_INIT_BASE_SECONDS 4
259+
#define WS_NORMAL_PROBE_INIT_BASE_SECONDS 8
258260

259261
#define WS_NUD_RAND_PROBABILITY 1
260262

@@ -269,6 +271,10 @@ typedef struct ws_bs_ie {
269271

270272
#define WS_ETX_MIN_WAIT_TIME 60
271273

274+
#define WS_ETX_BAD_INIT_LINK_LEVEL 3 //3 or higher attempt count will be dropped
275+
#define WS_ETX_MAX_BAD_LINK_DROP 2 //Drop 2 bad link from init 3
276+
277+
272278
#define WS_RPL_PARENT_CANDIDATE_MAX 5
273279
#define WS_RPL_SELECTED_PARENT_MAX 2
274280

@@ -321,8 +327,12 @@ typedef struct ws_bs_ie {
321327
* 3 4 1+3*1+4=20
322328
*
323329
*/
330+
// This configuration is used when bootstrap is ready
324331
#define WS_MAX_FRAME_RETRIES 3
325332
#define WS_NUMBER_OF_CHANNEL_RETRIES 4
333+
// This configuration is used during bootstrap
334+
#define WS_MAX_FRAME_RETRIES_BOOTSTRAP 0
335+
#define WS_NUMBER_OF_CHANNEL_RETRIES_BOOTSTRAP 19
326336

327337

328338
#if (1 + WS_MAX_FRAME_RETRIES) * (1 + WS_NUMBER_OF_CHANNEL_RETRIES) < 20

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ extern uint8_t DEVICE_MIN_SENS;
174174
#define FRAME_COUNTER_STORE_INTERVAL 60 // Time interval (on seconds) between checking if frame counter storing is needed
175175
#define FRAME_COUNTER_STORE_FORCE_INTERVAL (3600 * 20) // Time interval (on seconds) before frame counter storing is forced (if no other storing operations triggered)
176176
#define FRAME_COUNTER_STORE_TRIGGER 5 // Delay (on seconds) before storing, when storing of frame counters is triggered
177-
#define FRAME_COUNTER_INCREMENT 1000 // How much frame counter is incremented on start up
178-
#define FRAME_COUNTER_STORE_THRESHOLD 800 // How much frame counter must increment before it is stored
177+
#define FRAME_COUNTER_INCREMENT 1000000 // How much frame counter is incremented on start up
178+
#define FRAME_COUNTER_STORE_THRESHOLD 994999 // How much frame counter must increment before it is stored
179179

180180

181181
/*
@@ -219,7 +219,7 @@ extern uint8_t DEVICE_MIN_SENS;
219219
#define SEC_PROT_TIMER_EXPIRATIONS 2 // Number of retries
220220

221221
// Maximum number of simultaneous security negotiations
222-
#define MAX_SIMULTANEOUS_SECURITY_NEGOTIATIONS_SMALL 3
222+
#define MAX_SIMULTANEOUS_SECURITY_NEGOTIATIONS_SMALL 20
223223
#define MAX_SIMULTANEOUS_SECURITY_NEGOTIATIONS_MEDIUM 20
224224
#define MAX_SIMULTANEOUS_SECURITY_NEGOTIATIONS_LARGE 50
225225

0 commit comments

Comments
 (0)