@@ -53,6 +53,7 @@ typedef struct ws_cfg_nw_size_s {
53
53
ws_timing_cfg_t timing ; /**< Timing configuration */
54
54
ws_bbr_cfg_t bbr ; /**< RPL configuration */
55
55
ws_sec_prot_cfg_t sec_prot ; /**< Security protocols configuration */
56
+ ws_mpl_cfg_t mpl ; /**< Multicast timing configuration*/
56
57
} ws_cfg_nw_size_t ;
57
58
58
59
static uint32_t ws_test_temporary_entry_lifetime = 0 ;
@@ -136,6 +137,8 @@ static int8_t ws_cfg_to_get(ws_cfgs_t **cfg, ws_cfgs_t *new_cfg, ws_cfg_validate
136
137
* cfg = (ws_cfgs_t * ) & nw_size_external_cfg -> bbr ;
137
138
} else if (ws_cfg_ptr == (ws_cfgs_t * ) & ws_cfg .sec_prot ) {
138
139
* cfg = (ws_cfgs_t * ) & nw_size_external_cfg -> sec_prot ;
140
+ } else if (ws_cfg_ptr == (ws_cfgs_t * ) & ws_cfg .mpl ) {
141
+ * cfg = (ws_cfgs_t * ) & nw_size_external_cfg -> mpl ;
139
142
} else {
140
143
* cfg = ws_cfg_ptr ;
141
144
}
@@ -251,6 +254,7 @@ int8_t ws_cfg_network_size_set(protocol_interface_info_entry_t *cur, ws_gen_cfg_
251
254
ws_cfg_timing_get (& nw_size_cfg .timing , NULL );
252
255
ws_cfg_bbr_get (& nw_size_cfg .bbr , NULL );
253
256
ws_cfg_sec_prot_get (& nw_size_cfg .sec_prot , NULL );
257
+ ws_cfg_mpl_get (& nw_size_cfg .mpl , NULL );
254
258
255
259
ws_cfg_network_size_config_set_size set_function = NULL ;
256
260
@@ -300,12 +304,15 @@ int8_t ws_cfg_network_size_set(protocol_interface_info_entry_t *cur, ws_gen_cfg_
300
304
old_network_size == NETWORK_SIZE_AUTOMATIC ) {
301
305
ws_cfg_sec_prot_set (cur , & ws_cfg .sec_prot , & nw_size_cfg .sec_prot , & set_flags );
302
306
}
307
+ if (ws_cfg_mpl_validate (& ws_cfg .mpl , & nw_size_cfg .mpl ) == CFG_SETTINGS_CHANGED ||
308
+ old_network_size == NETWORK_SIZE_AUTOMATIC ) {
309
+ ws_cfg_mpl_set (cur , & ws_cfg .mpl , & nw_size_cfg .mpl , & set_flags );
310
+ }
303
311
304
312
// If is in an automatic network size mode, updates automatic configuration
305
313
if (cfg -> network_size == NETWORK_SIZE_AUTOMATIC && cur ) {
306
314
ws_cfg_network_size_configure (cur , cur -> ws_info -> pan_information .pan_size );
307
315
}
308
-
309
316
return CFG_SETTINGS_OK ;
310
317
}
311
318
@@ -319,6 +326,7 @@ int8_t ws_cfg_network_size_configure(protocol_interface_info_entry_t *cur, uint1
319
326
ws_cfg_timing_get (& new_nw_size_cfg .timing , & flags );
320
327
ws_cfg_bbr_get (& new_nw_size_cfg .bbr , & flags );
321
328
ws_cfg_sec_prot_get (& new_nw_size_cfg .sec_prot , & flags );
329
+ ws_cfg_mpl_get (& new_nw_size_cfg .mpl , & flags );
322
330
323
331
if (!nw_size_external_cfg ) {
324
332
nw_size_external_cfg = ns_dyn_mem_alloc (sizeof (ws_cfg_nw_size_t ));
@@ -347,10 +355,12 @@ int8_t ws_cfg_network_size_configure(protocol_interface_info_entry_t *cur, uint1
347
355
ws_cfg_timing_set (cur , NULL , & new_nw_size_cfg .timing , & flags );
348
356
ws_cfg_bbr_set (cur , NULL , & new_nw_size_cfg .bbr , & flags );
349
357
ws_cfg_sec_prot_set (cur , NULL , & new_nw_size_cfg .sec_prot , & flags );
358
+ ws_cfg_mpl_set (cur , & ws_cfg .mpl , & new_nw_size_cfg .mpl , & flags );
350
359
351
360
return CFG_SETTINGS_OK ;
352
361
}
353
362
363
+
354
364
static void ws_cfg_network_size_config_set_small (ws_cfg_nw_size_t * cfg )
355
365
{
356
366
// Configure the Wi-SUN parent configuration
@@ -385,6 +395,14 @@ static void ws_cfg_network_size_config_set_small(ws_cfg_nw_size_t *cfg)
385
395
cfg -> sec_prot .initial_key_imin = SMALL_NW_INITIAL_KEY_TRICKLE_IMIN_SECS ;
386
396
cfg -> sec_prot .initial_key_imax = SMALL_NW_INITIAL_KEY_TRICKLE_IMAX_SECS ;
387
397
cfg -> sec_prot .initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT ;
398
+
399
+ // Multicast timing configuration
400
+ cfg -> mpl .mpl_trickle_imin = MPL_SMALL_IMIN ;
401
+ cfg -> mpl .mpl_trickle_imax = MPL_SMALL_IMAX ;
402
+ cfg -> mpl .mpl_trickle_k = MPL_SMALL_K ;
403
+ cfg -> mpl .mpl_trickle_timer_exp = MPL_SMALL_EXPIRATIONS ;
404
+ cfg -> mpl .seed_set_entry_lifetime = MPL_SMALL_SEED_LIFETIME ;
405
+
388
406
}
389
407
390
408
static void ws_cfg_network_size_config_set_medium (ws_cfg_nw_size_t * cfg )
@@ -421,6 +439,13 @@ static void ws_cfg_network_size_config_set_medium(ws_cfg_nw_size_t *cfg)
421
439
cfg -> sec_prot .initial_key_imin = MEDIUM_NW_INITIAL_KEY_TRICKLE_IMIN_SECS ;
422
440
cfg -> sec_prot .initial_key_imax = MEDIUM_NW_INITIAL_KEY_TRICKLE_IMAX_SECS ;
423
441
cfg -> sec_prot .initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT ;
442
+
443
+ // Multicast timing configuration
444
+ cfg -> mpl .mpl_trickle_imin = MPL_MEDIUM_IMIN ;
445
+ cfg -> mpl .mpl_trickle_imax = MPL_MEDIUM_IMAX ;
446
+ cfg -> mpl .mpl_trickle_k = MPL_MEDIUM_K ;
447
+ cfg -> mpl .mpl_trickle_timer_exp = MPL_MEDIUM_EXPIRATIONS ;
448
+ cfg -> mpl .seed_set_entry_lifetime = MPL_MEDIUM_SEED_LIFETIME ;
424
449
}
425
450
426
451
static void ws_cfg_network_size_config_set_large (ws_cfg_nw_size_t * cfg )
@@ -457,6 +482,14 @@ static void ws_cfg_network_size_config_set_large(ws_cfg_nw_size_t *cfg)
457
482
cfg -> sec_prot .initial_key_imin = LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS ;
458
483
cfg -> sec_prot .initial_key_imax = LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS ;
459
484
cfg -> sec_prot .initial_key_retry_cnt = LARGE_NW_INITIAL_KEY_RETRY_COUNT ;
485
+
486
+ // Multicast timing configuration
487
+ cfg -> mpl .mpl_trickle_imin = MPL_LARGE_IMIN ;
488
+ cfg -> mpl .mpl_trickle_imax = MPL_LARGE_IMAX ;
489
+ cfg -> mpl .mpl_trickle_k = MPL_LARGE_K ;
490
+ cfg -> mpl .mpl_trickle_timer_exp = MPL_LARGE_EXPIRATIONS ;
491
+ cfg -> mpl .seed_set_entry_lifetime = MPL_LARGE_SEED_LIFETIME ;
492
+
460
493
}
461
494
462
495
static void ws_cfg_network_size_config_set_xlarge (ws_cfg_nw_size_t * cfg )
@@ -493,6 +526,13 @@ static void ws_cfg_network_size_config_set_xlarge(ws_cfg_nw_size_t *cfg)
493
526
cfg -> sec_prot .initial_key_imin = EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS ;
494
527
cfg -> sec_prot .initial_key_imax = EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS ;
495
528
cfg -> sec_prot .initial_key_retry_cnt = EXTRA_LARGE_NW_INITIAL_KEY_RETRY_COUNT ;
529
+
530
+ // Multicast timing configuration
531
+ cfg -> mpl .mpl_trickle_imin = MPL_XLARGE_IMIN ;
532
+ cfg -> mpl .mpl_trickle_imax = MPL_XLARGE_IMAX ;
533
+ cfg -> mpl .mpl_trickle_k = MPL_XLARGE_K ;
534
+ cfg -> mpl .mpl_trickle_timer_exp = MPL_XLARGE_EXPIRATIONS ;
535
+ cfg -> mpl .seed_set_entry_lifetime = MPL_XLARGE_SEED_LIFETIME ;
496
536
}
497
537
498
538
static void ws_cfg_network_size_config_set_certificate (ws_cfg_nw_size_t * cfg )
@@ -529,6 +569,13 @@ static void ws_cfg_network_size_config_set_certificate(ws_cfg_nw_size_t *cfg)
529
569
cfg -> sec_prot .initial_key_imin = SMALL_NW_INITIAL_KEY_TRICKLE_IMIN_SECS ;
530
570
cfg -> sec_prot .initial_key_imax = SMALL_NW_INITIAL_KEY_TRICKLE_IMAX_SECS ;
531
571
cfg -> sec_prot .initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT ;
572
+
573
+ // Multicast timing configuration for certification uses the LARGE values as it is the one mentioned ins specification
574
+ cfg -> mpl .mpl_trickle_imin = MPL_XLARGE_IMIN ;
575
+ cfg -> mpl .mpl_trickle_imax = MPL_XLARGE_IMAX ;
576
+ cfg -> mpl .mpl_trickle_k = MPL_XLARGE_K ;
577
+ cfg -> mpl .mpl_trickle_timer_exp = MPL_XLARGE_EXPIRATIONS ;
578
+ cfg -> mpl .seed_set_entry_lifetime = MPL_XLARGE_SEED_LIFETIME ;
532
579
}
533
580
534
581
static int8_t ws_cfg_gen_default_set (ws_gen_cfg_t * cfg )
@@ -832,11 +879,11 @@ int8_t ws_cfg_bbr_set(protocol_interface_info_entry_t *cur, ws_bbr_cfg_t *cfg, w
832
879
static int8_t ws_cfg_mpl_default_set (ws_mpl_cfg_t * cfg )
833
880
{
834
881
// MPL configuration
835
- cfg -> mpl_trickle_imin = DATA_MESSAGE_IMIN ;
836
- cfg -> mpl_trickle_imax = DATA_MESSAGE_IMAX ;
837
- cfg -> mpl_trickle_k = DATA_MESSAGE_K ;
838
- cfg -> mpl_trickle_timer_exp = DATA_MESSAGE_TIMER_EXPIRATIONS ;
839
- cfg -> seed_set_entry_lifetime = MPL_SEED_SET_ENTRY_TIMEOUT ;
882
+ cfg -> mpl_trickle_imin = MPL_MEDIUM_IMIN ;
883
+ cfg -> mpl_trickle_imax = MPL_MEDIUM_IMAX ;
884
+ cfg -> mpl_trickle_k = MPL_MEDIUM_K ;
885
+ cfg -> mpl_trickle_timer_exp = MPL_MEDIUM_EXPIRATIONS ;
886
+ cfg -> seed_set_entry_lifetime = MPL_MEDIUM_SEED_LIFETIME ;
840
887
841
888
return CFG_SETTINGS_OK ;
842
889
}
@@ -869,6 +916,21 @@ int8_t ws_cfg_mpl_validate(ws_mpl_cfg_t *cfg, ws_mpl_cfg_t *new_cfg)
869
916
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 )
870
917
{
871
918
uint8_t cfg_flags ;
919
+
920
+ // In Wi-SUN Border router will have modified settings to improve reliability
921
+ if (cur && cur -> bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER ) {
922
+ // Border router sends multiple packets to ensure start of sequence
923
+ if (new_cfg -> mpl_trickle_timer_exp < MPL_BORDER_ROUTER_MIN_EXPIRATIONS ) {
924
+ new_cfg -> mpl_trickle_timer_exp = MPL_BORDER_ROUTER_MIN_EXPIRATIONS ;
925
+ // Lifetime is calculated using the original IMAX
926
+ new_cfg -> seed_set_entry_lifetime = new_cfg -> mpl_trickle_imax * new_cfg -> mpl_trickle_timer_exp * MPL_SAFE_HOP_COUNT ;
927
+ }
928
+ // Border router should have shorter IMAX to speed startup
929
+ if (new_cfg -> mpl_trickle_imax > MPL_BORDER_ROUTER_MAXIMUM_IMAX ) {
930
+ new_cfg -> mpl_trickle_imax = MPL_BORDER_ROUTER_MAXIMUM_IMAX ;
931
+ }
932
+ }
933
+
872
934
int8_t ret = ws_cfg_to_get ((ws_cfgs_t * * ) & cfg , (ws_cfgs_t * ) new_cfg , (ws_cfg_validate ) ws_cfg_mpl_validate , (ws_cfgs_t * ) & ws_cfg .mpl , & cfg_flags , flags );
873
935
if (ret != CFG_SETTINGS_CHANGED ) {
874
936
return ret ;
@@ -1205,6 +1267,7 @@ int8_t ws_cfg_settings_get(protocol_interface_info_entry_t *cur, ws_cfg_t *cfg)
1205
1267
ws_cfg_timing_get (& cfg -> timing , NULL );
1206
1268
ws_cfg_bbr_get (& cfg -> bbr , NULL );
1207
1269
ws_cfg_sec_prot_get (& cfg -> sec_prot , NULL );
1270
+ ws_cfg_mpl_get (& cfg -> mpl , NULL );
1208
1271
1209
1272
return CFG_SETTINGS_OK ;
1210
1273
}
0 commit comments