BACKPORT: cfg80211: Enhance the AKM advertizement to support per interface.
Commit ab4dfa20534e ("cfg80211: Allow drivers to advertise supported AKM suites") introduces the support to advertize supported AKMs to userspace. This needs an enhancement to advertize the AKM support per interface type, specifically for the cfg80211-based drivers that implement SME and use different mechanisms to support the AKM's for each interface type (e.g., the support for SAE, OWE AKM's take different paths for such drivers on STA/AP mode). This commit aims the same and enhances the earlier mechanism of advertizing the AKMs per wiphy. Add new nl80211 attributes and data structure to provide supported AKMs per interface type to userspace. the AKMs advertized in akm_suites are default capabilities if not advertized for a specific interface type in iftype_akm_suites. Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org> Link: https://lore.kernel.org/r/20200126203032.21934-1-vjakkam@codeaurora.org Signed-off-by: Johannes Berg <johannes.berg@intel.com> (cherry picked from commit d6039a3416f7af37c04f22c411f120ad46f51663) [connoro: drop changes to lines not present in android-4.19; add enum values to nl80211_commands to match uapi] Bug: 154523213 Signed-off-by: Connor O'Brien <connoro@google.com> Change-Id: I2aef7de9d477b71432c2547a1cba1728a2d22d14
This commit is contained in:
parent
a487e4d535
commit
a7321039a2
3 changed files with 109 additions and 0 deletions
|
@ -3951,6 +3951,21 @@ struct wiphy_iftype_ext_capab {
|
|||
u8 extended_capabilities_len;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
|
||||
* suites for interface types defined in @iftypes_mask. Each type in the
|
||||
* @iftypes_mask must be unique across all instances of iftype_akm_suites.
|
||||
*
|
||||
* @iftypes_mask: bitmask of interfaces types
|
||||
* @akm_suites: points to an array of supported akm suites
|
||||
* @n_akm_suites: number of supported AKM suites
|
||||
*/
|
||||
struct wiphy_iftype_akm_suites {
|
||||
u16 iftypes_mask;
|
||||
const u32 *akm_suites;
|
||||
int n_akm_suites;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct wiphy - wireless hardware description
|
||||
* @reg_notifier: the driver's regulatory notification callback,
|
||||
|
@ -3963,6 +3978,12 @@ struct wiphy_iftype_ext_capab {
|
|||
* @signal_type: signal type reported in &struct cfg80211_bss.
|
||||
* @cipher_suites: supported cipher suites
|
||||
* @n_cipher_suites: number of supported cipher suites
|
||||
* @iftype_akm_suites: array of supported akm suites info per interface type.
|
||||
* Note that the bits in @iftypes_mask inside this structure cannot
|
||||
* overlap (i.e. only one occurrence of each type is allowed across all
|
||||
* instances of iftype_akm_suites).
|
||||
* @num_iftype_akm_suites: number of interface types for which supported akm
|
||||
* suites are specified separately.
|
||||
* @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
|
||||
* @retry_long: Retry limit for long frames (dot11LongRetryLimit)
|
||||
* @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
|
||||
|
@ -4165,6 +4186,9 @@ struct wiphy {
|
|||
int n_cipher_suites;
|
||||
const u32 *cipher_suites;
|
||||
|
||||
const struct wiphy_iftype_akm_suites *iftype_akm_suites;
|
||||
unsigned int num_iftype_akm_suites;
|
||||
|
||||
u8 retry_short;
|
||||
u8 retry_long;
|
||||
u32 frag_threshold;
|
||||
|
|
|
@ -2339,6 +2339,18 @@ enum nl80211_commands {
|
|||
* the allowed channel bandwidth configurations. (u8 attribute)
|
||||
* Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13.
|
||||
*
|
||||
* @NL80211_ATTR_VLAN_ID: VLAN ID (1..4094) for the station and VLAN group key
|
||||
* (u16).
|
||||
*
|
||||
* @NL80211_ATTR_HE_BSS_COLOR: nested attribute for BSS Color Settings.
|
||||
*
|
||||
* @NL80211_ATTR_IFTYPE_AKM_SUITES: nested array attribute, with each entry
|
||||
* using attributes from &enum nl80211_iftype_akm_attributes. This
|
||||
* attribute is sent in a response to %NL80211_CMD_GET_WIPHY indicating
|
||||
* supported AKM suites capability per interface. AKMs advertised in
|
||||
* %NL80211_ATTR_AKM_SUITES are default capabilities if AKM suites not
|
||||
* advertised for a specific interface type.
|
||||
*
|
||||
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
|
||||
* @NL80211_ATTR_MAX: highest attribute number currently defined
|
||||
* @__NL80211_ATTR_AFTER_LAST: internal use
|
||||
|
@ -2801,6 +2813,12 @@ enum nl80211_attrs {
|
|||
NL80211_ATTR_WIPHY_EDMG_CHANNELS,
|
||||
NL80211_ATTR_WIPHY_EDMG_BW_CONFIG,
|
||||
|
||||
NL80211_ATTR_VLAN_ID,
|
||||
|
||||
NL80211_ATTR_HE_BSS_COLOR,
|
||||
|
||||
NL80211_ATTR_IFTYPE_AKM_SUITES,
|
||||
|
||||
/* add attributes here, update the policy in nl80211.c */
|
||||
|
||||
__NL80211_ATTR_AFTER_LAST,
|
||||
|
@ -5953,4 +5971,28 @@ enum nl80211_external_auth_action {
|
|||
NL80211_EXTERNAL_AUTH_ABORT,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum nl80211_iftype_akm_attributes - interface type AKM attributes
|
||||
* @__NL80211_IFTYPE_AKM_ATTR_INVALID: Invalid
|
||||
*
|
||||
* @NL80211_IFTYPE_AKM_ATTR_IFTYPES: nested attribute containing a flag
|
||||
* attribute for each interface type that supports AKM suites specified in
|
||||
* %NL80211_IFTYPE_AKM_ATTR_SUITES
|
||||
* @NL80211_IFTYPE_AKM_ATTR_SUITES: an array of u32. Used to indicate supported
|
||||
* AKM suites for the specified interface types.
|
||||
*
|
||||
* @__NL80211_IFTYPE_AKM_ATTR_LAST: Internal
|
||||
* @NL80211_IFTYPE_AKM_ATTR_MAX: highest interface type AKM attribute.
|
||||
*/
|
||||
enum nl80211_iftype_akm_attributes {
|
||||
__NL80211_IFTYPE_AKM_ATTR_INVALID,
|
||||
|
||||
NL80211_IFTYPE_AKM_ATTR_IFTYPES,
|
||||
NL80211_IFTYPE_AKM_ATTR_SUITES,
|
||||
|
||||
/* keep last */
|
||||
__NL80211_IFTYPE_AKM_ATTR_LAST,
|
||||
NL80211_IFTYPE_AKM_ATTR_MAX = __NL80211_IFTYPE_AKM_ATTR_LAST - 1,
|
||||
};
|
||||
|
||||
#endif /* __LINUX_NL80211_H */
|
||||
|
|
|
@ -1635,6 +1635,46 @@ static int nl80211_add_commands_unsplit(struct cfg80211_registered_device *rdev,
|
|||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
static int
|
||||
nl80211_put_iftype_akm_suites(struct cfg80211_registered_device *rdev,
|
||||
struct sk_buff *msg)
|
||||
{
|
||||
int i;
|
||||
struct nlattr *nested, *nested_akms;
|
||||
const struct wiphy_iftype_akm_suites *iftype_akms;
|
||||
|
||||
if (!rdev->wiphy.num_iftype_akm_suites ||
|
||||
!rdev->wiphy.iftype_akm_suites)
|
||||
return 0;
|
||||
|
||||
nested = nla_nest_start(msg, NL80211_ATTR_IFTYPE_AKM_SUITES);
|
||||
if (!nested)
|
||||
return -ENOBUFS;
|
||||
|
||||
for (i = 0; i < rdev->wiphy.num_iftype_akm_suites; i++) {
|
||||
nested_akms = nla_nest_start(msg, i + 1);
|
||||
if (!nested_akms)
|
||||
return -ENOBUFS;
|
||||
|
||||
iftype_akms = &rdev->wiphy.iftype_akm_suites[i];
|
||||
|
||||
if (nl80211_put_iftypes(msg, NL80211_IFTYPE_AKM_ATTR_IFTYPES,
|
||||
iftype_akms->iftypes_mask))
|
||||
return -ENOBUFS;
|
||||
|
||||
if (nla_put(msg, NL80211_IFTYPE_AKM_ATTR_SUITES,
|
||||
sizeof(u32) * iftype_akms->n_akm_suites,
|
||||
iftype_akms->akm_suites)) {
|
||||
return -ENOBUFS;
|
||||
}
|
||||
nla_nest_end(msg, nested_akms);
|
||||
}
|
||||
|
||||
nla_nest_end(msg, nested);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct nl80211_dump_wiphy_state {
|
||||
s64 filter_wiphy;
|
||||
long start;
|
||||
|
@ -2138,6 +2178,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
|
|||
goto nla_put_failure;
|
||||
}
|
||||
|
||||
if (nl80211_put_iftype_akm_suites(rdev, msg))
|
||||
goto nla_put_failure;
|
||||
|
||||
/* done */
|
||||
state->split_start = 0;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue