Option to reduce Probe Response frame responses during max STA

The new hostapd configuration parameter no_probe_resp_if_max_sta=1 can
be used to request hostapd not to 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.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-10-17 19:28:35 +03:00
parent ca33a5e895
commit 9b7a1bd7ed
4 changed files with 21 additions and 0 deletions

View file

@ -2734,6 +2734,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
conf->preamble = LONG_PREAMBLE; conf->preamble = LONG_PREAMBLE;
} else if (os_strcmp(buf, "ignore_broadcast_ssid") == 0) { } else if (os_strcmp(buf, "ignore_broadcast_ssid") == 0) {
bss->ignore_broadcast_ssid = atoi(pos); 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) { } else if (os_strcmp(buf, "wep_default_key") == 0) {
bss->ssid.wep.idx = atoi(pos); bss->ssid.wep.idx = atoi(pos);
if (bss->ssid.wep.idx > 3) { if (bss->ssid.wep.idx > 3) {

View file

@ -267,6 +267,13 @@ auth_algs=3
# requests for broadcast SSID # requests for broadcast SSID
ignore_broadcast_ssid=0 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 # Additional vendor specific elements for Beacon and Probe Response frames
# This parameter can be used to add additional vendor specific element(s) into # 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 # the end of the Beacon and Probe Response frames. The format for these

View file

@ -366,6 +366,7 @@ struct hostapd_bss_config {
int ap_max_inactivity; int ap_max_inactivity;
int ignore_broadcast_ssid; int ignore_broadcast_ssid;
int no_probe_resp_if_max_sta;
int wmm_enabled; int wmm_enabled;
int wmm_uapsd; int wmm_uapsd;

View file

@ -844,6 +844,17 @@ void handle_probe_req(struct hostapd_data *hapd,
return; 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 #ifdef CONFIG_TESTING_OPTIONS
if (hapd->iconf->ignore_probe_probability > 0.0 && if (hapd->iconf->ignore_probe_probability > 0.0 &&
drand48() < hapd->iconf->ignore_probe_probability) { drand48() < hapd->iconf->ignore_probe_probability) {