wifi: mac80211: add helpers to parse/generate CIP Capabilities

The Control Integrity Protocol (CIP) Capabilities need to be
added to and parsed from the association request and response.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Link: https://patch.msgid.link/20260921144048.a3249c0b78ad.Ia3ea929dd6381cf8b04e3dd0c38e709e335113c2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Benjamin Berg 2026-09-21 14:40:54 +02:00 committed by Johannes Berg
parent 89665aeecd
commit fc14cfab63
4 changed files with 48 additions and 0 deletions

View File

@ -1828,6 +1828,7 @@ enum ieee80211_eid_ext {
WLAN_EID_EXT_BANDWIDTH_INDICATION = 135,
WLAN_EID_EXT_KNOWN_STA_IDENTIFCATION = 136,
WLAN_EID_EXT_NON_AP_STA_REG_CON = 137,
WLAN_EID_EXT_CIP_CAPA = 150,
WLAN_EID_EXT_UHR_OPER = 151,
WLAN_EID_EXT_UHR_CAPA = 152,
WLAN_EID_EXT_MACP = 153,
@ -2899,4 +2900,25 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
__ieee80211_check_tim(tim, tim_len, aid);
}
/**
* enum ieee80211_cip_cap_fields - CIP Capabilities element fields
* @IEEE80211_CIP_CAP_MIC_PADDING: The MIC padding subfield in the CIP
* capabilities
* @IEEE80211_CIP_CAP_PROTECTED_CTRL_FRAME_ONLY: The MIC Padding For Protected
* Control Frames Only bit in CIP capabilities
*/
enum ieee80211_cip_cap_fields {
IEEE80211_CIP_CAP_MIC_PADDING = 0x0F,
IEEE80211_CIP_CAP_PROTECTED_CTRL_FRAME_ONLY = 0x10,
};
/**
* struct ieee80211_cip_cap - CIP Capabilities element
*
* @v: The value of the Control Integrity Protocol Capability element
*/
struct ieee80211_cip_cap {
u8 v;
} __packed;
#endif /* LINUX_IEEE80211_H */

View File

@ -1878,6 +1878,7 @@ struct ieee802_11_elems {
const struct ieee80211_ttlm_elem *ttlm[IEEE80211_TTLM_MAX_CNT];
const struct ieee80211_uhr_cap *uhr_cap;
const struct ieee80211_uhr_operation *uhr_operation;
const struct ieee80211_cip_cap *cip_cap;
/* not the order in the psd values is per element, not per chandef */
struct ieee80211_parsed_tpe tpe;
@ -2778,6 +2779,8 @@ int ieee80211_put_uhr_cap(struct sk_buff *skb,
const struct ieee80211_supported_band *sband);
void ieee80211_put_reg_conn(struct ieee80211_sub_if_data *sdata,
struct sk_buff *skb);
int ieee80211_put_cip_cap(struct sk_buff *skb,
struct ieee80211_sub_if_data *sdata);
/* channel management */
bool ieee80211_chandef_ht_oper(const struct ieee80211_ht_operation *ht_oper,

View File

@ -205,6 +205,10 @@ ieee80211_parse_extension_element(u32 *crc,
elems->ttlm_num++;
}
break;
case WLAN_EID_EXT_CIP_CAPA:
if (len >= sizeof(*elems->cip_cap))
elems->cip_cap = data;
break;
case WLAN_EID_EXT_UHR_OPER:
if (params->mode < IEEE80211_CONN_MODE_UHR)
break;

View File

@ -4680,6 +4680,25 @@ int ieee80211_put_uhr_cap(struct sk_buff *skb,
return 0;
}
int ieee80211_put_cip_cap(struct sk_buff *skb,
struct ieee80211_sub_if_data *sdata)
{
const struct wiphy_iftype_ext_capab *ift_ext_capa =
cfg80211_get_iftype_ext_capa(sdata->local->hw.wiphy,
ieee80211_vif_type_p2p(&sdata->vif));
u8 cip_capabilities = ift_ext_capa ? ift_ext_capa->cip_capabilities : 0;
if (skb_tailroom(skb) < 4)
return -ENOBUFS;
skb_put_u8(skb, WLAN_EID_EXTENSION);
skb_put_u8(skb, 2);
skb_put_u8(skb, WLAN_EID_EXT_CIP_CAPA);
skb_put_u8(skb, cip_capabilities);
return 0;
}
const char *ieee80211_conn_mode_str(enum ieee80211_conn_mode mode)
{
static const char * const modes[] = {