@@ -79,6 +79,8 @@ typedef enum {
7979#define RADIUS_ID_RANGE_SIZE 10
8080#define RADIUS_ID_RANGE_NUM (255 / RADIUS_ID_RANGE_SIZE) - 1
8181
82+ #define RADIUS_ID_TIMEOUT 60
83+
8284typedef struct radius_client_sec_prot_lib_int_s radius_client_sec_prot_lib_int_t ;
8385
8486typedef struct {
@@ -120,7 +122,6 @@ typedef struct {
120122static uint16_t radius_client_sec_prot_size (void );
121123static int8_t radius_client_sec_prot_init (sec_prot_t * prot );
122124static int8_t radius_client_sec_prot_shared_data_timeout (uint16_t ticks );
123- static void radius_identifier_timer_value_set (uint8_t conn_num , uint8_t id_range , uint8_t value );
124125static int8_t radius_client_sec_prot_shared_data_delete (void );
125126static void radius_identifier_timer_value_set (uint8_t conn_num , uint8_t id_range , uint8_t value );
126127static void radius_client_sec_prot_create_response (sec_prot_t * prot , sec_prot_result_e result );
@@ -541,17 +542,17 @@ static uint8_t radius_client_sec_prot_identifier_allocate(sec_prot_t *prot, uint
541542{
542543 radius_client_sec_prot_int_t * data = radius_client_sec_prot_get (prot );
543544
544- if (!data -> radius_id_range_set || value >= (data -> radius_id_range * RADIUS_ID_RANGE_SIZE ) + RADIUS_ID_RANGE_SIZE ) {
545+ if (!data -> radius_id_range_set || value >= (data -> radius_id_range * RADIUS_ID_RANGE_SIZE ) + RADIUS_ID_RANGE_SIZE - 1 ) {
545546 for (uint8_t conn_num = 0 ; conn_num < RADIUS_CONN_NUMBER ; conn_num ++ ) {
546547 for (uint8_t id_range = 0 ; id_range < RADIUS_ID_RANGE_NUM ; id_range ++ ) {
547548 if (shared_data -> radius_identifier_timer [conn_num ][id_range ] == 0 ) {
548549 // If range has been already reserved
549550 if (data -> radius_id_range_set ) {
550- // Set previous range to timeout in 5 seconds
551- radius_identifier_timer_value_set (data -> radius_id_conn_num , data -> radius_id_range , 5 );
551+ // Set previous range to timeout at 1/5 of identifier timeout
552+ radius_identifier_timer_value_set (data -> radius_id_conn_num , data -> radius_id_range , RADIUS_ID_TIMEOUT / 5 );
552553 }
553554 // Set timeout for new range to 60 seconds
554- radius_identifier_timer_value_set (conn_num , id_range , 60 );
555+ radius_identifier_timer_value_set (conn_num , id_range , RADIUS_ID_TIMEOUT );
555556 data -> radius_id_conn_num = conn_num ;
556557 data -> radius_id_range = id_range ;
557558 data -> radius_id_range_set = true;
@@ -560,7 +561,7 @@ static uint8_t radius_client_sec_prot_identifier_allocate(sec_prot_t *prot, uint
560561 }
561562 }
562563 } else {
563- radius_identifier_timer_value_set (data -> radius_id_conn_num , data -> radius_id_range , 60 );
564+ radius_identifier_timer_value_set (data -> radius_id_conn_num , data -> radius_id_range , RADIUS_ID_TIMEOUT );
564565 return value + 1 ;
565566 }
566567
@@ -572,7 +573,8 @@ static void radius_client_sec_prot_identifier_free(sec_prot_t *prot)
572573 radius_client_sec_prot_int_t * data = radius_client_sec_prot_get (prot );
573574
574575 if (data -> radius_id_range_set ) {
575- radius_identifier_timer_value_set (data -> radius_id_conn_num , data -> radius_id_range , 5 );
576+ // Timeout at 1/5 of identifier timeout
577+ radius_identifier_timer_value_set (data -> radius_id_conn_num , data -> radius_id_range , RADIUS_ID_TIMEOUT / 5 );
576578 }
577579}
578580
0 commit comments