wlan-ap-Telecominfraproject/feeds/qca/hostapd/patches/q18-hostapd-Add-bcast-deauth-before-deinit.patch
John Crispin 008ca9618d
Some checks failed
Build OpenWrt/uCentral images / build (cig_wf186h) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf186w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf188n) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf189) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf196) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-a1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-b1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap102) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap104) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap105) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap111) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap112) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_3) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xe) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (indio_um-305ax) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sercomm_ap72tip) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630c-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-211g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-id2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-od2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr5018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018-v4) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax820) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax840) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap640) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap650) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap655) (push) Has been cancelled
Build OpenWrt/uCentral images / trigger-testing (push) Has been cancelled
Build OpenWrt/uCentral images / create-x64_vm-ami (push) Has been cancelled
ipq95xx: import ath12.4-cs kernel and drivers
Signed-off-by: John Crispin <john@phrozen.org>
2024-10-20 09:25:13 +02:00

83 lines
2.8 KiB
Diff
Executable File

From 5090eb33e0623cc8c1659d0df76ae558eba1b25f Mon Sep 17 00:00:00 2001
From: Ramanathan Choodamani <quic_rchoodam@quicinc.com>
Date: Thu, 20 Jul 2023 21:10:51 -0700
Subject: [PATCH] hostapd: Add bcast deauth before deinit
The AP has to ideally send deauth frames to notify
the associated STA about disconnection. If the AP
fails to send deauth and goes down, STA still thinks
it is associated with STA, until it sees a beacon miss.
Adding this change makes the process little more efficient
as we cannot rely only on STA to notice the missed beacon
Signed-off-by: Ramanathan Choodamani <quic_rchoodam@quicinc.com>
---
hostapd/main.c | 2 ++
src/ap/hostapd.c | 26 ++++++++++++++++++++++++++
src/ap/hostapd.h | 1 +
3 files changed, 29 insertions(+)
diff --git a/hostapd/main.c b/hostapd/main.c
index bfd3039..b2cbf52 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -913,6 +913,8 @@ int main(int argc, char *argv[])
out:
hostapd_ubus_free(&interfaces);
hostapd_global_ctrl_iface_deinit(&interfaces);
+ /* Sending deauth to all stations before deinit */
+ hostapd_deauthenticate_stations(&interfaces);
/* Deinitialize all interfaces */
for (i = 0; i < interfaces.count; i++) {
if (!interfaces.iface[i])
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 2e0c89a..6770ea5 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -2901,6 +2901,32 @@ void hostapd_interface_deinit_free(struct hostapd_iface *iface)
hostapd_interface_free(iface);
}
+void hostapd_deauthenticate_stations(struct hapd_interfaces *interfaces)
+{
+ int i, j;
+ struct hostapd_iface *iface;
+ struct hostapd_data *hapd;
+ u8 addr[ETH_ALEN];
+ int reason = WLAN_REASON_DEAUTH_LEAVING;
+
+ for (i = 0; i < interfaces->count; i++) {
+ if (!interfaces->iface[i])
+ continue;
+
+ iface = interfaces->iface[i];
+ os_memset(addr, 0xff, ETH_ALEN);
+ for (j = 0; j < iface->num_bss; j++) {
+ hapd = iface->bss[j];
+ if (!hapd)
+ continue;
+ wpa_dbg(hapd->msg_ctx, MSG_DEBUG,
+ "Sending deauth frame sa=" MACSTR "da=" MACSTR "reason=%d",
+ MAC2STR(hapd->own_addr), MAC2STR(addr), reason);
+ hostapd_drv_sta_deauth(hapd, addr, reason);
+ }
+
+ }
+}
static void hostapd_deinit_driver(const struct wpa_driver_ops *driver,
void *drv_priv,
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index 1edb5de..0669f00 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -705,6 +705,7 @@ hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
int reassoc);
void hostapd_interface_deinit_free(struct hostapd_iface *iface);
+void hostapd_deauthenticate_stations(struct hapd_interfaces *interfaces);
int hostapd_enable_iface(struct hostapd_iface *hapd_iface);
int hostapd_reload_iface(struct hostapd_iface *hapd_iface);
int hostapd_reload_bss_only(struct hostapd_data *bss);