[PATCH] hostapd: add option to ignore data frames from unknown stations

Raphaël Mélotte raphael.melotte at mind.be
Thu Jan 26 02:04:23 PST 2023


Also refresh patches.

Upstream hostapd status:
https://patchwork.ozlabs.org/project/hostap/patch/20230126091539.2325752-1-raphael.melotte@mind.be/

Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
---
 ...-ignore-data-frames-from-unknown-sta.patch | 72 +++++++++++++++++++
 .../hostapd/patches/700-wifi-reload.patch     |  2 +-
 .../patches/720-iface_max_num_sta.patch       |  2 +-
 3 files changed, 74 insertions(+), 2 deletions(-)
 create mode 100644 package/network/services/hostapd/patches/630-add-ignore-data-frames-from-unknown-sta.patch

diff --git a/package/network/services/hostapd/patches/630-add-ignore-data-frames-from-unknown-sta.patch b/package/network/services/hostapd/patches/630-add-ignore-data-frames-from-unknown-sta.patch
new file mode 100644
index 0000000000..931c080a41
--- /dev/null
+++ b/package/network/services/hostapd/patches/630-add-ignore-data-frames-from-unknown-sta.patch
@@ -0,0 +1,72 @@
+From cb949726fc6194c608027f2556c00b262c6b8b34 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte at mind.be>
+Date: Tue, 24 Jan 2023 14:15:09 +0100
+Subject: [PATCH] hostapd: add option to ignore data frames from unknown
+ stations
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When an external process manages hostapd, it can be needed to
+temporarily ignore class 3 frames from unknown stations until hostapd
+can be made aware of the station.
+
+Add a new option that, when set, makes hostapd ignore class 3 frames
+from unknown stations. When the option is not set, the behavior stays
+the same as before (i.e. unknown stations are deauthenticated).
+
+Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
+---
+ hostapd/config_file.c | 2 ++
+ hostapd/hostapd.conf  | 5 +++++
+ src/ap/ap_config.h    | 2 ++
+ src/ap/ieee802_11.c   | 2 +-
+ 4 files changed, 10 insertions(+), 1 deletion(-)
+
+--- a/hostapd/config_file.c
++++ b/hostapd/config_file.c
+@@ -4459,6 +4459,8 @@ static int hostapd_config_fill(struct ho
+ 		bss->broadcast_deauth = atoi(pos);
+ 	} else if (os_strcmp(buf, "notify_mgmt_frames") == 0) {
+ 		bss->notify_mgmt_frames = atoi(pos);
++	} else if (os_strcmp(buf, "no_deauth_unknown_sta") == 0) {
++		bss->no_deauth_unknown_sta = atoi(pos);
+ #ifdef CONFIG_DPP
+ 	} else if (os_strcmp(buf, "dpp_name") == 0) {
+ 		os_free(bss->dpp_name);
+--- a/hostapd/hostapd.conf
++++ b/hostapd/hostapd.conf
+@@ -591,6 +591,11 @@ wmm_ac_vo_acm=0
+ # Default: 0 (disabled)
+ #notify_mgmt_frames=0
+ 
++# Do not deauthenticate unknown stations.
++# This can be used to temporarily ignore data frames from unknown
++# stations, instead of deauthenticating them.
++#no_deauth_unknown_sta=0
++
+ ##### IEEE 802.11n related configuration ######################################
+ 
+ # ieee80211n: Whether IEEE 802.11n (HT) is enabled
+--- a/src/ap/ap_config.h
++++ b/src/ap/ap_config.h
+@@ -750,6 +750,8 @@ struct hostapd_bss_config {
+ 
+ 	int broadcast_deauth;
+ 
++	int no_deauth_unknown_sta;
++
+ 	int notify_mgmt_frames;
+ 
+ #ifdef CONFIG_DPP
+--- a/src/ap/ieee802_11.c
++++ b/src/ap/ieee802_11.c
+@@ -6964,7 +6964,7 @@ void ieee802_11_rx_from_unknown(struct h
+ 		hostapd_drv_sta_disassoc(
+ 			hapd, src,
+ 			WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
+-	else
++	else if (!hapd->conf->no_deauth_unknown_sta)
+ 		hostapd_drv_sta_deauth(
+ 			hapd, src,
+ 			WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
diff --git a/package/network/services/hostapd/patches/700-wifi-reload.patch b/package/network/services/hostapd/patches/700-wifi-reload.patch
index 174127df6e..28916dca7e 100644
--- a/package/network/services/hostapd/patches/700-wifi-reload.patch
+++ b/package/network/services/hostapd/patches/700-wifi-reload.patch
@@ -47,7 +47,7 @@
  	enum hostapd_logger_level logger_syslog_level, logger_stdout_level;
  
  	unsigned int logger_syslog; /* module bitfield */
-@@ -969,6 +971,7 @@ struct eht_phy_capabilities_info {
+@@ -971,6 +973,7 @@ struct eht_phy_capabilities_info {
  struct hostapd_config {
  	struct hostapd_bss_config **bss, *last_bss;
  	size_t num_bss;
diff --git a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch
index ed76d22dd0..e5d91700af 100644
--- a/package/network/services/hostapd/patches/720-iface_max_num_sta.patch
+++ b/package/network/services/hostapd/patches/720-iface_max_num_sta.patch
@@ -71,7 +71,7 @@
  			   " since no room for additional STA",
 --- a/src/ap/ap_config.h
 +++ b/src/ap/ap_config.h
-@@ -1010,6 +1010,8 @@ struct hostapd_config {
+@@ -1012,6 +1012,8 @@ struct hostapd_config {
  	unsigned int track_sta_max_num;
  	unsigned int track_sta_max_age;
  
-- 
2.38.1




More information about the openwrt-devel mailing list