[PATCH 3/6] hostapd: Handle no_sta flag in association

Ramasamy Kaliappan ramasamy.kaliappan at oss.qualcomm.com
Thu Aug 6 09:31:44 PDT 2026


When handling association frames, no_sta flag is used to determine
whether MLD address translation occurred, and the association
response is sent to the corresponding MLD address. Otherwise,
the response is sent to the source address of the received
frame.

Signed-off-by: Ramasamy Kaliappan <ramasamy.kaliappan at oss.qualcomm.com>
---
 src/ap/ieee802_11.c | 37 ++++++++++++++++++++++++++++---------
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 3d46a37ca27c..45e1386d7a11 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -6733,8 +6733,13 @@ static u16 send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
 	struct ieee80211_mgmt *reply;
 	u8 *p;
 	u16 res = WLAN_STATUS_SUCCESS;
+	bool drv_no_sta = false;
 
 	buflen = sizeof(struct ieee80211_mgmt) + 1024;
+
+	if (sta && sta->no_sta)
+		drv_no_sta = sta->no_sta;
+
 #ifdef CONFIG_FILS
 	if (sta && sta->fils_hlp_resp)
 		buflen += wpabuf_len(sta->fils_hlp_resp);
@@ -7155,13 +7160,18 @@ rsnxe_done:
 	}
 #endif /* CONFIG_FILS */
 
-	if (hostapd_drv_send_mlme(hapd, reply, send_len, 0, NULL, 0, 0) < 0) {
+	if (hostapd_drv_send_mgmt_resp(hapd, reply, send_len, 0, NULL, 0, 0,
+				       drv_no_sta) < 0) {
 		wpa_printf(MSG_INFO, "Failed to send assoc resp: %s",
 			   strerror(errno));
 		res = WLAN_STATUS_UNSPECIFIED_FAILURE;
 	}
 
 done:
+	if (sta && sta->no_sta)
+		/* Reset no_sta flag after sending the response */
+		sta->no_sta = false;
+
 	os_free(buf);
 	return res;
 }
@@ -7321,7 +7331,7 @@ static struct sta_info * handle_mlo_translate(struct hostapd_data *hapd,
 
 static void handle_assoc(struct hostapd_data *hapd,
 			 const struct ieee80211_mgmt *mgmt, size_t len,
-			 int reassoc, int rssi)
+			 int reassoc, int rssi, bool drv_no_sta)
 {
 	u16 capab_info, listen_interval, seq_ctrl, fc;
 	int resp = WLAN_STATUS_SUCCESS;
@@ -7336,6 +7346,8 @@ static void handle_assoc(struct hostapd_data *hapd,
 	int omit_rsnxe = 0;
 	bool set_beacon = false;
 	bool mld_addrs_not_translated = false;
+	bool no_sta = drv_no_sta;
+	const u8 *dst = mgmt->sa;
 
 	if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) :
 				      sizeof(mgmt->u.assoc_req))) {
@@ -7373,10 +7385,11 @@ static void handle_assoc(struct hostapd_data *hapd,
 			mgmt->u.reassoc_req.listen_interval);
 		wpa_printf(MSG_DEBUG, "reassociation request: STA=" MACSTR
 			   " capab_info=0x%02x listen_interval=%d current_ap="
-			   MACSTR " seq_ctrl=0x%x%s",
+			   MACSTR " seq_ctrl=0x%x%s no_sta=%d",
 			   MAC2STR(mgmt->sa), capab_info, listen_interval,
 			   MAC2STR(mgmt->u.reassoc_req.current_ap),
-			   seq_ctrl, (fc & WLAN_FC_RETRY) ? " retry" : "");
+			   seq_ctrl, (fc & WLAN_FC_RETRY) ? " retry" : "",
+			   no_sta);
 		left = len - (IEEE80211_HDRLEN + sizeof(mgmt->u.reassoc_req));
 		pos = mgmt->u.reassoc_req.variable;
 	} else {
@@ -7385,9 +7398,10 @@ static void handle_assoc(struct hostapd_data *hapd,
 			mgmt->u.assoc_req.listen_interval);
 		wpa_printf(MSG_DEBUG, "association request: STA=" MACSTR
 			   " capab_info=0x%02x listen_interval=%d "
-			   "seq_ctrl=0x%x%s",
+			   " seq_ctrl=0x%x%s no_sta=%d",
 			   MAC2STR(mgmt->sa), capab_info, listen_interval,
-			   seq_ctrl, (fc & WLAN_FC_RETRY) ? " retry" : "");
+			   seq_ctrl, (fc & WLAN_FC_RETRY) ? " retry" : "",
+			   no_sta);
 		left = len - (IEEE80211_HDRLEN + sizeof(mgmt->u.assoc_req));
 		pos = mgmt->u.assoc_req.variable;
 	}
@@ -7501,6 +7515,9 @@ static void handle_assoc(struct hostapd_data *hapd,
 		}
 	}
 
+	if (!no_sta)
+		dst = sta->addr;
+
 	if ((fc & WLAN_FC_RETRY) &&
 	    sta->last_seq_ctrl != WLAN_INVALID_MGMT_SEQ &&
 	    sta->last_seq_ctrl == seq_ctrl &&
@@ -7768,11 +7785,13 @@ static void handle_assoc(struct hostapd_data *hapd,
 	}
 #endif /* CONFIG_TESTING_OPTIONS */
 
+	sta->no_sta = no_sta;
+
 	if (resp >= 0)
 		reply_res = send_assoc_resp(hapd,
 					    mld_addrs_not_translated ?
 					    NULL : sta,
-					    mgmt->sa, resp, reassoc,
+					    dst, resp, reassoc,
 					    pos, left, rssi, omit_rsnxe);
 
 	if (set_beacon)
@@ -8429,12 +8448,12 @@ int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
 		break;
 	case WLAN_FC_STYPE_ASSOC_REQ:
 		wpa_printf(MSG_DEBUG, "mgmt::assoc_req");
-		handle_assoc(hapd, mgmt, len, 0, ssi_signal);
+		handle_assoc(hapd, mgmt, len, 0, ssi_signal, no_sta);
 		ret = 1;
 		break;
 	case WLAN_FC_STYPE_REASSOC_REQ:
 		wpa_printf(MSG_DEBUG, "mgmt::reassoc_req");
-		handle_assoc(hapd, mgmt, len, 1, ssi_signal);
+		handle_assoc(hapd, mgmt, len, 1, ssi_signal, no_sta);
 		ret = 1;
 		break;
 	case WLAN_FC_STYPE_DISASSOC:
-- 
2.34.1




More information about the Hostap mailing list