From: Benjamin Berg The Control Integrity Protocol (CIP) Capabilities need to be added to and parsed from the association request and response. Signed-off-by: Benjamin Berg --- include/linux/ieee80211.h | 13 +++++++++++++ net/mac80211/ieee80211_i.h | 3 +++ net/mac80211/parse.c | 4 ++++ net/mac80211/util.c | 19 +++++++++++++++++++ 4 files changed, 39 insertions(+) diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 26e674038865..16d78fd61c22 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -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, @@ -2900,4 +2901,16 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim, __ieee80211_check_tim(tim, tim_len, aid); } +/* The MIC padding subfield in the CIP capabilities */ +#define WLAN_CIP_CAPA_MIC_PADDING 0x0F + +/** + * 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 */ diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index a1ef88fe846d..c6e6cb9d90a1 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1870,6 +1870,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; @@ -2775,6 +2776,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, diff --git a/net/mac80211/parse.c b/net/mac80211/parse.c index cb2be167cde7..3b66ca7d7a5c 100644 --- a/net/mac80211/parse.c +++ b/net/mac80211/parse.c @@ -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; diff --git a/net/mac80211/util.c b/net/mac80211/util.c index a96078a6bfa2..8303f624b7f6 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -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[] = { -- 2.55.0