59
59
// Maximum number of simultaneous EAP-TLS negotiations
60
60
#define MAX_SIMULTANEOUS_EAP_TLS_NEGOTIATIONS 3
61
61
62
+ /* If EAP-TLS is delayed due to simultaneous negotiations limit, defines how
63
+ long to wait for previous negotiation to complete */
64
+ #define EAP_TLS_NEGOTIATION_TRIGGER_TIMEOUT 60 * 10 // 60 seconds
65
+
62
66
typedef struct {
63
67
ns_list_link_t link ; /**< Link */
64
68
kmp_service_t * kmp_service ; /**< KMP service */
@@ -100,6 +104,7 @@ static kmp_api_t *ws_pae_auth_kmp_incoming_ind(kmp_service_t *service, kmp_type_
100
104
static void ws_pae_auth_kmp_api_create_confirm (kmp_api_t * kmp , kmp_result_e result );
101
105
static void ws_pae_auth_kmp_api_create_indication (kmp_api_t * kmp , kmp_type_e type , kmp_addr_t * addr );
102
106
static void ws_pae_auth_kmp_api_finished_indication (kmp_api_t * kmp , kmp_result_e result , kmp_sec_keys_t * sec_keys );
107
+ static void ws_pae_auth_next_kmp_trigger (pae_auth_t * pae_auth , supp_entry_t * supp_entry );
103
108
static kmp_type_e ws_pae_auth_next_protocol_get (supp_entry_t * supp_entry );
104
109
static kmp_api_t * ws_pae_auth_kmp_create_and_start (kmp_service_t * service , kmp_type_e type , supp_entry_t * supp_entry );
105
110
static void ws_pae_auth_kmp_api_finished (kmp_api_t * kmp );
@@ -834,6 +839,20 @@ static void ws_pae_auth_kmp_api_finished_indication(kmp_api_t *kmp, kmp_result_e
834
839
// Should not be possible
835
840
return ;
836
841
}
842
+ kmp_service_t * service = kmp_api_service_get (kmp );
843
+ pae_auth_t * pae_auth = ws_pae_auth_by_kmp_service_get (service );
844
+ if (!pae_auth ) {
845
+ // Should not be possible
846
+ return ;
847
+ }
848
+
849
+ ws_pae_auth_next_kmp_trigger (pae_auth , supp_entry );
850
+ }
851
+
852
+ static void ws_pae_auth_next_kmp_trigger (pae_auth_t * pae_auth , supp_entry_t * supp_entry )
853
+ {
854
+ // Disables KMP retry timer
855
+ supp_entry -> retry_ticks = 0 ;
837
856
838
857
// Get next protocol based on what keys supplicant has
839
858
kmp_type_e next_type = ws_pae_auth_next_protocol_get (supp_entry );
@@ -846,19 +865,17 @@ static void ws_pae_auth_kmp_api_finished_indication(kmp_api_t *kmp, kmp_result_e
846
865
// Increases waiting time for supplicant authentication
847
866
ws_pae_lib_supp_timer_ticks_set (supp_entry , WAIT_FOR_AUTHENTICATION_TICKS );
848
867
849
- kmp_service_t * service = kmp_api_service_get (kmp );
850
- pae_auth_t * pae_auth = ws_pae_auth_by_kmp_service_get (service );
851
- if (!pae_auth ) {
852
- return ;
853
- }
854
-
855
868
if (next_type == IEEE_802_1X_MKA ) {
856
869
/* For EAP-TLS, limits the number of ongoing negotiations. If limit
857
- is reached, supplicant must re-send initial EAPOL-Key to try again
858
- using its trickle schedule */
870
+ is reached, authenticator does not initiate EAP-TLS right away.
871
+ If previous EAP-TLS negotiation completes before negotiation
872
+ trigger timeout, authenticator initiates EAP-TLS towards
873
+ supplicant. Otherwise supplicant must re-send initial EAPOL-Key
874
+ to try again using its trickle schedule */
859
875
uint16_t ongoing_eap_tls_cnt = ws_pae_lib_supp_list_kmp_count (& pae_auth -> active_supp_list , IEEE_802_1X_MKA );
860
876
if (ongoing_eap_tls_cnt >= MAX_SIMULTANEOUS_EAP_TLS_NEGOTIATIONS ) {
861
- tr_info ("EAP-TLS max ongoing reached, count %i, ignored: eui-64: %s" , ongoing_eap_tls_cnt , trace_array (kmp_address_eui_64_get (supp_entry -> addr ), 8 ));
877
+ supp_entry -> retry_ticks = EAP_TLS_NEGOTIATION_TRIGGER_TIMEOUT ;
878
+ tr_info ("EAP-TLS max ongoing reached, count %i, delayed: eui-64: %s" , ongoing_eap_tls_cnt , trace_array (kmp_address_eui_64_get (supp_entry -> addr ), 8 ));
862
879
return ;
863
880
}
864
881
}
@@ -877,7 +894,7 @@ static void ws_pae_auth_kmp_api_finished_indication(kmp_api_t *kmp, kmp_result_e
877
894
return ;
878
895
}
879
896
// Create TLS instance */
880
- if (ws_pae_auth_kmp_create_and_start (service , TLS_PROT , supp_entry ) == NULL ) {
897
+ if (ws_pae_auth_kmp_create_and_start (pae_auth -> kmp_service , TLS_PROT , supp_entry ) == NULL ) {
881
898
ws_pae_lib_kmp_list_delete (& supp_entry -> kmp_list , new_kmp );
882
899
return ;
883
900
}
@@ -970,8 +987,25 @@ static void ws_pae_auth_kmp_api_finished(kmp_api_t *kmp)
970
987
return ;
971
988
}
972
989
990
+ pae_auth_t * pae_auth = NULL ;
991
+ supp_entry_t * retry_supp = NULL ;
992
+ // When EAP-TLS completes check if there are other supplicants that have requested it lately
993
+ if (kmp_api_type_get (kmp ) == IEEE_802_1X_MKA ) {
994
+ kmp_service_t * service = kmp_api_service_get (kmp );
995
+ pae_auth = ws_pae_auth_by_kmp_service_get (service );
996
+ if (pae_auth ) {
997
+ retry_supp = ws_pae_lib_supp_list_entry_retry_timer_get (& pae_auth -> active_supp_list );
998
+ }
999
+ }
1000
+
973
1001
// Delete KMP
974
1002
ws_pae_lib_kmp_list_delete (& supp_entry -> kmp_list , kmp );
1003
+
1004
+ if (retry_supp ) {
1005
+ tr_info ("PAE next KMP trigger, eui-64: %s" , trace_array (kmp_address_eui_64_get (retry_supp -> addr ), 8 ));
1006
+ ws_pae_auth_next_kmp_trigger (pae_auth , retry_supp );
1007
+ }
1008
+
975
1009
}
976
1010
977
1011
#endif /* HAVE_PAE_AUTH */
0 commit comments