From: Sai Pratyusha Magam Introduce new netlink attributes for the userspace to indicate following to the driver in AP mode: A new netlink attribute NL80211_ATTR_EPP_PEER for NL80211_CMD_NEW_STA and NL80211_CMD_ADD_LINK_STA to indicate that it is an Enhanced Privacy Protection (EPP) peer. A new netlink attribute NL80211_ATTR_EPP_FLAGS for NL80211_CMD_SET_STATION to indicate the negotiated EPP capabilities of an EPP AP and an EPP non-AP STA The Extended RSN capabilities for EPP that an EPP AP and an EPP non-AP STA can negotiate are as per "IEEE P802.11bi/D3.0, 9.4.2.240" (RSNXE), few of which are driver dependent, hence need them to be communicated from userspace for later use. Co-developed-by: Rohan Dutta Signed-off-by: Rohan Dutta Signed-off-by: Sai Pratyusha Magam Signed-off-by: Kavita Kavita --- include/net/cfg80211.h | 5 +++++ include/net/mac80211.h | 5 +++++ include/uapi/linux/nl80211.h | 26 ++++++++++++++++++++++++++ net/mac80211/cfg.c | 6 ++++++ net/wireless/nl80211.c | 10 ++++++++++ 5 files changed, 52 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 899f267b7cf9..c0c1da2b258c 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1785,6 +1785,9 @@ struct cfg80211_ttlm_params { * present/updated * @eml_cap: EML capabilities of this station * @link_sta_params: link related params. + * @epp_peer: EPP peer indication + * @epp_flags: Negotiated EPP capabilities + * (bitmask of BIT(%NL80211_EPP_FLAG_...)) */ struct station_parameters { struct net_device *vlan; @@ -1811,6 +1814,8 @@ struct station_parameters { bool eml_cap_present; u16 eml_cap; struct link_station_parameters link_sta_params; + bool epp_peer; + u32 epp_flags; }; /** diff --git a/include/net/mac80211.h b/include/net/mac80211.h index c2e49542626c..7cc0625a7116 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -2520,6 +2520,9 @@ struct ieee80211_link_sta { * by the AP. * @valid_links: bitmap of valid links, or 0 for non-MLO * @spp_amsdu: indicates whether the STA uses SPP A-MSDU or not. + * @epp_peer: indicates that the peer is an EPP peer. + * @epp_flags: Negotiated EPP capabilities + * (bitmask of BIT(%NL80211_EPP_FLAG_...)) */ struct ieee80211_sta { u8 addr[ETH_ALEN] __aligned(2); @@ -2544,6 +2547,8 @@ struct ieee80211_sta { struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1]; u16 valid_links; + bool epp_peer; + u32 epp_flags; struct ieee80211_link_sta deflink; struct ieee80211_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS]; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 5c33486c6380..81ada0c3a7bf 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2973,6 +2973,13 @@ enum nl80211_commands { * primary channel is 2 MHz wide, and the control channel designates * the 1 MHz primary subchannel within that 2 MHz primary. * + * @NL80211_ATTR_EPP_PEER: A flag attribute to indicate if the peer is an EPP + * STA. Used with %NL80211_CMD_NEW_STA and %NL80211_CMD_ADD_LINK_STA + * + * @NL80211_ATTR_EPP_FLAGS: A (u32) bitmap attribute to indicate the negotiated + * EPP capabilities of an EPP AP and an EPP non-AP STA. See + * &enum nl80211_epp_flags for details. Used with %NL80211_CMD_SET_STATION + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use @@ -3541,6 +3548,10 @@ enum nl80211_attrs { NL80211_ATTR_S1G_PRIMARY_2MHZ, + NL80211_ATTR_EPP_PEER, + + NL80211_ATTR_EPP_FLAGS, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, @@ -3702,6 +3713,21 @@ enum nl80211_sta_flags { NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1 }; +/** + * enum nl80211_epp_flags - EPP Flags + * + * Negotiated EPP capabilities of an EPP STA + * + * @NL80211_EPP_FLAG_ASSOC_FRAME_ENCRYPTION: (Re)Association + * Request/Response frame encryption support + * @NL80211_EPP_FLAG_1X_UTILIZING_AUTHENTICATION_FRAMES: + * IEEE 802.1X (EAP) Authentication utilizing Authentication frames + */ +enum nl80211_epp_flags { + NL80211_EPP_FLAG_ASSOC_FRAME_ENCRYPTION = 0, + NL80211_EPP_FLAG_1X_UTILIZING_AUTHENTICATION_FRAMES, +}; + /** * enum nl80211_sta_p2p_ps_status - station support of P2P PS * diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index c81091a5cc3a..afc636a31f57 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -2199,6 +2199,12 @@ static int sta_apply_parameters(struct ieee80211_local *local, mask = params->sta_flags_mask; set = params->sta_flags_set; + if (params->epp_peer) + sta->sta.epp_peer = true; + + if (sta->sta.epp_peer) + sta->sta.epp_flags = params->epp_flags; + if (ieee80211_vif_is_mesh(&sdata->vif)) { /* * In mesh mode, ASSOCIATED isn't part of the nl80211 diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index c464c449cb0b..93c075c19807 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -932,6 +932,8 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { NLA_POLICY_NESTED(nl80211_s1g_short_beacon), [NL80211_ATTR_BSS_PARAM] = { .type = NLA_FLAG }, [NL80211_ATTR_S1G_PRIMARY_2MHZ] = { .type = NLA_FLAG }, + [NL80211_ATTR_EPP_PEER] = { .type = NLA_FLAG }, + [NL80211_ATTR_EPP_FLAGS] = { .type = NLA_U32 }, }; /* policy for the key attributes */ @@ -8416,6 +8418,10 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) nla_len(info->attrs[NL80211_ATTR_STA_EXT_CAPABILITY]); } + if (info->attrs[NL80211_ATTR_EPP_FLAGS]) + params.epp_flags = + nla_get_u32(info->attrs[NL80211_ATTR_EPP_FLAGS]); + if (parse_station_flags(info, dev->ieee80211_ptr->iftype, ¶ms)) return -EINVAL; @@ -8789,6 +8795,10 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) goto out; } } + + params.epp_peer = + nla_get_flag(info->attrs[NL80211_ATTR_EPP_PEER]); + err = rdev_add_station(rdev, dev, mac_addr, ¶ms); out: dev_put(params.vlan); -- 2.34.1