[PATCH 15/21] AP: Add CIP handling in association flow

Benjamin Berg benjamin at sipsolutions.net
Tue Oct 27 06:17:01 PDT 2026


From: Benjamin Berg <benjamin.berg at intel.com>

For now, this cannot be used because CIP is never actually enabled.

Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 src/ap/ap_drv_ops.c    |  5 ++++-
 src/ap/ap_drv_ops.h    |  2 +-
 src/ap/drv_callbacks.c |  5 +++++
 src/ap/ieee802_11.c    | 23 ++++++++++++++++++++++-
 src/ap/sta_info.c      |  7 ++++---
 src/ap/sta_info.h      |  2 ++
 6 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index d4ec42d688..5824b5aab7 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -44,6 +44,8 @@ u32 hostapd_sta_flags_to_drv(u64 flags)
 		res |= WPA_STA_ASSOCIATED;
 	if (flags & WLAN_STA_SPP_AMSDU)
 		res |= WPA_STA_SPP_AMSDU;
+	if (flags & WLAN_STA_CIP)
+		res |= WPA_STA_CIP;
 	return res;
 }
 
@@ -508,7 +510,7 @@ int hostapd_sta_add(struct hostapd_data *hapd,
 		    const struct ieee80211_he_6ghz_band_cap *he_6ghz_capab,
 		    u64 flags, u8 qosinfo, u8 vht_opmode, int supp_p2p_ps,
 		    int set, const u8 *link_addr, bool mld_link_sta,
-		    u16 eml_cap, bool epp_sta)
+		    u16 eml_cap, bool epp_sta, u8 cip_capab)
 {
 	struct hostapd_sta_add_params params;
 
@@ -532,6 +534,7 @@ int hostapd_sta_add(struct hostapd_data *hapd,
 	params.eht_capab_len = eht_capab_len;
 	params.uhr_capab = uhr_capab;
 	params.uhr_capab_len = uhr_capab_len;
+	params.cip_capab = cip_capab;
 	params.he_6ghz_capab = he_6ghz_capab;
 	params.vht_opmode_enabled = !!(flags & WLAN_STA_VHT_OPMODE_ENABLED);
 	params.vht_opmode = vht_opmode;
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
index 580b7d8286..d2e69ef26b 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -52,7 +52,7 @@ int hostapd_sta_add(struct hostapd_data *hapd,
 		    const struct ieee80211_he_6ghz_band_cap *he_6ghz_capab,
 		    u64 flags, u8 qosinfo, u8 vht_opmode, int supp_p2p_ps,
 		    int set, const u8 *link_addr, bool mld_link_sta,
-		    u16 eml_cap, bool epp_sta);
+		    u16 eml_cap, bool epp_sta, u8 cip_capab);
 int hostapd_set_privacy(struct hostapd_data *hapd, int enabled);
 int hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
 			     size_t elem_len);
diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
index 4cd0c10f45..f88e0e9237 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -721,6 +721,11 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
 		else
 			sta->flags &= ~WLAN_STA_MFP;
 
+		if (wpa_auth_uses_cip(sta->wpa_sm))
+			sta->flags |= WLAN_STA_CIP;
+		else
+			sta->flags &= ~WLAN_STA_CIP;
+
 		if (wpa_auth_uses_spp_amsdu(sta->wpa_sm))
 			sta->flags |= WLAN_STA_SPP_AMSDU;
 		else
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index b289407524..45205acce1 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -7280,6 +7280,20 @@ static int __check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
 skip_pmkid_update:
 #endif /* CONFIG_PMKSA_PRIVACY */
 
+		sta->flags &= ~WLAN_STA_CIP;
+		if (wpa_auth_uses_cip(sta->wpa_sm)) {
+			if (elems->cip_capabilities &&
+			    elems->cip_capabilities_len >= 1) {
+				sta->flags |= WLAN_STA_CIP;
+				sta->cip_capabilities =
+					elems->cip_capabilities[0];
+			} else {
+				wpa_printf(MSG_DEBUG,
+					   "CIP: " MACSTR " Enabled CIP in RSNE but did not include CIP Capabilities",
+					   MAC2STR(sta->addr));
+			}
+		}
+
 #ifdef CONFIG_IEEE80211R_AP
 		if (sta->auth_alg == WLAN_AUTH_FT) {
 			if (type != LINK_PARSE_REASSOC) {
@@ -8119,7 +8133,7 @@ static int add_associated_sta(struct hostapd_data *hapd,
 			    sta->flags | WLAN_STA_ASSOC, sta->qosinfo,
 			    sta->vht_opmode, sta->p2p_ie ? 1 : 0,
 			    set, mld_link_addr, mld_link_sta, eml_cap,
-			    epp_sta)) {
+			    epp_sta, sta->cip_capabilities)) {
 		hostapd_logger(hapd, sta->addr,
 			       HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_NOTICE,
 			       "Could not %s STA to kernel driver",
@@ -8180,6 +8194,10 @@ static u16 send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
 		}
 	}
 #endif /* CONFIG_IEEE80211BE */
+
+	if (sta->flags & WLAN_STA_CIP)
+		buflen += hostapd_eid_cip_capab_len(hapd);
+
 #ifdef CONFIG_IEEE80211BN
 	if (hostapd_is_uhr_enabled(hapd)) {
 		buflen += hostapd_eid_uhr_capab_len(hapd, IEEE80211_MODE_AP);
@@ -8358,6 +8376,9 @@ rsnxe_done:
 	}
 #endif /* CONFIG_IEEE80211BE */
 
+	if (sta->flags & WLAN_STA_CIP)
+		p = hostapd_eid_cip_capab(hapd, p);
+
 #ifdef CONFIG_IEEE80211BN
 	if (hostapd_is_uhr_enabled(hapd)) {
 		p = hostapd_eid_uhr_capab(hapd, p, IEEE80211_MODE_AP);
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index 1e8ef1b4f8..1fdf279575 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -2014,7 +2014,7 @@ int ap_sta_flags_txt(unsigned long long flags, char *buf, size_t buflen)
 
 	buf[0] = '\0';
 	res = os_snprintf(buf, buflen,
-			  "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+			  "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
 			  (flags & WLAN_STA_AUTH ? "[AUTH]" : ""),
 			  (flags & WLAN_STA_ASSOC ? "[ASSOC]" : ""),
 			  (flags & WLAN_STA_AUTHORIZED ? "[AUTHORIZED]" : ""),
@@ -2039,7 +2039,8 @@ int ap_sta_flags_txt(unsigned long long flags, char *buf, size_t buflen)
 			  (flags & WLAN_STA_VENDOR_VHT ? "[VENDOR_VHT]" : ""),
 			  (flags & WLAN_STA_SPP_AMSDU ? "[SPP-A-MSDU]" : ""),
 			  (flags & WLAN_STA_WNM_SLEEP_MODE ?
-			   "[WNM_SLEEP_MODE]" : ""));
+			   "[WNM_SLEEP_MODE]" : ""),
+			  (flags & WLAN_STA_CIP ? "[CIP]" : ""));
 	if (os_snprintf_error(buflen, res))
 		res = -1;
 
@@ -2161,7 +2162,7 @@ int ap_sta_re_add(struct hostapd_data *hapd, struct sta_info *sta)
 			    sta->supported_rates_len,
 			    0, NULL, NULL, NULL, 0, NULL, 0, NULL, 0, NULL,
 			    sta->flags, 0, 0, 0, 0,
-			    mld_link_addr, mld_link_sta, eml_cap, epp_sta)) {
+			    mld_link_addr, mld_link_sta, eml_cap, epp_sta, 0)) {
 		hostapd_logger(hapd, sta->addr,
 			       HOSTAPD_MODULE_IEEE80211,
 			       HOSTAPD_LEVEL_NOTICE,
diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h
index c05c8a77e7..a1f6c166e9 100644
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -50,6 +50,7 @@
 #define WLAN_STA_PENDING_DEAUTH_CB BIT_ULL(30)
 #define WLAN_STA_NONERP BIT_ULL(31)
 #define WLAN_STA_UHR BIT_ULL(32)
+#define WLAN_STA_CIP BIT_ULL(33)
 
 /* Maximum number of supported rates (from both Supported Rates and Extended
  * Supported Rates IEs). */
@@ -237,6 +238,7 @@ struct sta_info {
 	size_t eht_capab_len;
 	struct ieee80211_uhr_capabilities *uhr_capab;
 	size_t uhr_capab_len;
+	u8 cip_capabilities;
 
 	int sa_query_count; /* number of pending SA Query requests;
 			     * 0 = no SA Query in progress */
-- 
2.56.0




More information about the Hostap mailing list