AP: Enable anti clogging handling code in PASN builds without SAE

The anti-clogging code was under CONFIG_SAE. Change this so it can be
used both with CONFIG_SAE and CONFIG_PASN.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
Ilan Peer 2021-03-15 14:57:06 +02:00 committed by Jouni Malinen
parent 6fe0d56e88
commit 166e357e63

View file

@ -687,6 +687,10 @@ static int auth_sae_send_confirm(struct hostapd_data *hapd,
return reply_res; return reply_res;
} }
#endif /* CONFIG_SAE */
#if defined(CONFIG_SAE) || defined(CONFIG_PASN)
static int use_anti_clogging(struct hostapd_data *hapd) static int use_anti_clogging(struct hostapd_data *hapd)
{ {
@ -697,22 +701,26 @@ static int use_anti_clogging(struct hostapd_data *hapd)
return 1; return 1;
for (sta = hapd->sta_list; sta; sta = sta->next) { for (sta = hapd->sta_list; sta; sta = sta->next) {
#ifdef CONFIG_SAE
if (!sta->sae) if (!sta->sae)
continue; continue;
if (sta->sae->state != SAE_COMMITTED && if (sta->sae->state != SAE_COMMITTED &&
sta->sae->state != SAE_CONFIRMED) sta->sae->state != SAE_CONFIRMED)
continue; continue;
open++; open++;
#endif /* CONFIG_SAE */
if (open >= hapd->conf->anti_clogging_threshold) if (open >= hapd->conf->anti_clogging_threshold)
return 1; return 1;
} }
#ifdef CONFIG_SAE
/* In addition to already existing open SAE sessions, check whether /* In addition to already existing open SAE sessions, check whether
* there are enough pending commit messages in the processing queue to * there are enough pending commit messages in the processing queue to
* potentially result in too many open sessions. */ * potentially result in too many open sessions. */
if (open + dl_list_len(&hapd->sae_commit_queue) >= if (open + dl_list_len(&hapd->sae_commit_queue) >=
hapd->conf->anti_clogging_threshold) hapd->conf->anti_clogging_threshold)
return 1; return 1;
#endif /* CONFIG_SAE */
return 0; return 0;
} }
@ -834,6 +842,10 @@ static struct wpabuf * auth_build_token_req(struct hostapd_data *hapd,
return buf; return buf;
} }
#endif /* defined(CONFIG_SAE) || defined(CONFIG_PASN) */
#ifdef CONFIG_SAE
static int sae_check_big_sync(struct hostapd_data *hapd, struct sta_info *sta) static int sae_check_big_sync(struct hostapd_data *hapd, struct sta_info *sta)
{ {