Option to reduce Probe Response frame responses during max STA
authorJouni Malinen <j@w1.fi>
Sat, 17 Oct 2015 16:28:35 +0000 (19:28 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 17 Oct 2015 16:30:49 +0000 (19:30 +0300)
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>
hostapd/config_file.c
hostapd/hostapd.conf
src/ap/ap_config.h
src/ap/beacon.c

index d65b805..3b30e5e 100644 (file)
@@ -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) {
index 195e20b..624a6f5 100644 (file)
@@ -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
index 4f30a3c..e661728 100644 (file)
@@ -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;
index 5f1fc3e..e5b52fa 100644 (file)
@@ -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) {