1 --- a/hostapd/config_file.c
2 +++ b/hostapd/config_file.c
3 @@ -2875,6 +2875,14 @@ static int hostapd_config_fill(struct ho
4 line, bss->max_num_sta, MAX_STA_COUNT);
7 + } else if (os_strcmp(buf, "iface_max_num_sta") == 0) {
8 + conf->max_num_sta = atoi(pos);
9 + if (conf->max_num_sta < 0 ||
10 + conf->max_num_sta > MAX_STA_COUNT) {
11 + wpa_printf(MSG_ERROR, "Line %d: Invalid max_num_sta=%d; allowed range 0..%d",
12 + line, conf->max_num_sta, MAX_STA_COUNT);
15 } else if (os_strcmp(buf, "wpa") == 0) {
17 } else if (os_strcmp(buf, "extended_key_id") == 0) {
18 --- a/src/ap/hostapd.h
19 +++ b/src/ap/hostapd.h
20 @@ -666,6 +666,7 @@ void hostapd_cleanup_cs_params(struct ho
21 void hostapd_periodic_iface(struct hostapd_iface *iface);
22 int hostapd_owe_trans_get_info(struct hostapd_data *hapd);
23 void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx);
24 +int hostapd_check_max_sta(struct hostapd_data *hapd);
27 int hostapd_register_probereq_cb(struct hostapd_data *hapd,
28 --- a/src/ap/hostapd.c
29 +++ b/src/ap/hostapd.c
30 @@ -236,6 +236,30 @@ static int hostapd_iface_conf_changed(st
34 +static inline int hostapd_iface_num_sta(struct hostapd_iface *iface)
39 + for (i = 0; i < iface->num_bss; i++)
40 + num_sta += iface->bss[i]->num_sta;
46 +int hostapd_check_max_sta(struct hostapd_data *hapd)
48 + if (hapd->num_sta >= hapd->conf->max_num_sta)
51 + if (hapd->iconf->max_num_sta &&
52 + hostapd_iface_num_sta(hapd->iface) >= hapd->iconf->max_num_sta)
58 int hostapd_reload_config(struct hostapd_iface *iface, int reconf)
60 struct hapd_interfaces *interfaces = iface->interfaces;
63 @@ -1039,7 +1039,7 @@ void handle_probe_req(struct hostapd_dat
64 if (hapd->conf->no_probe_resp_if_max_sta &&
65 is_multicast_ether_addr(mgmt->da) &&
66 is_multicast_ether_addr(mgmt->bssid) &&
67 - hapd->num_sta >= hapd->conf->max_num_sta &&
68 + hostapd_check_max_sta(hapd) &&
69 !ap_get_sta(hapd, mgmt->sa)) {
70 wpa_printf(MSG_MSGDUMP, "%s: Ignore Probe Request from " MACSTR
71 " since no room for additional STA",
72 --- a/src/ap/ap_config.h
73 +++ b/src/ap/ap_config.h
74 @@ -976,6 +976,8 @@ struct hostapd_config {
75 unsigned int track_sta_max_num;
76 unsigned int track_sta_max_age;
80 char country[3]; /* first two octets: country code as described in
81 * ISO/IEC 3166-1. Third octet:
82 * ' ' (ascii 32): all environments