diff --git a/hostapd/config_file.c b/hostapd/config_file.c index d65b805c1..3b30e5ec0 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -2734,6 +2734,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, conf->preamble = LONG_PREAMBLE; } else if (os_strcmp(buf, "ignore_broadcast_ssid") == 0) { bss->ignore_broadcast_ssid = atoi(pos); + } else if (os_strcmp(buf, "no_probe_resp_if_max_sta") == 0) { + bss->no_probe_resp_if_max_sta = atoi(pos); } else if (os_strcmp(buf, "wep_default_key") == 0) { bss->ssid.wep.idx = atoi(pos); if (bss->ssid.wep.idx > 3) { diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf index 195e20b9b..624a6f5fe 100644 --- a/hostapd/hostapd.conf +++ b/hostapd/hostapd.conf @@ -267,6 +267,13 @@ auth_algs=3 # requests for broadcast SSID ignore_broadcast_ssid=0 +# Do not reply to broadcast Probe Request frames from unassociated STA if there +# is no room for additional stations (max_num_sta). This can be used to +# discourage a STA from trying to associate with this AP if the association +# would be rejected due to maximum STA limit. +# Default: 0 (disabled) +#no_probe_resp_if_max_sta=0 + # Additional vendor specific elements for Beacon and Probe Response frames # This parameter can be used to add additional vendor specific element(s) into # the end of the Beacon and Probe Response frames. The format for these diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index 4f30a3c66..e66172891 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -366,6 +366,7 @@ struct hostapd_bss_config { int ap_max_inactivity; int ignore_broadcast_ssid; + int no_probe_resp_if_max_sta; int wmm_enabled; int wmm_uapsd; diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 5f1fc3eb7..e5b52fa20 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -844,6 +844,17 @@ void handle_probe_req(struct hostapd_data *hapd, return; } + if (hapd->conf->no_probe_resp_if_max_sta && + is_multicast_ether_addr(mgmt->da) && + is_multicast_ether_addr(mgmt->bssid) && + hapd->num_sta >= hapd->conf->max_num_sta && + !ap_get_sta(hapd, mgmt->sa)) { + wpa_printf(MSG_MSGDUMP, "%s: Ignore Probe Request from " MACSTR + " since no room for additional STA", + hapd->conf->iface, MAC2STR(mgmt->sa)); + return; + } + #ifdef CONFIG_TESTING_OPTIONS if (hapd->iconf->ignore_probe_probability > 0.0 && drand48() < hapd->iconf->ignore_probe_probability) {