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>
CRs-Fixed: 2632444
Change-Id: I6f33a6b27c38f7be09e9740fccaf750a2c148c31
Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org>
This commit is contained in:
Veerendranath Jakkam 2020-02-29 23:00:13 +05:30
parent b8d444ad18
commit e84ac7f34b
3 changed files with 211 additions and 0 deletions

View File

@ -59,6 +59,9 @@
/* Indicate backport support for DH IE creation/update*/
#define CFG80211_EXTERNAL_DH_UPDATE_SUPPORT 1
/* Indicate backport support for supported AKM advertisement per interface*/
#define CFG80211_IFTYPE_AKM_SUITES_SUPPORT 1
/**
* DOC: Introduction
*
@ -3687,6 +3690,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,
@ -3699,6 +3717,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);
@ -3892,6 +3916,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;

View File

@ -2245,6 +2245,80 @@ enum nl80211_commands {
* may offload authentication processing to user space if this capability
* is indicated in the respective requests from the user space.
*
* @NL80211_ATTR_NSS: Station's New/updated RX_NSS value notified using this
* u8 attribute. This is used with %NL80211_CMD_STA_OPMODE_CHANGED.
*
* @NL80211_ATTR_TXQ_STATS: TXQ statistics (nested attribute, see &enum
* nl80211_txq_stats)
* @NL80211_ATTR_TXQ_LIMIT: Total packet limit for the TXQ queues for this phy.
* The smaller of this and the memory limit is enforced.
* @NL80211_ATTR_TXQ_MEMORY_LIMIT: Total memory memory limit (in bytes) for the
* TXQ queues for this phy. The smaller of this and the packet limit is
* enforced.
* @NL80211_ATTR_TXQ_QUANTUM: TXQ scheduler quantum (bytes). Number of bytes
* a flow is assigned on each round of the DRR scheduler.
* @NL80211_ATTR_HE_CAPABILITY: HE Capability information element (from
* association request when used with NL80211_CMD_NEW_STATION). Can be set
* only if %NL80211_STA_FLAG_WME is set.
*
* @NL80211_ATTR_FTM_RESPONDER: nested attribute which user-space can include
* in %NL80211_CMD_START_AP or %NL80211_CMD_SET_BEACON for fine timing
* measurement (FTM) responder functionality and containing parameters as
* possible, see &enum nl80211_ftm_responder_attr
*
* @NL80211_ATTR_FTM_RESPONDER_STATS: Nested attribute with FTM responder
* statistics, see &enum nl80211_ftm_responder_stats.
*
* @NL80211_ATTR_TIMEOUT: Timeout for the given operation in milliseconds (u32),
* if the attribute is not given no timeout is requested. Note that 0 is an
* invalid value.
*
* @NL80211_ATTR_PEER_MEASUREMENTS: peer measurements request (and result)
* data, uses nested attributes specified in
* &enum nl80211_peer_measurement_attrs.
* This is also used for capability advertisement in the wiphy information,
* with the appropriate sub-attributes.
*
* @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime
* scheduler.
*
* @NL80211_ATTR_STA_TX_POWER_SETTING: Transmit power setting type (u8) for
* station associated with the AP. See &enum nl80211_tx_power_setting for
* possible values.
* @NL80211_ATTR_STA_TX_POWER: Transmit power level (s16) in dBm units. This
* allows to set Tx power for a station. If this attribute is not included,
* the default per-interface tx power setting will be overriding. Driver
* should be picking up the lowest tx power, either tx power per-interface
* or per-station.
*
* @NL80211_ATTR_SAE_PASSWORD: attribute for passing SAE password material. It
* is used with %NL80211_CMD_CONNECT to provide password for offloading
* SAE authentication for WPA3-Personal networks.
*
* @NL80211_ATTR_TWT_RESPONDER: Enable target wait time responder support.
*
* @NL80211_ATTR_HE_OBSS_PD: nested attribute for OBSS Packet Detection
* functionality.
*
* @NL80211_ATTR_WIPHY_EDMG_CHANNELS: bitmap that indicates the 2.16 GHz
* channel(s) that are allowed to be used for EDMG transmissions.
* Defined by IEEE P802.11ay/D4.0 section 9.4.2.251. (u8 attribute)
* @NL80211_ATTR_WIPHY_EDMG_BW_CONFIG: Channel BW Configuration subfield encodes
* 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
@ -2674,6 +2748,45 @@ enum nl80211_attrs {
NL80211_ATTR_EXTERNAL_AUTH_ACTION,
NL80211_ATTR_EXTERNAL_AUTH_SUPPORT,
NL80211_ATTR_NSS,
NL80211_ATTR_ACK_SIGNAL,
NL80211_ATTR_CONTROL_PORT_OVER_NL80211,
NL80211_ATTR_TXQ_STATS,
NL80211_ATTR_TXQ_LIMIT,
NL80211_ATTR_TXQ_MEMORY_LIMIT,
NL80211_ATTR_TXQ_QUANTUM,
NL80211_ATTR_HE_CAPABILITY,
NL80211_ATTR_FTM_RESPONDER,
NL80211_ATTR_FTM_RESPONDER_STATS,
NL80211_ATTR_TIMEOUT,
NL80211_ATTR_PEER_MEASUREMENTS,
NL80211_ATTR_AIRTIME_WEIGHT,
NL80211_ATTR_STA_TX_POWER_SETTING,
NL80211_ATTR_STA_TX_POWER,
NL80211_ATTR_SAE_PASSWORD,
NL80211_ATTR_TWT_RESPONDER,
NL80211_ATTR_HE_OBSS_PD,
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,
@ -5661,4 +5774,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 */

View File

@ -1454,6 +1454,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;
@ -1935,6 +1975,13 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
rdev->wiphy.nan_supported_bands))
goto nla_put_failure;
state->split_start++;
break;
case 14:
if (nl80211_put_iftype_akm_suites(rdev, msg))
goto nla_put_failure;
/* done */
state->split_start = 0;
break;