All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cfg80211: Enhance the AKM advertizement to support per interface.
@ 2019-12-23 18:52 Veerendranath Jakkam
  2020-01-02 13:41 ` Johannes Berg
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Veerendranath Jakkam @ 2019-12-23 18:52 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless

Commit ab4dfa20534e ("cfg80211: Allow drivers to advertise supported AKM
suites") introduces the support to advertize the AKM support.

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).

User space would like to know if such driver has the implementation for
an AKM on a respective interface type.

This commit aims the same and replaces the earlier mechanism of advertizing
the AKM per wiphy.

User space shall assume that all AKMs for each interface type are
supported, if the driver does not advertize this capability.

Signed-off-by: Veerendranath Jakkam <vjakkam@codeaurora.org>
---
 include/net/cfg80211.h       | 20 +++++++++++++-----
 include/uapi/linux/nl80211.h |  7 ++++++
 net/wireless/nl80211.c       | 41 ++++++++++++++++++++++++++++++++----
 3 files changed, 59 insertions(+), 9 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 059524b87c4c..3e92e674a941 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4370,6 +4370,16 @@ struct cfg80211_pmsr_capabilities {
 	} ftm;
 };
 
+/**
+ * struct ieee80211_akm_suites - supported akm suites
+ * @akm_suites: points to an array of supported akm suites
+ * @n_akm_suites: number of supported AKM suites
+ */
+struct ieee80211_akm_suites {
+	const u32 *akm_suites;
+	int n_akm_suites;
+};
+
 /**
  * struct wiphy - wireless hardware description
  * @reg_notifier: the driver's regulatory notification callback,
@@ -4382,8 +4392,6 @@ struct cfg80211_pmsr_capabilities {
  * @signal_type: signal type reported in &struct cfg80211_bss.
  * @cipher_suites: supported cipher suites
  * @n_cipher_suites: number of supported cipher suites
- * @akm_suites: supported AKM suites
- * @n_akm_suites: number of supported AKM suites
  * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
  * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
  * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
@@ -4543,6 +4551,9 @@ struct cfg80211_pmsr_capabilities {
  *	@support_mbssid must be set for this to have any effect.
  *
  * @pmsr_capa: peer measurement capabilities
+ *
+ * @supported_akm_suites: supported akm suites info per interface, points to an
+ *	array indexed by interface type
  */
 struct wiphy {
 	/* assign these fields before you register the wiphy */
@@ -4587,9 +4598,6 @@ struct wiphy {
 	int n_cipher_suites;
 	const u32 *cipher_suites;
 
-	int n_akm_suites;
-	const u32 *akm_suites;
-
 	u8 retry_short;
 	u8 retry_long;
 	u32 frag_threshold;
@@ -4687,6 +4695,8 @@ struct wiphy {
 
 	const struct cfg80211_pmsr_capabilities *pmsr_capa;
 
+	const struct ieee80211_akm_suites *supported_akm_suites;
+
 	char priv[0] __aligned(NETDEV_ALIGN);
 };
 
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 341e0e8cae46..3b11df917818 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2400,6 +2400,11 @@ enum nl80211_commands {
  * @NL80211_ATTR_VLAN_ID: VLAN ID (1..4094) for the station and VLAN group key
  *	(u16).
  *
+ * @NL80211_ATTR_SUPPORTED_AKM_SUITES: Used for AKM suite capability
+ *	advertisement per interface. This is a nested attribute of
+ *	%NL80211_ATTR_FRAME_TYPE attributes, containing the supported AKM's
+ *	per interface.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2864,6 +2869,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_VLAN_ID,
 
+	NL80211_ATTR_SUPPORTED_AKM_SUITES,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index fa3526592c51..e27f0f9e5848 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1885,6 +1885,41 @@ static int nl80211_send_pmsr_capa(struct cfg80211_registered_device *rdev,
 	return 0;
 }
 
+static int
+nl80211_send_akm_suites(struct sk_buff *msg,
+			const struct ieee80211_akm_suites *supported_akm_suites)
+{
+	struct nlattr *nl_ftypes, *nl_ifs;
+	enum nl80211_iftype ift;
+	const struct ieee80211_akm_suites *supported_akms;
+
+	if (!supported_akm_suites)
+		return 0;
+
+	nl_ifs = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_AKM_SUITES);
+	if (!nl_ifs)
+		return -ENOBUFS;
+
+	for (ift = 0; ift < NUM_NL80211_IFTYPES; ift++) {
+		nl_ftypes = nla_nest_start(msg, ift);
+		if (!nl_ftypes)
+			return -ENOBUFS;
+
+		supported_akms = &supported_akm_suites[ift];
+		if (supported_akms->akm_suites &&
+		    nla_put(msg, NL80211_ATTR_AKM_SUITES,
+			    sizeof(u32) * supported_akms->n_akm_suites,
+			    supported_akms->akm_suites)) {
+			return -ENOBUFS;
+		}
+		nla_nest_end(msg, nl_ftypes);
+	}
+
+	nla_nest_end(msg, nl_ifs);
+
+	return 0;
+}
+
 struct nl80211_dump_wiphy_state {
 	s64 filter_wiphy;
 	long start;
@@ -2437,10 +2472,8 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 		state->split_start++;
 		break;
 	case 15:
-		if (rdev->wiphy.akm_suites &&
-		    nla_put(msg, NL80211_ATTR_AKM_SUITES,
-			    sizeof(u32) * rdev->wiphy.n_akm_suites,
-			    rdev->wiphy.akm_suites))
+		if (nl80211_send_akm_suites(msg,
+					    rdev->wiphy.supported_akm_suites))
 			goto nla_put_failure;
 
 		/* done */
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] cfg80211: Enhance the AKM advertizement to support per interface.
  2019-12-23 18:52 [PATCH] cfg80211: Enhance the AKM advertizement to support per interface Veerendranath Jakkam
@ 2020-01-02 13:41 ` Johannes Berg
  2020-01-17 11:34   ` vjakkam
  2020-01-02 13:45 ` Johannes Berg
  2020-01-17 11:35 ` [PATCH v2] " Veerendranath Jakkam
  2 siblings, 1 reply; 12+ messages in thread
From: Johannes Berg @ 2020-01-02 13:41 UTC (permalink / raw)
  To: Veerendranath Jakkam; +Cc: linux-wireless

On Tue, 2019-12-24 at 00:22 +0530, Veerendranath Jakkam wrote:
> 
> @@ -2437,10 +2472,8 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
>  		state->split_start++;
>  		break;
>  	case 15:
> -		if (rdev->wiphy.akm_suites &&
> -		    nla_put(msg, NL80211_ATTR_AKM_SUITES,
> -			    sizeof(u32) * rdev->wiphy.n_akm_suites,
> -			    rdev->wiphy.akm_suites))

I don't think you should break this for all existing cases.

johannes


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] cfg80211: Enhance the AKM advertizement to support per interface.
  2019-12-23 18:52 [PATCH] cfg80211: Enhance the AKM advertizement to support per interface Veerendranath Jakkam
  2020-01-02 13:41 ` Johannes Berg
@ 2020-01-02 13:45 ` Johannes Berg
  2020-01-17 11:33   ` vjakkam
  2020-01-17 11:35 ` [PATCH v2] " Veerendranath Jakkam
  2 siblings, 1 reply; 12+ messages in thread
From: Johannes Berg @ 2020-01-02 13:45 UTC (permalink / raw)
  To: Veerendranath Jakkam; +Cc: linux-wireless

On Tue, 2019-12-24 at 00:22 +0530, Veerendranath Jakkam wrote:
> 
> @@ -4587,9 +4598,6 @@ struct wiphy {
>  	int n_cipher_suites;
>  	const u32 *cipher_suites;
>  
> -	int n_akm_suites;
> -	const u32 *akm_suites;

Certainly this also breaks compiling a large number of drivers... ???

johannes


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] cfg80211: Enhance the AKM advertizement to support per interface.
  2020-01-02 13:45 ` Johannes Berg
@ 2020-01-17 11:33   ` vjakkam
  0 siblings, 0 replies; 12+ messages in thread
From: vjakkam @ 2020-01-17 11:33 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On 2020-01-02 19:15, Johannes Berg wrote:
> On Tue, 2019-12-24 at 00:22 +0530, Veerendranath Jakkam wrote:
>> 
>> @@ -4587,9 +4598,6 @@ struct wiphy {
>>  	int n_cipher_suites;
>>  	const u32 *cipher_suites;
>> 
>> -	int n_akm_suites;
>> -	const u32 *akm_suites;
> 
> Certainly this also breaks compiling a large number of drivers... ???
> 
> johannes

Thanks, I will correct in v2

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] cfg80211: Enhance the AKM advertizement to support per interface.
  2020-01-02 13:41 ` Johannes Berg
@ 2020-01-17 11:34   ` vjakkam
  0 siblings, 0 replies; 12+ messages in thread
From: vjakkam @ 2020-01-17 11:34 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On 2020-01-02 19:11, Johannes Berg wrote:
> On Tue, 2019-12-24 at 00:22 +0530, Veerendranath Jakkam wrote:
>> 
>> @@ -2437,10 +2472,8 @@ static int nl80211_send_wiphy(struct 
>> cfg80211_registered_device *rdev,
>>  		state->split_start++;
>>  		break;
>>  	case 15:
>> -		if (rdev->wiphy.akm_suites &&
>> -		    nla_put(msg, NL80211_ATTR_AKM_SUITES,
>> -			    sizeof(u32) * rdev->wiphy.n_akm_suites,
>> -			    rdev->wiphy.akm_suites))
> 
> I don't think you should break this for all existing cases.
> 
> johannes

Thanks, I will correct in v2

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2] cfg80211: Enhance the AKM advertizement to support per interface.
  2019-12-23 18:52 [PATCH] cfg80211: Enhance the AKM advertizement to support per interface Veerendranath Jakkam
  2020-01-02 13:41 ` Johannes Berg
  2020-01-02 13:45 ` Johannes Berg
@ 2020-01-17 11:35 ` Veerendranath Jakkam
  2020-01-20  8:57   ` Arend Van Spriel
  2020-01-26 11:21   ` [PATCH v3] " Veerendranath Jakkam
  2 siblings, 2 replies; 12+ messages in thread
From: Veerendranath Jakkam @ 2020-01-17 11:35 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Veerendranath Jakkam

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).

Add a new nl80211 attribute to provide supported AKMs per interface type
to userspace.

This commit aims the same and enhances the earlier mechanism of advertizing
the AKMs per wiphy. 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>
---
Changelog:
v1->v2:
 -Keep advertizing support for AKM suites per wiphy
 -AKM suites per interface overrides wiphy AKM suites for specific interface
 -Rename new nl80211 attribute to NL80211_ATTR_IFTYPE_AKM_SUITES
---
 include/net/cfg80211.h       | 22 +++++++++++++++++++-
 include/uapi/linux/nl80211.h |  6 ++++++
 net/wireless/nl80211.c       | 39 ++++++++++++++++++++++++++++++++++++
 3 files changed, 66 insertions(+), 1 deletion(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index fa027d0d031b..10533dff2102 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4398,6 +4398,18 @@ struct cfg80211_pmsr_capabilities {
 	} ftm;
 };
 
+/**
+ * struct wiphy_iftype_akm_suites - supported akm suites per interface type
+ * @iftype: interface type
+ * @akm_suites: points to an array of supported akm suites
+ * @n_akm_suites: number of supported AKM suites
+ */
+struct wiphy_iftype_akm_suites {
+	enum nl80211_iftype iftype;
+	const u32 *akm_suites;
+	int n_akm_suites;
+};
+
 /**
  * struct wiphy - wireless hardware description
  * @reg_notifier: the driver's regulatory notification callback,
@@ -4410,8 +4422,13 @@ struct cfg80211_pmsr_capabilities {
  * @signal_type: signal type reported in &struct cfg80211_bss.
  * @cipher_suites: supported cipher suites
  * @n_cipher_suites: number of supported cipher suites
- * @akm_suites: supported AKM suites
+ * @akm_suites: supported AKM suites. These are the default AKMs supported if
+ *	the supported AKMs not advertized for a specific interface type in
+ *	iftype_akm_suites.
  * @n_akm_suites: number of supported AKM suites
+ * @iftype_akm_suites: array of supported akm suites info per interface.
+ * @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);
@@ -4618,6 +4635,9 @@ struct wiphy {
 	int n_akm_suites;
 	const u32 *akm_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;
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 809ef9165684..a6b688e8834e 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2402,6 +2402,10 @@ enum nl80211_commands {
  *
  * @NL80211_ATTR_HE_BSS_COLOR: nested attribute for BSS Color Settings.
  *
+ * @NL80211_ATTR_IFTYPE_AKM_SUITES: Used for AKM suite capability advertisement
+ *	per interface. This is a nested attribute of %NL80211_ATTR_IFTYPE to
+ *	specify supported AKMs per 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
@@ -2868,6 +2872,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_HE_BSS_COLOR,
 
+	NL80211_ATTR_IFTYPE_AKM_SUITES,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 00f24d4c623e..f6d5e0c70bab 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1893,6 +1893,42 @@ static int nl80211_send_pmsr_capa(struct cfg80211_registered_device *rdev,
 	return 0;
 }
 
+static int
+nl80211_send_iftype_akm_suites(struct cfg80211_registered_device *rdev,
+			struct sk_buff *msg)
+{
+	int i;
+	struct nlattr *nl_ftypes, *nl_ifs;
+	const struct wiphy_iftype_akm_suites *iftype_akms;
+
+	if (!rdev->wiphy.iftype_akm_suites)
+		return 0;
+
+	nl_ifs = nla_nest_start(msg, NL80211_ATTR_IFTYPE_AKM_SUITES);
+	if (!nl_ifs)
+		return -ENOBUFS;
+
+	for (i = 0; i < rdev->wiphy.num_iftype_akm_suites; i++) {
+		iftype_akms = &rdev->wiphy.iftype_akm_suites[i];
+
+		nl_ftypes = nla_nest_start(msg, iftype_akms->iftype);
+		if (!nl_ftypes)
+			return -ENOBUFS;
+
+		if (iftype_akms->akm_suites &&
+		    nla_put(msg, NL80211_ATTR_AKM_SUITES,
+			    sizeof(u32) * iftype_akms->n_akm_suites,
+			    iftype_akms->akm_suites)) {
+			return -ENOBUFS;
+		}
+		nla_nest_end(msg, nl_ftypes);
+	}
+
+	nla_nest_end(msg, nl_ifs);
+
+	return 0;
+}
+
 struct nl80211_dump_wiphy_state {
 	s64 filter_wiphy;
 	long start;
@@ -2451,6 +2487,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 			    rdev->wiphy.akm_suites))
 			goto nla_put_failure;
 
+		if (nl80211_send_iftype_akm_suites(rdev, msg))
+				goto nla_put_failure;
+
 		/* done */
 		state->split_start = 0;
 		break;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] cfg80211: Enhance the AKM advertizement to support per interface.
  2020-01-17 11:35 ` [PATCH v2] " Veerendranath Jakkam
@ 2020-01-20  8:57   ` Arend Van Spriel
  2020-01-26 11:10     ` vjakkam
  2020-01-26 11:21   ` [PATCH v3] " Veerendranath Jakkam
  1 sibling, 1 reply; 12+ messages in thread
From: Arend Van Spriel @ 2020-01-20  8:57 UTC (permalink / raw)
  To: Veerendranath Jakkam, johannes; +Cc: linux-wireless

On 1/17/2020 12:35 PM, Veerendranath Jakkam wrote:
> 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).
> 
> Add a new nl80211 attribute to provide supported AKMs per interface type
> to userspace.
> 
> This commit aims the same and enhances the earlier mechanism of advertizing
> the AKMs per wiphy. 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>
> ---
> Changelog:
> v1->v2:
>   -Keep advertizing support for AKM suites per wiphy
>   -AKM suites per interface overrides wiphy AKM suites for specific interface
>   -Rename new nl80211 attribute to NL80211_ATTR_IFTYPE_AKM_SUITES
> ---
>   include/net/cfg80211.h       | 22 +++++++++++++++++++-
>   include/uapi/linux/nl80211.h |  6 ++++++
>   net/wireless/nl80211.c       | 39 ++++++++++++++++++++++++++++++++++++
>   3 files changed, 66 insertions(+), 1 deletion(-)
> 
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index fa027d0d031b..10533dff2102 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -4398,6 +4398,18 @@ struct cfg80211_pmsr_capabilities {
>   	} ftm;
>   };
>   
> +/**
> + * struct wiphy_iftype_akm_suites - supported akm suites per interface type
> + * @iftype: interface type
> + * @akm_suites: points to an array of supported akm suites
> + * @n_akm_suites: number of supported AKM suites
> + */
> +struct wiphy_iftype_akm_suites {
> +	enum nl80211_iftype iftype;

I can imagine certain iftypes could support same suites so maybe good to 
use bitmask of iftypes iso single iftype.

Regards,
Arend

> +	const u32 *akm_suites;
> +	int n_akm_suites;
> +};
> +

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] cfg80211: Enhance the AKM advertizement to support per interface.
  2020-01-20  8:57   ` Arend Van Spriel
@ 2020-01-26 11:10     ` vjakkam
  0 siblings, 0 replies; 12+ messages in thread
From: vjakkam @ 2020-01-26 11:10 UTC (permalink / raw)
  To: Arend Van Spriel; +Cc: johannes, linux-wireless

On 2020-01-20 14:27, Arend Van Spriel wrote:
> On 1/17/2020 12:35 PM, Veerendranath Jakkam wrote:
>> 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).
>> 
>> Add a new nl80211 attribute to provide supported AKMs per interface 
>> type
>> to userspace.
>> 
>> This commit aims the same and enhances the earlier mechanism of 
>> advertizing
>> the AKMs per wiphy. 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>
>> ---
>> Changelog:
>> v1->v2:
>>   -Keep advertizing support for AKM suites per wiphy
>>   -AKM suites per interface overrides wiphy AKM suites for specific 
>> interface
>>   -Rename new nl80211 attribute to NL80211_ATTR_IFTYPE_AKM_SUITES
>> ---
>>   include/net/cfg80211.h       | 22 +++++++++++++++++++-
>>   include/uapi/linux/nl80211.h |  6 ++++++
>>   net/wireless/nl80211.c       | 39 
>> ++++++++++++++++++++++++++++++++++++
>>   3 files changed, 66 insertions(+), 1 deletion(-)
>> 
>> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
>> index fa027d0d031b..10533dff2102 100644
>> --- a/include/net/cfg80211.h
>> +++ b/include/net/cfg80211.h
>> @@ -4398,6 +4398,18 @@ struct cfg80211_pmsr_capabilities {
>>   	} ftm;
>>   };
>>   +/**
>> + * struct wiphy_iftype_akm_suites - supported akm suites per 
>> interface type
>> + * @iftype: interface type
>> + * @akm_suites: points to an array of supported akm suites
>> + * @n_akm_suites: number of supported AKM suites
>> + */
>> +struct wiphy_iftype_akm_suites {
>> +	enum nl80211_iftype iftype;
> 
> I can imagine certain iftypes could support same suites so maybe good
> to use bitmask of iftypes iso single iftype.
> 
> Regards,
> Arend
> 
>> +	const u32 *akm_suites;
>> +	int n_akm_suites;
>> +};
>> +

Thanks, I will upload v3 patch with suggested changes.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v3] cfg80211: Enhance the AKM advertizement to support per interface.
  2020-01-17 11:35 ` [PATCH v2] " Veerendranath Jakkam
  2020-01-20  8:57   ` Arend Van Spriel
@ 2020-01-26 11:21   ` Veerendranath Jakkam
  2020-01-26 17:32     ` Johannes Berg
  2020-01-26 20:30     ` [PATCH v4] " Veerendranath Jakkam
  1 sibling, 2 replies; 12+ messages in thread
From: Veerendranath Jakkam @ 2020-01-26 11:21 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Veerendranath Jakkam

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).

Add a new nl80211 attribute to provide supported AKMs per interface type
to userspace.

This commit aims the same and enhances the earlier mechanism of advertizing
the AKMs per wiphy. 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>
---
Changelog:
v2->v3:
 -Use bitmask of iftypes instead of single iftype
v1->v2:
 -Keep advertizing support for AKM suites per wiphy
 -AKM suites per interface overrides wiphy AKM suites for specific interface
 -Rename new nl80211 attribute to NL80211_ATTR_IFTYPE_AKM_SUITES
---
 include/net/cfg80211.h       | 28 ++++++++++++++++++++++-
 include/uapi/linux/nl80211.h |  7 ++++++
 net/wireless/nl80211.c       | 43 ++++++++++++++++++++++++++++++++++++
 3 files changed, 77 insertions(+), 1 deletion(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index fa027d0d031b..83e92d5c20d8 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4398,6 +4398,21 @@ struct cfg80211_pmsr_capabilities {
 	} ftm;
 };
 
+/**
+ * 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,
@@ -4410,8 +4425,16 @@ struct cfg80211_pmsr_capabilities {
  * @signal_type: signal type reported in &struct cfg80211_bss.
  * @cipher_suites: supported cipher suites
  * @n_cipher_suites: number of supported cipher suites
- * @akm_suites: supported AKM suites
+ * @akm_suites: supported AKM suites. These are the default AKMs supported if
+ *	the supported AKMs not advertized for a specific interface type in
+ *	iftype_akm_suites.
  * @n_akm_suites: number of supported AKM 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);
@@ -4618,6 +4641,9 @@ struct wiphy {
 	int n_akm_suites;
 	const u32 *akm_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;
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 809ef9165684..108c039cc54b 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2402,6 +2402,11 @@ enum nl80211_commands {
  *
  * @NL80211_ATTR_HE_BSS_COLOR: nested attribute for BSS Color Settings.
  *
+ * @NL80211_ATTR_IFTYPE_AKM_SUITES: Used for AKM suite capability advertisement
+ *	per interface. This is a nested attribute of %NL80211_ATTR_AKM_SUITES
+ *	and %NL80211_ATTR_SUPPORTED_IFTYPE to specify supported AKMs per
+ *	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
@@ -2868,6 +2873,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_HE_BSS_COLOR,
 
+	NL80211_ATTR_IFTYPE_AKM_SUITES,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 00f24d4c623e..7dd0e622b2f1 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1893,6 +1893,46 @@ static int nl80211_send_pmsr_capa(struct cfg80211_registered_device *rdev,
 	return 0;
 }
 
+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_ATTR_SUPPORTED_IFTYPES,
+					iftype_akms->iftypes_mask))
+			return -ENOBUFS;
+
+		if (nla_put(msg, NL80211_ATTR_AKM_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;
@@ -2451,6 +2491,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 			    rdev->wiphy.akm_suites))
 			goto nla_put_failure;
 
+		if (nl80211_put_iftype_akm_suites(rdev, msg))
+			goto nla_put_failure;
+
 		/* done */
 		state->split_start = 0;
 		break;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v3] cfg80211: Enhance the AKM advertizement to support per interface.
  2020-01-26 11:21   ` [PATCH v3] " Veerendranath Jakkam
@ 2020-01-26 17:32     ` Johannes Berg
  2020-01-26 20:23       ` vjakkam
  2020-01-26 20:30     ` [PATCH v4] " Veerendranath Jakkam
  1 sibling, 1 reply; 12+ messages in thread
From: Johannes Berg @ 2020-01-26 17:32 UTC (permalink / raw)
  To: Veerendranath Jakkam; +Cc: linux-wireless

On Sun, 2020-01-26 at 16:51 +0530, Veerendranath Jakkam wrote:
> 
> +
> +	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_ATTR_SUPPORTED_IFTYPES,
> +					iftype_akms->iftypes_mask))
> +			return -ENOBUFS;
> +
> +		if (nla_put(msg, NL80211_ATTR_AKM_SUITES,

Using the top-level attributes inside the nesting makes things
unnecessarily difficult to understand and take far more memory to parse,
IMHO it'd be better to define a new set of inner attributes
NL80211_IFTYPE_AKM_ATTR_IFTYPES, ..._SUITES or so.

johannes


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3] cfg80211: Enhance the AKM advertizement to support per interface.
  2020-01-26 17:32     ` Johannes Berg
@ 2020-01-26 20:23       ` vjakkam
  0 siblings, 0 replies; 12+ messages in thread
From: vjakkam @ 2020-01-26 20:23 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On 2020-01-26 23:02, Johannes Berg wrote:
> On Sun, 2020-01-26 at 16:51 +0530, Veerendranath Jakkam wrote:
>> 
>> +
>> +	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_ATTR_SUPPORTED_IFTYPES,
>> +					iftype_akms->iftypes_mask))
>> +			return -ENOBUFS;
>> +
>> +		if (nla_put(msg, NL80211_ATTR_AKM_SUITES,
> 
> Using the top-level attributes inside the nesting makes things
> unnecessarily difficult to understand and take far more memory to 
> parse,
> IMHO it'd be better to define a new set of inner attributes
> NL80211_IFTYPE_AKM_ATTR_IFTYPES, ..._SUITES or so.
> 
> johannes

Thanks, I will correct this in v4 as per suggestion

veeru

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v4] cfg80211: Enhance the AKM advertizement to support per interface.
  2020-01-26 11:21   ` [PATCH v3] " Veerendranath Jakkam
  2020-01-26 17:32     ` Johannes Berg
@ 2020-01-26 20:30     ` Veerendranath Jakkam
  1 sibling, 0 replies; 12+ messages in thread
From: Veerendranath Jakkam @ 2020-01-26 20:30 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Veerendranath Jakkam

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>
---
 include/net/cfg80211.h       | 28 ++++++++++++++++++++++-
 include/uapi/linux/nl80211.h | 33 +++++++++++++++++++++++++++
 net/wireless/nl80211.c       | 43 ++++++++++++++++++++++++++++++++++++
 3 files changed, 103 insertions(+), 1 deletion(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index fa027d0d031b..83e92d5c20d8 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4398,6 +4398,21 @@ struct cfg80211_pmsr_capabilities {
 	} ftm;
 };
 
+/**
+ * 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,
@@ -4410,8 +4425,16 @@ struct cfg80211_pmsr_capabilities {
  * @signal_type: signal type reported in &struct cfg80211_bss.
  * @cipher_suites: supported cipher suites
  * @n_cipher_suites: number of supported cipher suites
- * @akm_suites: supported AKM suites
+ * @akm_suites: supported AKM suites. These are the default AKMs supported if
+ *	the supported AKMs not advertized for a specific interface type in
+ *	iftype_akm_suites.
  * @n_akm_suites: number of supported AKM 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);
@@ -4618,6 +4641,9 @@ struct wiphy {
 	int n_akm_suites;
 	const u32 *akm_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;
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 809ef9165684..0503a2ae7620 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2402,6 +2402,13 @@ enum nl80211_commands {
  *
  * @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
@@ -2868,6 +2875,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_HE_BSS_COLOR,
 
+	NL80211_ATTR_IFTYPE_AKM_SUITES,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -6614,4 +6623,28 @@ enum nl80211_bss_color_attributes {
 	NL80211_HE_BSS_COLOR_ATTR_MAX = __NL80211_HE_BSS_COLOR_ATTR_LAST - 1,
 };
 
+/**
+ * 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 */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 00f24d4c623e..53a8cb23204f 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1893,6 +1893,46 @@ static int nl80211_send_pmsr_capa(struct cfg80211_registered_device *rdev,
 	return 0;
 }
 
+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;
@@ -2451,6 +2491,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 			    rdev->wiphy.akm_suites))
 			goto nla_put_failure;
 
+		if (nl80211_put_iftype_akm_suites(rdev, msg))
+			goto nla_put_failure;
+
 		/* done */
 		state->split_start = 0;
 		break;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-01-26 20:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-23 18:52 [PATCH] cfg80211: Enhance the AKM advertizement to support per interface Veerendranath Jakkam
2020-01-02 13:41 ` Johannes Berg
2020-01-17 11:34   ` vjakkam
2020-01-02 13:45 ` Johannes Berg
2020-01-17 11:33   ` vjakkam
2020-01-17 11:35 ` [PATCH v2] " Veerendranath Jakkam
2020-01-20  8:57   ` Arend Van Spriel
2020-01-26 11:10     ` vjakkam
2020-01-26 11:21   ` [PATCH v3] " Veerendranath Jakkam
2020-01-26 17:32     ` Johannes Berg
2020-01-26 20:23       ` vjakkam
2020-01-26 20:30     ` [PATCH v4] " Veerendranath Jakkam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.