Skip to content

Commit 4192cc8

Browse files
author
Mika Leppänen
authored
Added configuration for RADIUS retry timer (ARMmbed#2438)
* Added configuration for RADIUS retry timer
1 parent 684b714 commit 4192cc8

File tree

8 files changed

+315
-116
lines changed

8 files changed

+315
-116
lines changed

nanostack/ws_bbr_api.h

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ typedef struct bbr_route_info {
6262
uint8_t parent[8];
6363
} bbr_route_info_t;
6464

65+
/**
66+
* \brief Struct bbr_radius_timing_t is RADIUS timing configuration structure.
67+
*/
68+
typedef struct bbr_radius_timing {
69+
/** RADIUS retry timer Imin; in 100ms units; range 1-1200; default 20 (2 seconds) */
70+
uint16_t radius_retry_imin;
71+
/** RADIUS retry timer Imax; in 100ms units; range 1-1200; default 30 (3 seconds) */
72+
uint16_t radius_retry_imax;
73+
/** RADIUS retry count; default 3 */
74+
uint8_t radius_retry_count;
75+
} bbr_radius_timing_t;
76+
6577
/**
6678
* Start backbone border router service.
6779
*
@@ -394,7 +406,9 @@ int ws_bbr_radius_address_get(int8_t interface_id, uint8_t *address);
394406
*
395407
* Function sets RADIUS shared secret to Border Router. Shared secret may be an
396408
* ASCII string. Check the format and length constraints for the shared secret from
397-
* the documentation of RADIUS server you are connecting to.
409+
* the documentation of RADIUS server you are connecting to. Nanostack will not
410+
* make copy of the shared secret, therefore address and data must remain permanently
411+
* valid.
398412
*
399413
* \param interface_id Network interface ID.
400414
* \param shared_secret_len The length of the shared secret in bytes.
@@ -409,7 +423,7 @@ int ws_bbr_radius_shared_secret_set(int8_t interface_id, const uint16_t shared_s
409423
/**
410424
* Get RADIUS shared secret
411425
*
412-
* Function gets RADIUS shared secret to Border Router.
426+
* Function gets RADIUS shared secret from Border Router.
413427
*
414428
* \param interface_id Network interface ID.
415429
* \param shared_secret_len On function call, is the size of the shared secret write buffer in bytes, on return is the shared secret length in bytes.
@@ -421,6 +435,48 @@ int ws_bbr_radius_shared_secret_set(int8_t interface_id, const uint16_t shared_s
421435
*/
422436
int ws_bbr_radius_shared_secret_get(int8_t interface_id, uint16_t *shared_secret_len, uint8_t *shared_secret);
423437

438+
/**
439+
* Set RADIUS timing information
440+
*
441+
* Function sets RADIUS timing information to Border Router.
442+
*
443+
* \param interface_id Network interface ID.
444+
* \param timing Timing information
445+
*
446+
* \return < 0 failure
447+
* \return >= 0 success
448+
*
449+
*/
450+
int ws_bbr_radius_timing_set(int8_t interface_id, bbr_radius_timing_t *timing);
451+
452+
/**
453+
* Get RADIUS timing information
454+
*
455+
* Function sets RADIUS timing information from Border Router.
456+
*
457+
* \param interface_id Network interface ID.
458+
* \param timing Timing information
459+
*
460+
* \return < 0 failure
461+
* \return >= 0 success
462+
*
463+
*/
464+
int ws_bbr_radius_timing_get(int8_t interface_id, bbr_radius_timing_t *timing);
465+
466+
/**
467+
* Validate RADIUS timing information
468+
*
469+
* Function validates RADIUS timing information.
470+
*
471+
* \param interface_id Network interface ID.
472+
* \param timing Timing information
473+
*
474+
* \return < 0 failure
475+
* \return >= 0 success
476+
*
477+
*/
478+
int ws_bbr_radius_timing_validate(int8_t interface_id, bbr_radius_timing_t *timing);
479+
424480
/**
425481
* \brief A function to set DNS query results to border router
426482
*

source/6LoWPAN/ws/ws_bbr_api.c

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,40 @@ int ws_bbr_radius_shared_secret_get(int8_t interface_id, uint16_t *shared_secret
11621162
return -1;
11631163
#endif
11641164
}
1165+
1166+
int ws_bbr_radius_timing_set(int8_t interface_id, bbr_radius_timing_t *timing)
1167+
{
1168+
#ifdef HAVE_WS_BORDER_ROUTER
1169+
return ws_pae_controller_radius_timing_set(interface_id, timing);
1170+
#else
1171+
(void) interface_id;
1172+
(void) timing;
1173+
return -1;
1174+
#endif
1175+
}
1176+
1177+
int ws_bbr_radius_timing_get(int8_t interface_id, bbr_radius_timing_t *timing)
1178+
{
1179+
#ifdef HAVE_WS_BORDER_ROUTER
1180+
return ws_pae_controller_radius_timing_get(interface_id, timing);
1181+
#else
1182+
(void) interface_id;
1183+
(void) timing;
1184+
return -1;
1185+
#endif
1186+
}
1187+
1188+
int ws_bbr_radius_timing_validate(int8_t interface_id, bbr_radius_timing_t *timing)
1189+
{
1190+
#ifdef HAVE_WS_BORDER_ROUTER
1191+
return ws_pae_controller_radius_timing_validate(interface_id, timing);
1192+
#else
1193+
(void) interface_id;
1194+
(void) timing;
1195+
return -1;
1196+
#endif
1197+
}
1198+
11651199
int ws_bbr_dns_query_result_set(int8_t interface_id, const uint8_t address[16], char *domain_name_ptr)
11661200
{
11671201
#ifdef HAVE_WS_BORDER_ROUTER
@@ -1188,5 +1222,3 @@ int ws_bbr_dns_query_result_set(int8_t interface_id, const uint8_t address[16],
11881222
return -1;
11891223
#endif
11901224
}
1191-
1192-

source/6LoWPAN/ws/ws_config.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,4 +266,11 @@ extern uint8_t DEVICE_MIN_SENS;
266266
// How many times sending of initial EAPOL-key is retried
267267
#define DEFAULT_INITIAL_KEY_RETRY_COUNT 2
268268

269+
/*
270+
* RADIUS client retry timer defaults
271+
*/
272+
#define RADIUS_CLIENT_RETRY_IMIN 20 // First retry minimum 1 seconds
273+
#define RADIUS_CLIENT_RETRY_IMAX 30 // First retry maximum 3 seconds
274+
#define RADIUS_CLIENT_TIMER_EXPIRATIONS 3 // Number of retries is three
275+
269276
#endif /* WS_CONFIG_H_ */

source/6LoWPAN/ws/ws_pae_auth.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ static kmp_api_t *ws_pae_auth_kmp_incoming_ind(kmp_service_t *service, uint8_t m
980980
kmp_type_e kmp_type_to_search = type;
981981

982982
// If radius is enabled, route EAP-TLS to radius EAP-TLS
983-
if (pae_auth->sec_cfg->radius_cfg.radius_addr_set && type == IEEE_802_1X_MKA) {
983+
if (pae_auth->sec_cfg->radius_cfg != NULL && pae_auth->sec_cfg->radius_cfg->radius_addr_set && type == IEEE_802_1X_MKA) {
984984
kmp_type_to_search = RADIUS_IEEE_802_1X_MKA;
985985
}
986986

@@ -1150,7 +1150,7 @@ static kmp_type_e ws_pae_auth_next_protocol_get(pae_auth_t *pae_auth, supp_entry
11501150
if (sec_keys->pmk_mismatch) {
11511151
sec_keys->ptk_mismatch = true;
11521152
// start EAP-TLS towards supplicant
1153-
if (pae_auth->sec_cfg->radius_cfg.radius_addr_set) {
1153+
if (pae_auth->sec_cfg->radius_cfg != NULL && pae_auth->sec_cfg->radius_cfg->radius_addr_set) {
11541154
next_type = RADIUS_IEEE_802_1X_MKA;
11551155
} else {
11561156
next_type = IEEE_802_1X_MKA;

0 commit comments

Comments
 (0)