@@ -93,6 +93,7 @@ typedef struct {
9393 ws_pae_auth_nw_key_index_set * nw_key_index_set ; /**< Key index set callback */
9494 ws_pae_auth_nw_info_updated * nw_info_updated ; /**< Security keys network info updated callback */
9595 ws_pae_auth_ip_addr_get * ip_addr_get ; /**< IP address get callback */
96+ ws_pae_auth_congestion_get * congestion_get ; /**< Congestion get callback */
9697 supp_list_t active_supp_list ; /**< List of active supplicants */
9798 shared_comp_list_t shared_comp_list ; /**< Shared component list */
9899 arm_event_storage_t * timer ; /**< Timer */
@@ -128,6 +129,7 @@ static bool ws_pae_auth_timer_running(pae_auth_t *pae_auth);
128129static void ws_pae_auth_kmp_service_addr_get (kmp_service_t * service , kmp_api_t * kmp , kmp_addr_t * local_addr , kmp_addr_t * remote_addr );
129130static void ws_pae_auth_kmp_service_ip_addr_get (kmp_service_t * service , kmp_api_t * kmp , uint8_t * address );
130131static kmp_api_t * ws_pae_auth_kmp_service_api_get (kmp_service_t * service , kmp_api_t * kmp , kmp_type_e type );
132+ static bool ws_pae_auth_active_limit_reached (uint16_t active_supp , pae_auth_t * pae_auth );
131133static kmp_api_t * ws_pae_auth_kmp_incoming_ind (kmp_service_t * service , uint8_t msg_if_instance_id , kmp_type_e type , const kmp_addr_t * addr , const void * pdu , uint16_t size );
132134static void ws_pae_auth_kmp_api_create_confirm (kmp_api_t * kmp , kmp_result_e result );
133135static void ws_pae_auth_kmp_api_create_indication (kmp_api_t * kmp , kmp_type_e type , kmp_addr_t * addr );
@@ -166,6 +168,9 @@ int8_t ws_pae_auth_init(protocol_interface_info_entry_t *interface_ptr, sec_prot
166168 pae_auth -> nw_key_insert = NULL ;
167169 pae_auth -> nw_keys_remove = NULL ;
168170 pae_auth -> nw_key_index_set = NULL ;
171+ pae_auth -> nw_info_updated = NULL ;
172+ pae_auth -> ip_addr_get = NULL ;
173+ pae_auth -> congestion_get = NULL ;
169174
170175 pae_auth -> next_gtks = next_gtks ;
171176 pae_auth -> certs = certs ;
@@ -302,7 +307,7 @@ int8_t ws_pae_auth_delete(protocol_interface_info_entry_t *interface_ptr)
302307 return 0 ;
303308}
304309
305- void ws_pae_auth_cb_register (protocol_interface_info_entry_t * interface_ptr , ws_pae_auth_gtk_hash_set * hash_set , ws_pae_auth_nw_key_insert * nw_key_insert , ws_pae_auth_nw_key_index_set * nw_key_index_set , ws_pae_auth_nw_info_updated * nw_info_updated , ws_pae_auth_ip_addr_get * ip_addr_get )
310+ void ws_pae_auth_cb_register (protocol_interface_info_entry_t * interface_ptr , ws_pae_auth_gtk_hash_set * hash_set , ws_pae_auth_nw_key_insert * nw_key_insert , ws_pae_auth_nw_key_index_set * nw_key_index_set , ws_pae_auth_nw_info_updated * nw_info_updated , ws_pae_auth_ip_addr_get * ip_addr_get , ws_pae_auth_congestion_get * congestion_get )
306311{
307312 if (!interface_ptr ) {
308313 return ;
@@ -318,6 +323,7 @@ void ws_pae_auth_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_
318323 pae_auth -> nw_key_index_set = nw_key_index_set ;
319324 pae_auth -> nw_info_updated = nw_info_updated ;
320325 pae_auth -> ip_addr_get = ip_addr_get ;
326+ pae_auth -> congestion_get = congestion_get ;
321327}
322328
323329void ws_pae_auth_start (protocol_interface_info_entry_t * interface_ptr )
@@ -936,6 +942,11 @@ static kmp_api_t *ws_pae_auth_kmp_service_api_get(kmp_service_t *service, kmp_ap
936942 return ws_pae_lib_kmp_list_type_get (& supp_entry -> kmp_list , type );
937943}
938944
945+ static bool ws_pae_auth_active_limit_reached (uint16_t active_supp , pae_auth_t * pae_auth )
946+ {
947+ return pae_auth -> congestion_get (pae_auth -> interface_ptr , active_supp );
948+ }
949+
939950static kmp_api_t * ws_pae_auth_kmp_incoming_ind (kmp_service_t * service , uint8_t msg_if_instance_id , kmp_type_e type , const kmp_addr_t * addr , const void * pdu , uint16_t size )
940951{
941952 pae_auth_t * pae_auth = ws_pae_auth_by_kmp_service_get (service );
@@ -954,8 +965,9 @@ static kmp_api_t *ws_pae_auth_kmp_incoming_ind(kmp_service_t *service, uint8_t m
954965 supp_entry_t * supp_entry = ws_pae_lib_supp_list_entry_eui_64_get (& pae_auth -> active_supp_list , kmp_address_eui_64_get (addr ));
955966
956967 if (!supp_entry ) {
968+ uint16_t active_supp = ns_list_count (& pae_auth -> active_supp_list );
957969 // Checks if active supplicant list has space for new supplicants
958- if (ws_pae_lib_supp_list_active_limit_reached ( & pae_auth -> active_supp_list , pae_auth -> sec_cfg -> prot_cfg . sec_max_ongoing_authentication )) {
970+ if (ws_pae_auth_active_limit_reached ( active_supp , pae_auth )) {
959971 tr_debug ("PAE: active limit reached, eui-64: %s" , trace_array (kmp_address_eui_64_get (addr ), 8 ));
960972 return NULL ;
961973 }
@@ -1103,10 +1115,10 @@ static void ws_pae_auth_next_kmp_trigger(pae_auth_t *pae_auth, supp_entry_t *sup
11031115 trigger timeout, authenticator initiates EAP-TLS towards
11041116 supplicant. Otherwise supplicant must re-send initial EAPOL-Key
11051117 to try again using its trickle schedule */
1106- uint16_t ongoing_eap_tls_cnt = ws_pae_lib_supp_list_kmp_count (& pae_auth -> active_supp_list , next_type );
1107- if (ongoing_eap_tls_cnt >= pae_auth -> sec_cfg -> prot_cfg . sec_max_ongoing_authentication ) {
1118+ uint16_t active_supp = ns_list_count (& pae_auth -> active_supp_list );
1119+ if (ws_pae_auth_active_limit_reached ( active_supp , pae_auth ) ) {
11081120 supp_entry -> retry_ticks = EAP_TLS_NEGOTIATION_TRIGGER_TIMEOUT ;
1109- tr_info ("EAP-TLS max ongoing reached, count %i, delayed: eui-64: %s" , ongoing_eap_tls_cnt , trace_array (supp_entry -> addr .eui_64 , 8 ));
1121+ tr_info ("EAP-TLS max ongoing reached, count %i, delayed: eui-64: %s" , active_supp , trace_array (supp_entry -> addr .eui_64 , 8 ));
11101122 return ;
11111123 }
11121124 }
0 commit comments