From a441ba6f073caa8e3357e9c81f86c32745c2676b Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Wed, 17 May 2023 10:47:07 +0800
Subject: [PATCH 52/54] hostapd: mtk: only use first bss to check sta activity

Only let the first bss (i.e., the AP MLD interface) to register
ap_handle_timer during authentication, otherwise alive check for MLD STA
will fail after AP_MAX_INACTIVITY time and thus being disconnected.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
 src/ap/sta_info.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index 93070b709..78d66c49a 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -767,7 +767,8 @@ struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr)
 	}
 	sta->supported_rates_len = i;
 
-	if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_INACTIVITY_TIMER)) {
+	if ((hapd->mld_first_bss == hapd) &&
+	    (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_INACTIVITY_TIMER))) {
 		wpa_printf(MSG_DEBUG, "%s: register ap_handle_timer timeout "
 			   "for " MACSTR " (%d seconds - ap_max_inactivity)",
 			   __func__, MAC2STR(addr),
-- 
2.39.2

