nl80211: allow client-only BIGTK support

The current NL80211_EXT_FEATURE_BEACON_PROTECTION feature flag
requires both AP and client support, add a new one called
NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT that enables only
support in client (and P2P-client) modes.

Link: https://lore.kernel.org/r/20200420140559.6ba704053a5a.Ifeb869fb0b48e52fe0cb9c15572b93ac8a924f8d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2020-04-20 14:06:00 +02:00
parent 9dba48a6ec
commit 155d7c7338
2 changed files with 18 additions and 4 deletions

View file

@ -5690,6 +5690,8 @@ enum nl80211_feature_flags {
*
* @NL80211_EXT_FEATURE_BEACON_PROTECTION: The driver supports Beacon protection
* and can receive key configuration for BIGTK using key indexes 6 and 7.
* @NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT: The driver supports Beacon
* protection as a client only and cannot transmit protected beacons.
*
* @NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH: The driver can disable the
* forwarding of preauth frames over the control port. They are then
@ -5755,6 +5757,7 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_PROTECTED_TWT,
NL80211_EXT_FEATURE_DEL_IBSS_STA,
NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS,
NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT,
/* add new features before the definition below */
NUM_NL80211_EXT_FEATURES,

View file

@ -3905,14 +3905,25 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
};
void *hdr;
struct sk_buff *msg;
bool bigtk_support = false;
if (wiphy_ext_feature_isset(&rdev->wiphy,
NL80211_EXT_FEATURE_BEACON_PROTECTION))
bigtk_support = true;
if ((dev->ieee80211_ptr->iftype == NL80211_IFTYPE_STATION ||
dev->ieee80211_ptr->iftype == NL80211_IFTYPE_P2P_CLIENT) &&
wiphy_ext_feature_isset(&rdev->wiphy,
NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT))
bigtk_support = true;
if (info->attrs[NL80211_ATTR_KEY_IDX]) {
key_idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]);
if (key_idx > 5 &&
!wiphy_ext_feature_isset(
&rdev->wiphy,
NL80211_EXT_FEATURE_BEACON_PROTECTION))
if (key_idx >= 6 && key_idx <= 7 && !bigtk_support) {
GENL_SET_ERR_MSG(info, "BIGTK not supported");
return -EINVAL;
}
}
if (info->attrs[NL80211_ATTR_MAC])