Skip to content

Commit 05fa359

Browse files
author
Mika Tervonen
committed
added support for EAPOL timing adjustment
Modified the minimum interval settings to be more suitable in Wi-SUN added possibility to give network slowness value that can be used to adjust timings
1 parent cfc3223 commit 05fa359

18 files changed

+317
-48
lines changed

source/6LoWPAN/ws/ws_common.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "6LoWPAN/ws/ws_common.h"
2828
#include "6LoWPAN/ws/ws_bootstrap.h"
2929
#include "6LoWPAN/ws/ws_bbr_api_internal.h"
30+
#include "6LoWPAN/ws/ws_pae_controller.h"
3031
#include "Service_Libs/etx/etx.h"
3132
#include "Service_Libs/mac_neighbor_table/mac_neighbor_table.h"
3233
#include "Service_Libs/blacklist/blacklist.h"
@@ -327,7 +328,7 @@ void ws_common_network_size_configure(protocol_interface_info_entry_t *cur, uint
327328
} else {
328329
ws_bbr_rpl_config(0, 0, 0);
329330
}
330-
331+
ws_pae_controller_timing_adjust(1); // Fast and reactive network
331332
} else if (network_size < 300) {
332333
// Configure the Wi-SUN discovery trickle parameters
333334
cur->ws_info->trickle_params_pan_discovery = trickle_params_pan_discovery_medium;
@@ -336,6 +337,7 @@ void ws_common_network_size_configure(protocol_interface_info_entry_t *cur, uint
336337
// doublings:5 (960s)
337338
// redundancy; 10
338339
ws_bbr_rpl_config(15, 5, 10);
340+
ws_pae_controller_timing_adjust(9); // medium limited network
339341
} else {
340342
// Configure the Wi-SUN discovery trickle parameters
341343
cur->ws_info->trickle_params_pan_discovery = trickle_params_pan_discovery_large;
@@ -344,6 +346,7 @@ void ws_common_network_size_configure(protocol_interface_info_entry_t *cur, uint
344346
// doublings:1 (1048s, 17 min)
345347
// redundancy; 10 May need some tuning still
346348
ws_bbr_rpl_config(19, 1, 10);
349+
ws_pae_controller_timing_adjust(24); // Very slow and high latency network
347350
}
348351
return;
349352
}

source/6LoWPAN/ws/ws_pae_auth.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,14 @@ int8_t ws_pae_auth_init(protocol_interface_info_entry_t *interface_ptr, sec_prot
212212
return -1;
213213
}
214214

215+
int8_t ws_pae_auth_timing_adjust(uint8_t timing)
216+
{
217+
auth_gkh_sec_prot_timing_adjust(timing);
218+
auth_fwh_sec_prot_timing_adjust(timing);
219+
auth_eap_tls_sec_prot_timing_adjust(timing);
220+
return 0;
221+
}
222+
215223
int8_t ws_pae_auth_addresses_set(protocol_interface_info_entry_t *interface_ptr, uint16_t local_port, const uint8_t *remote_addr, uint16_t remote_port)
216224
{
217225
if (!interface_ptr || !remote_addr) {

source/6LoWPAN/ws/ws_pae_auth.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,28 @@
5454
*/
5555
int8_t ws_pae_auth_init(protocol_interface_info_entry_t *interface_ptr, sec_prot_gtk_keys_t *gtks, sec_prot_gtk_keys_t *next_gtks, const sec_prot_certs_t *certs, timer_settings_t *timer_settings);
5656

57+
/**
58+
* ws_pae_auth_timing_adjust Adjust retries and timings of the security protocols
59+
*
60+
* Timing value is a generic number between 0 to 32 that goes from fast and
61+
* reactive network to low bandwidth and long latency.
62+
*
63+
* example value definitions:
64+
* 0-8 very fast network
65+
* 9-16 medium network
66+
* 16-24 slow network
67+
* 25-32 extremely slow network
68+
*
69+
* There is no need to have lots variations in every layer if protocol is not very active in any case.
70+
*
71+
* \param timing Timing value.
72+
*
73+
* \return < 0 failure
74+
* \return >= 0 success
75+
*
76+
*/
77+
int8_t ws_pae_auth_timing_adjust(uint8_t timing);
78+
5779
/**
5880
* ws_pae_auth_addresses_set set relay addresses
5981
*
@@ -210,6 +232,7 @@ void ws_pae_auth_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_
210232
#else
211233

212234
#define ws_pae_auth_init(interface_ptr, gtks, next_gtks, certs, timer_settings) 1
235+
#define ws_pae_auth_timing_adjust(timing) 1
213236
#define ws_pae_auth_addresses_set(interface_ptr, local_port, remote_addr, remote_port) 1
214237
#define ws_pae_auth_delete NULL
215238
#define ws_pae_auth_cb_register(interface_ptr, hash_set, nw_key_insert, nw_key_index_set) {(void) hash_set;}

source/6LoWPAN/ws/ws_pae_controller.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,13 @@ int8_t ws_pae_controller_delete(protocol_interface_info_entry_t *interface_ptr)
710710
return 0;
711711
}
712712

713+
int8_t ws_pae_controller_timing_adjust(uint8_t timing)
714+
{
715+
ws_pae_supp_timing_adjust(timing);
716+
ws_pae_auth_timing_adjust(timing);
717+
return 0;
718+
}
719+
713720
int8_t ws_pae_controller_certificate_chain_set(const arm_certificate_chain_entry_s *new_chain)
714721
{
715722
if (!new_chain) {

source/6LoWPAN/ws/ws_pae_controller.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,28 @@ int8_t ws_pae_controller_stop(protocol_interface_info_entry_t *interface_ptr);
114114
*/
115115
int8_t ws_pae_controller_delete(protocol_interface_info_entry_t *interface_ptr);
116116

117+
/**
118+
* ws_pae_controller_timing_adjust Adjust retries and timings of the security protocols
119+
*
120+
* Timing value is a generic number between 0 to 32 that goes from fast and
121+
* reactive network to low bandwidth and long latency.
122+
*
123+
* example value definitions:
124+
* 0-8 very fast network
125+
* 9-16 medium network
126+
* 16-24 slow network
127+
* 25-32 extremely slow network
128+
*
129+
* There is no need to have lots variations in every layer if protocol is not very active in any case.
130+
*
131+
* \param timing Timing value.
132+
*
133+
* \return < 0 failure
134+
* \return >= 0 success
135+
*
136+
*/
137+
int8_t ws_pae_controller_timing_adjust(uint8_t timing);
138+
117139
/**
118140
* ws_pae_controller_certificate_chain_set set certificate chain
119141
*

source/6LoWPAN/ws/ws_pae_supp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,13 @@ int8_t ws_pae_supp_delete(protocol_interface_info_entry_t *interface_ptr)
656656
return 0;
657657
}
658658

659+
int8_t ws_pae_supp_timing_adjust(uint8_t timing)
660+
{
661+
supp_fwh_sec_prot_timing_adjust(timing);
662+
supp_eap_sec_prot_timing_adjust(timing);
663+
return 0;
664+
}
665+
659666
static void ws_pae_supp_free(pae_supp_t *pae_supp)
660667
{
661668
if (!pae_supp) {

source/6LoWPAN/ws/ws_pae_supp.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,29 @@ int8_t ws_pae_supp_init(protocol_interface_info_entry_t *interface_ptr, const se
5757
*/
5858
int8_t ws_pae_supp_delete(protocol_interface_info_entry_t *interface_ptr);
5959

60+
61+
/**
62+
* ws_pae_supp_timing_adjust Adjust retries and timings of the 4WH protocol
63+
*
64+
* Timing value is a generic number between 0 to 32 that goes from fast and
65+
* reactive network to low bandwidth and long latency.
66+
*
67+
* example value definitions:
68+
* 0-8 very fast network
69+
* 9-16 medium network
70+
* 16-24 slow network
71+
* 25-32 extremely slow network
72+
*
73+
* There is no need to have lots variations in every layer if protocol is not very active in any case.
74+
*
75+
* \param timing Timing value.
76+
*
77+
* \return < 0 failure
78+
* \return >= 0 success
79+
*
80+
*/
81+
int8_t ws_pae_supp_timing_adjust(uint8_t timing);
82+
6083
/**
6184
* ws_pae_supp_fast_timer PAE supplicant fast timer call
6285
*
@@ -204,6 +227,7 @@ void ws_pae_supp_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_
204227

205228
#define ws_pae_supp_init(interface_ptr, certs, timer_settings) 1
206229
#define ws_pae_supp_delete NULL
230+
#define ws_pae_supp_timing_adjust(timing) 1
207231
#define ws_pae_supp_cb_register(interface_ptr, completed, nw_key_insert, nw_key_index_set)
208232
#define ws_pae_supp_nw_info_set(interface_ptr, pan_id, network_name) -1
209233
#define ws_pae_supp_nw_key_valid(interface_ptr) -1

source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.c

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,18 @@ typedef struct {
6969
bool send_pending: 1; /**< TLS data is not yet send to network */
7070
} eap_tls_sec_prot_int_t;
7171

72-
static const trickle_params_t eap_tls_trickle_params = {
73-
.Imin = 200, /* 20s; ticks are 100ms */
74-
.Imax = 450, /* 45s */
72+
/*Small network setup*/
73+
#define EAP_TLS_SMALL_IMIN 300 // retries done in 30 seconds
74+
#define EAP_TLS_SMALL_IMAX 900 // Largest value 90 seconds
75+
76+
/* Large network setup*/
77+
#define EAP_TLS_LARGE_IMIN 600 // retries done in 60 seconds
78+
#define EAP_TLS_LARGE_IMAX 2400 // Largest value 240 seconds
79+
80+
81+
static trickle_params_t eap_tls_trickle_params = {
82+
.Imin = EAP_TLS_SMALL_IMIN, /* ticks are 100ms */
83+
.Imax = EAP_TLS_SMALL_IMAX, /* ticks are 100ms */
7584
.k = 0, /* infinity - no consistency checking */
7685
.TimerExpirations = 2
7786
};
@@ -109,6 +118,19 @@ int8_t auth_eap_tls_sec_prot_register(kmp_service_t *service)
109118
return 0;
110119
}
111120

121+
int8_t auth_eap_tls_sec_prot_timing_adjust(uint8_t timing)
122+
{
123+
124+
if (timing < 16) {
125+
eap_tls_trickle_params.Imin = EAP_TLS_SMALL_IMIN;
126+
eap_tls_trickle_params.Imax = EAP_TLS_SMALL_IMAX;
127+
} else {
128+
eap_tls_trickle_params.Imin = EAP_TLS_LARGE_IMIN;
129+
eap_tls_trickle_params.Imax = EAP_TLS_LARGE_IMAX;
130+
}
131+
return 0;
132+
}
133+
112134
static uint16_t auth_eap_tls_sec_prot_size(void)
113135
{
114136
return sizeof(eap_tls_sec_prot_int_t);

source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,26 @@
3333
*/
3434
int8_t auth_eap_tls_sec_prot_register(kmp_service_t *service);
3535

36+
/**
37+
* auth_eap_tls_sec_prot_timing_adjust Adjust retries and timings of the EAP-TLS protocol
38+
*
39+
* Timing value is a generic number between 0 to 32 that goes from fast and
40+
* reactive network to low bandwidth and long latency.
41+
*
42+
* example value definitions:
43+
* 0-8 very fast network
44+
* 9-16 medium network
45+
* 16-24 slow network
46+
* 25-32 extremely slow network
47+
*
48+
* There is no need to have lots variations in every layer if protocol is not very active in any case.
49+
*
50+
* \param timing Timing value.
51+
*
52+
* \return < 0 failure
53+
* \return >= 0 success
54+
*
55+
*/
56+
int8_t auth_eap_tls_sec_prot_timing_adjust(uint8_t timing);
57+
3658
#endif /* AUTH_EAP_TLS_SEC_PROT_H_ */

source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.c

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,10 @@ typedef struct {
7272
bool send_pending: 1; /**< TLS data is not yet send to network */
7373
} eap_tls_sec_prot_int_t;
7474

75-
static const trickle_params_t eap_tls_trickle_params = {
76-
.Imin = 200, /* 20s; ticks are 100ms */
77-
.Imax = 450, /* 45s */
78-
.k = 0, /* infinity - no consistency checking */
79-
.TimerExpirations = 2
80-
};
75+
#define FWH_RETRY_TIMEOUT_SMALL 330*10 // retry timeout for small network additional 30 seconds for authenticator delay
76+
#define FWH_RETRY_TIMEOUT_LARGE 750*10 // retry timeout for large network additional 30 seconds for authenticator delay
77+
78+
static uint16_t retry_timeout = FWH_RETRY_TIMEOUT_SMALL;
8179

8280
static uint16_t supp_eap_tls_sec_prot_size(void);
8381
static int8_t supp_eap_tls_sec_prot_init(sec_prot_t *prot);
@@ -112,6 +110,17 @@ int8_t supp_eap_tls_sec_prot_register(kmp_service_t *service)
112110
return 0;
113111
}
114112

113+
int8_t supp_eap_sec_prot_timing_adjust(uint8_t timing)
114+
{
115+
if (timing < 16) {
116+
retry_timeout = FWH_RETRY_TIMEOUT_SMALL;
117+
} else {
118+
retry_timeout = FWH_RETRY_TIMEOUT_LARGE;
119+
}
120+
return 0;
121+
}
122+
123+
115124
static uint16_t supp_eap_tls_sec_prot_size(void)
116125
{
117126
return sizeof(eap_tls_sec_prot_int_t);
@@ -281,7 +290,7 @@ static void supp_eap_tls_sec_prot_timer_timeout(sec_prot_t *prot, uint16_t ticks
281290
data->burst_filt_timer = 0;
282291
}
283292

284-
sec_prot_timer_timeout_handle(prot, &data->common, &eap_tls_trickle_params, ticks);
293+
sec_prot_timer_timeout_handle(prot, &data->common, NULL, ticks);
285294
}
286295

287296
static void supp_eap_tls_sec_prot_tls_create_confirm(sec_prot_t *tls_prot, sec_prot_result_e result)
@@ -420,9 +429,6 @@ static void supp_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
420429
// Send EAP response, Identity
421430
supp_eap_tls_sec_prot_message_send(prot, EAP_RESPONSE, EAP_IDENTITY, EAP_TLS_EXCHANGE_NONE);
422431

423-
// Start trickle timer to re-send if no response
424-
sec_prot_timer_trickle_start(&data->common, &eap_tls_trickle_params);
425-
426432
sec_prot_state_set(prot, &data->common, EAP_TLS_STATE_REQUEST_TLS_EAP);
427433
} else {
428434
// Ready to be deleted
@@ -431,12 +437,6 @@ static void supp_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
431437
break;
432438

433439
case EAP_TLS_STATE_REQUEST_TLS_EAP:
434-
// On timeout
435-
if (sec_prot_result_timeout_check(&data->common)) {
436-
/* Waits for next trickle expire. If trickle expirations reach the limit,
437-
terminates EAP-TLS */
438-
return;
439-
}
440440

441441
// Handle EAP request (expected TLS EAP start)
442442
result = supp_eap_tls_sec_prot_message_handle(prot);
@@ -456,6 +456,7 @@ static void supp_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
456456
supp_eap_tls_sec_prot_seq_id_update(prot);
457457

458458
sec_prot_state_set(prot, &data->common, EAP_TLS_STATE_REQUEST);
459+
data->common.ticks = retry_timeout;
459460

460461
// Initialize TLS protocol
461462
supp_eap_tls_sec_prot_init_tls(prot);
@@ -464,12 +465,6 @@ static void supp_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
464465
break;
465466

466467
case EAP_TLS_STATE_REQUEST:
467-
// On timeout
468-
if (sec_prot_result_timeout_check(&data->common)) {
469-
/* Waits for next trickle expire. If trickle expirations reach the limit,
470-
terminates EAP-TLS */
471-
return;
472-
}
473468

474469
// EAP success
475470
if (data->eap_code == EAP_SUCCESS) {
@@ -514,8 +509,9 @@ static void supp_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
514509
supp_eap_tls_sec_prot_message_send(prot, EAP_RESPONSE, EAP_TLS, EAP_TLS_EXCHANGE_ONGOING);
515510
data->send_pending = false;
516511

517-
// Start trickle timer to re-send if no response
518-
sec_prot_timer_trickle_start(&data->common, &eap_tls_trickle_params);
512+
// Add more time for re-send if no response
513+
data->common.ticks = retry_timeout;
514+
519515
break;
520516

521517
case EAP_TLS_STATE_FINISH:

source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,27 @@
3333
*/
3434
int8_t supp_eap_tls_sec_prot_register(kmp_service_t *service);
3535

36+
/**
37+
* supp_eap_sec_prot_timing_adjust Adjust retries and timings of the 4WH protocol
38+
*
39+
* Timing value is a generic number between 0 to 32 that goes from fast and
40+
* reactive network to low bandwidth and long latency.
41+
*
42+
* example value definitions:
43+
* 0-8 very fast network
44+
* 9-16 medium network
45+
* 16-24 slow network
46+
* 25-32 extremely slow network
47+
*
48+
* There is no need to have lots variations in every layer if protocol is not very active in any case.
49+
*
50+
* \param timing Timing value.
51+
*
52+
* \return < 0 failure
53+
* \return >= 0 success
54+
*
55+
*/
56+
int8_t supp_eap_sec_prot_timing_adjust(uint8_t timing);
57+
3658
#endif /* SUPP_EAP_TLS_SEC_PROT_H_ */
3759

0 commit comments

Comments
 (0)