wlan-ap-Telecominfraproject/feeds/qca/hostapd/patches/r02-021-hostapd-Handle-interface-up-down-for-MLD.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

146 lines
4.3 KiB
Diff

From 2cbcc3a710c538966a1572463bf73189d14c36cf Mon Sep 17 00:00:00 2001
From: Sriram R <quic_srirrama@quicinc.com>
Date: Tue, 21 Nov 2023 11:01:27 +0530
Subject: [PATCH 2/2] hostapd: Handle interface up/down for MLD
When the interface is brought down, the kernel stops all
the link bss and removes the link. This change adds
support for hostapd to free all sta and make change
to all hapd state. Similarly, on reenabling the interface
we need to add all links and reenable the beacon back.
Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
Co-developed-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
src/ap/drv_callbacks.c | 107 ++++++++++++++++++++++++++++++++---------
1 file changed, 84 insertions(+), 23 deletions(-)
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -2091,6 +2091,84 @@ static void hostapd_eapol_tx_status(stru
ieee802_1x_eapol_tx_status(hapd, sta, data, len, ack);
}
+static void hostpad_if_disable(struct hostapd_data *hapd)
+{
+ hostapd_free_stas(hapd);
+ wpa_msg(hapd->msg_ctx, MSG_INFO, INTERFACE_DISABLED);
+ hapd->disabled = 1;
+}
+
+
+static void hostpad_if_enable(struct hostapd_data *hapd)
+{
+ wpa_msg(hapd->msg_ctx, MSG_INFO, INTERFACE_ENABLED);
+ if (hapd->disabled && hapd->started) {
+ hapd->disabled = 0;
+ /*
+ * Try to re-enable interface if the driver stopped it
+ * when the interface got disabled.
+ */
+ hostapd_reconfig_wpa(hapd);
+ if (hapd->wpa_auth)
+ wpa_auth_reconfig_group_keys(hapd->wpa_auth);
+ else
+ hostapd_reconfig_encryption(hapd);
+ hapd->reenable_beacon = 1;
+ ieee802_11_set_beacon(hapd);
+#ifdef NEED_AP_MLME
+ } else if (hapd->disabled && hapd->iface->cac_started) {
+ wpa_printf(MSG_DEBUG, "DFS: restarting pending CAC");
+ hostapd_handle_dfs(hapd->iface);
+#endif /* NEED_AP_MLME */
+ }
+}
+
+
+static void hostapd_mld_if_disable(struct hostapd_data *hapd)
+{
+ struct hostapd_data *link_bss;
+
+ for_each_partner_bss(link_bss, hapd)
+ hostpad_if_disable(link_bss);
+}
+
+
+static void hostapd_mld_if_enable(struct hostapd_data *hapd)
+{
+ struct hostapd_data *first_link, *link_bss;
+
+ first_link = hostapd_mld_is_first_bss(hapd) ? hapd :
+ hostapd_mld_get_first_bss(hapd);
+
+ /* Links are removed at this stage. Re-add all links and enable them.
+ * But enable first link BSS first.
+ */
+ if (hostapd_drv_link_add(first_link, first_link->mld_link_id,
+ first_link->own_addr)) {
+ wpa_printf(MSG_ERROR, "MLD: Failed to re-add link %d in MLD %s",
+ first_link->mld_link_id, first_link->conf->iface);
+ return;
+ }
+
+ hostpad_if_enable(first_link);
+
+ /* add partners */
+ for_each_partner_bss(link_bss, first_link) {
+ if (link_bss == first_link)
+ continue;
+
+ if (hostapd_drv_link_add(link_bss, link_bss->mld_link_id,
+ link_bss->own_addr)) {
+ wpa_printf(MSG_ERROR, "MLD: Failed to re-add link %d in MLD %s",
+ link_bss->mld_link_id, link_bss->conf->iface);
+ continue;
+ }
+
+ hostpad_if_enable(link_bss);
+ }
+}
+
+
void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
union wpa_event_data *data)
{
@@ -2301,31 +2379,16 @@ void hostapd_wpa_event(void *ctx, enum w
break;
#endif /* NEED_AP_MLME */
case EVENT_INTERFACE_ENABLED:
- wpa_msg(hapd->msg_ctx, MSG_INFO, INTERFACE_ENABLED);
- if (hapd->disabled && hapd->started) {
- hapd->disabled = 0;
- /*
- * Try to re-enable interface if the driver stopped it
- * when the interface got disabled.
- */
- hostapd_reconfig_wpa(hapd);
- if (hapd->wpa_auth)
- wpa_auth_reconfig_group_keys(hapd->wpa_auth);
- else
- hostapd_reconfig_encryption(hapd);
- hapd->reenable_beacon = 1;
- ieee802_11_set_beacon(hapd);
-#ifdef NEED_AP_MLME
- } else if (hapd->disabled && hapd->iface->cac_started) {
- wpa_printf(MSG_DEBUG, "DFS: restarting pending CAC");
- hostapd_handle_dfs(hapd->iface);
-#endif /* NEED_AP_MLME */
- }
+ if (hapd->conf->mld_ap)
+ hostapd_mld_if_enable(hapd);
+ else
+ hostpad_if_enable(hapd);
break;
case EVENT_INTERFACE_DISABLED:
- hostapd_free_stas(hapd);
- wpa_msg(hapd->msg_ctx, MSG_INFO, INTERFACE_DISABLED);
- hapd->disabled = 1;
+ if (hapd->conf->mld_ap)
+ hostapd_mld_if_disable(hapd);
+ else
+ hostpad_if_disable(hapd);
break;
#ifdef CONFIG_ACS
case EVENT_ACS_CHANNEL_SELECTED: