[PATCH] probe_request: ignore when rssi is too low

John Crispin john at phrozen.org
Wed Aug 12 12:55:31 EDT 2020


Signed-off-by: John Crispin <john at phrozen.org>
---
 hostapd/config_file.c | 2 ++
 src/ap/ap_config.c    | 1 +
 src/ap/ap_config.h    | 1 +
 src/ap/beacon.c       | 4 ++++
 4 files changed, 8 insertions(+)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 13396aad2..e0b182c8e 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4454,6 +4454,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 		conf->rssi_reject_assoc_rssi = atoi(pos);
 	} else if (os_strcmp(buf, "rssi_reject_assoc_timeout") == 0) {
 		conf->rssi_reject_assoc_timeout = atoi(pos);
+	} else if (os_strcmp(buf, "rssi_ignore_probe_request") == 0) {
+		conf->rssi_ignore_probe_request = atoi(pos);
 	} else if (os_strcmp(buf, "pbss") == 0) {
 		bss->pbss = atoi(pos);
 	} else if (os_strcmp(buf, "transition_disable") == 0) {
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 56a4ac388..088bb831a 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -277,6 +277,7 @@ struct hostapd_config * hostapd_config_defaults(void)
 
 	conf->rssi_reject_assoc_rssi = 0;
 	conf->rssi_reject_assoc_timeout = 30;
+	conf->rssi_ignore_probe_request = 0;
 
 #ifdef CONFIG_AIRTIME_POLICY
 	conf->airtime_update_interval = AIRTIME_DEFAULT_UPDATE_INTERVAL;
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 7fe418363..a69a8d324 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1042,6 +1042,7 @@ struct hostapd_config {
 
 	int rssi_reject_assoc_rssi;
 	int rssi_reject_assoc_timeout;
+	int rssi_ignore_probe_request;
 
 #ifdef CONFIG_AIRTIME_POLICY
 	enum {
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index bacedb719..0c16cd1f4 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -836,6 +836,10 @@ void handle_probe_req(struct hostapd_data *hapd,
 	    hapd != hostapd_get_primary_bss(hapd))
 		return;
 
+	if (hapd->iconf->rssi_ignore_probe_request && ssi_signal &&
+	    ssi_signal < hapd->iconf->rssi_ignore_probe_request)
+		return;
+
 	if (len < IEEE80211_HDRLEN)
 		return;
 	ie = ((const u8 *) mgmt) + IEEE80211_HDRLEN;
-- 
2.25.1




More information about the Hostap mailing list