Files
wlan-ap/patches/wifi/0021-hostapd-add-dynamic_probe_resp.patch
John Crispin 8e2f2fcce3 hostapd: add dynamic_probe_resp support
Signed-off-by: John Crispin <john@phrozen.org>
2022-11-23 09:00:38 +01:00

109 lines
4.4 KiB
Diff

From 4688450129baef1b5e495256947075f992778a1f Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Wed, 16 Nov 2022 16:40:01 +0100
Subject: [PATCH 21/21] hostapd: add dynamic_probe_resp
Signed-off-by: John Crispin <john@phrozen.org>
---
.../network/services/hostapd/files/hostapd.sh | 6 ++-
.../hostapd/patches/999-probe-request.patch | 49 +++++++++++++++++++
2 files changed, 54 insertions(+), 1 deletion(-)
create mode 100644 package/network/services/hostapd/patches/999-probe-request.patch
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index c308d1d2de..8362158cb0 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -394,6 +394,8 @@ hostapd_common_add_bss_config() {
config_add_boolean ratelimit
config_add_string uci_section
+
+ config_add_boolean dynamic_probe_resp
}
hostapd_set_vlan_file() {
@@ -629,7 +631,7 @@ hostapd_set_bss_options() {
airtime_bss_weight airtime_bss_limit airtime_sta_weight \
multicast_to_unicast_all proxy_arp per_sta_vif \
eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \
- vendor_elements fils uci_section
+ vendor_elements fils uci_section dynamic_probe_resp
set_default fils 0
set_default isolate 0
@@ -652,6 +654,7 @@ hostapd_set_bss_options() {
set_default airtime_bss_weight 0
set_default airtime_bss_limit 0
set_default eap_server 0
+ set_default dynamic_probe_resp 0
/usr/sbin/hostapd -vfils || fils=0
@@ -677,6 +680,7 @@ hostapd_set_bss_options() {
append bss_conf "preamble=$short_preamble" "$N"
append bss_conf "wmm_enabled=$wmm" "$N"
append bss_conf "ignore_broadcast_ssid=$hidden" "$N"
+ append bss_conf "dynamic_probe_resp=$dynamic_probe_resp" "$N"
append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N"
append bss_conf "utf8_ssid=$utf8_ssid" "$N"
append bss_conf "multi_ap=$multi_ap" "$N"
diff --git a/package/network/services/hostapd/patches/999-probe-request.patch b/package/network/services/hostapd/patches/999-probe-request.patch
new file mode 100644
index 0000000000..3b79338c2f
--- /dev/null
+++ b/package/network/services/hostapd/patches/999-probe-request.patch
@@ -0,0 +1,49 @@
+Index: hostapd-2021-02-20-59e9794c/hostapd/config_file.c
+===================================================================
+--- hostapd-2021-02-20-59e9794c.orig/hostapd/config_file.c
++++ hostapd-2021-02-20-59e9794c/hostapd/config_file.c
+@@ -3339,6 +3339,8 @@ static int hostapd_config_fill(struct ho
+ 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, "dynamic_probe_resp") == 0) {
++ bss->dynamic_probe_resp = atoi(pos);
+ #ifdef CONFIG_WEP
+ } else if (os_strcmp(buf, "wep_default_key") == 0) {
+ bss->ssid.wep.idx = atoi(pos);
+Index: hostapd-2021-02-20-59e9794c/src/ap/ap_config.h
+===================================================================
+--- hostapd-2021-02-20-59e9794c.orig/src/ap/ap_config.h
++++ hostapd-2021-02-20-59e9794c/src/ap/ap_config.h
+@@ -460,6 +460,7 @@ struct hostapd_bss_config {
+ int ap_max_inactivity;
+ int ignore_broadcast_ssid;
+ int no_probe_resp_if_max_sta;
++ int dynamic_probe_resp;
+
+ int wmm_enabled;
+ int wmm_uapsd;
+Index: hostapd-2021-02-20-59e9794c/src/ap/beacon.c
+===================================================================
+--- hostapd-2021-02-20-59e9794c.orig/src/ap/beacon.c
++++ hostapd-2021-02-20-59e9794c/src/ap/beacon.c
+@@ -920,7 +920,8 @@ void handle_probe_req(struct hostapd_dat
+ }
+ #endif /* CONFIG_P2P */
+
+- if (hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0 &&
++ if (!hapd->conf->dynamic_probe_resp &&
++ hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0 &&
+ elems.ssid_list_len == 0 && elems.short_ssid_list_len == 0) {
+ wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " for "
+ "broadcast SSID ignored", MAC2STR(mgmt->sa));
+@@ -967,7 +968,8 @@ void handle_probe_req(struct hostapd_dat
+ return;
+ }
+
+- if (hapd->conf->ignore_broadcast_ssid && res == WILDCARD_SSID_MATCH) {
++ if (!hapd->conf->dynamic_probe_resp &&
++ hapd->conf->ignore_broadcast_ssid && res == WILDCARD_SSID_MATCH) {
+ wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " for "
+ "broadcast SSID ignored", MAC2STR(mgmt->sa));
+ return;
--
2.25.1