2013-08-27 05:49:05

by Sunil Dutt

[permalink] [raw]
Subject: [PATCH] cfg80211: Pass station supported channel and oper class info to kernel

The information of the peer's supported channels and supported operating
classes are required for the driver to perform TDLS off channel
operations. This commit enhances the function nl80211_(new)set_station
to pass this information of the peer to the driver.

Signed-off-by: Sunil Dutt <[email protected]>
---
include/net/cfg80211.h | 8 ++++++++
include/uapi/linux/nl80211.h | 9 +++++++++
net/wireless/nl80211.c | 30 ++++++++++++++++++++++++++++++
3 files changed, 47 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9ab7a06..81889ca 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -735,6 +735,10 @@ enum station_parameters_apply_mask {
* @capability: station capability
* @ext_capab: extended capabilities of the station
* @ext_capab_len: number of extended capabilities
+ * @supported_channels: supported channels in IEEE 802.11 format
+ * @supported_channels_len: number of supported channels
+ * @supported_oper_classes: supported oper classes in IEEE 802.11 format
+ * @supported_oper_classes_len: number of supported operating classes
*/
struct station_parameters {
const u8 *supported_rates;
@@ -754,6 +758,10 @@ struct station_parameters {
u16 capability;
const u8 *ext_capab;
u8 ext_capab_len;
+ const u8 *supported_channels;
+ u8 supported_channels_len;
+ const u8 *supported_oper_classes;
+ u8 supported_oper_classes_len;
};

/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 1f42bc3..61a21a4 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1493,6 +1493,11 @@ enum nl80211_commands {
* @NL80211_ATTR_CSA_C_OFF_PRESP: Offset of the channel switch counter
* field in the probe response (%NL80211_ATTR_PROBE_RESP).
*
+ * @NL80211_ATTR_STA_SUPPORTED_CHANNELS: array of supported channels.
+ *
+ * @NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES: array of supported
+ * supported operating classes.
+ *
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
@@ -1801,6 +1806,10 @@ enum nl80211_attrs {
NL80211_ATTR_CSA_C_OFF_BEACON,
NL80211_ATTR_CSA_C_OFF_PRESP,

+ NL80211_ATTR_STA_SUPPORTED_CHANNELS,
+
+ NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES,
+
/* 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 741368c..0765b9a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -354,6 +354,8 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
[NL80211_ATTR_CSA_IES] = { .type = NLA_NESTED },
[NL80211_ATTR_CSA_C_OFF_BEACON] = { .type = NLA_U16 },
[NL80211_ATTR_CSA_C_OFF_PRESP] = { .type = NLA_U16 },
+ [NL80211_ATTR_STA_SUPPORTED_CHANNELS] = { .type = NLA_BINARY },
+ [NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES] = { .type = NLA_BINARY },
};

/* policy for the key attributes */
@@ -3909,6 +3911,20 @@ static int nl80211_set_station_tdls(struct genl_info *info,
params->vht_capa =
nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY]);

+ if (info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]) {
+ params->supported_channels =
+ nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]);
+ params->supported_channels_len =
+ nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]);
+ }
+
+ if (info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]) {
+ params->supported_oper_classes =
+ nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]);
+ params->supported_oper_classes_len =
+ nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]);
+ }
+
return nl80211_parse_sta_wme(info, params);
}

@@ -4089,6 +4105,20 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
return -EINVAL;
}

+ if (info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]) {
+ params->supported_channels =
+ nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]);
+ params->supported_channels_len =
+ nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]);
+ }
+
+ if (info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]) {
+ params->supported_oper_classes =
+ nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]);
+ params->supported_oper_classes_len =
+ nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]);
+ }
+
err = nl80211_parse_sta_wme(info, &params);
if (err)
return err;
--
1.8.2.1



2013-09-09 15:13:04

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] cfg80211: Pass station supported channel and oper class info to kernel

On Sun, 2013-09-08 at 12:02 +0530, Sunil Dutt wrote:
> Hi Johannes,
> Can you please help in reviewing the patch and upstream the same.

Don't get impatient. The merge window is open, so there's no reason for
me to be applying patches.

johannes


2013-09-08 06:32:18

by Sunil Dutt

[permalink] [raw]
Subject: Re: [PATCH] cfg80211: Pass station supported channel and oper class info to kernel

Hi Johannes,
Can you please help in reviewing the patch and upstream the same.
Regards,
Sunil

On Tue, Aug 27, 2013 at 11:14 AM, Sunil Dutt <[email protected]> wrote:
> The information of the peer's supported channels and supported operating
> classes are required for the driver to perform TDLS off channel
> operations. This commit enhances the function nl80211_(new)set_station
> to pass this information of the peer to the driver.
>
> Signed-off-by: Sunil Dutt <[email protected]>
> ---
> include/net/cfg80211.h | 8 ++++++++
> include/uapi/linux/nl80211.h | 9 +++++++++
> net/wireless/nl80211.c | 30 ++++++++++++++++++++++++++++++
> 3 files changed, 47 insertions(+)
>
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index 9ab7a06..81889ca 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -735,6 +735,10 @@ enum station_parameters_apply_mask {
> * @capability: station capability
> * @ext_capab: extended capabilities of the station
> * @ext_capab_len: number of extended capabilities
> + * @supported_channels: supported channels in IEEE 802.11 format
> + * @supported_channels_len: number of supported channels
> + * @supported_oper_classes: supported oper classes in IEEE 802.11 format
> + * @supported_oper_classes_len: number of supported operating classes
> */
> struct station_parameters {
> const u8 *supported_rates;
> @@ -754,6 +758,10 @@ struct station_parameters {
> u16 capability;
> const u8 *ext_capab;
> u8 ext_capab_len;
> + const u8 *supported_channels;
> + u8 supported_channels_len;
> + const u8 *supported_oper_classes;
> + u8 supported_oper_classes_len;
> };
>
> /**
> diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
> index 1f42bc3..61a21a4 100644
> --- a/include/uapi/linux/nl80211.h
> +++ b/include/uapi/linux/nl80211.h
> @@ -1493,6 +1493,11 @@ enum nl80211_commands {
> * @NL80211_ATTR_CSA_C_OFF_PRESP: Offset of the channel switch counter
> * field in the probe response (%NL80211_ATTR_PROBE_RESP).
> *
> + * @NL80211_ATTR_STA_SUPPORTED_CHANNELS: array of supported channels.
> + *
> + * @NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES: array of supported
> + * supported operating classes.
> + *
> * @NL80211_ATTR_MAX: highest attribute number currently defined
> * @__NL80211_ATTR_AFTER_LAST: internal use
> */
> @@ -1801,6 +1806,10 @@ enum nl80211_attrs {
> NL80211_ATTR_CSA_C_OFF_BEACON,
> NL80211_ATTR_CSA_C_OFF_PRESP,
>
> + NL80211_ATTR_STA_SUPPORTED_CHANNELS,
> +
> + NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES,
> +
> /* 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 741368c..0765b9a 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -354,6 +354,8 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
> [NL80211_ATTR_CSA_IES] = { .type = NLA_NESTED },
> [NL80211_ATTR_CSA_C_OFF_BEACON] = { .type = NLA_U16 },
> [NL80211_ATTR_CSA_C_OFF_PRESP] = { .type = NLA_U16 },
> + [NL80211_ATTR_STA_SUPPORTED_CHANNELS] = { .type = NLA_BINARY },
> + [NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES] = { .type = NLA_BINARY },
> };
>
> /* policy for the key attributes */
> @@ -3909,6 +3911,20 @@ static int nl80211_set_station_tdls(struct genl_info *info,
> params->vht_capa =
> nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY]);
>
> + if (info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]) {
> + params->supported_channels =
> + nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]);
> + params->supported_channels_len =
> + nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]);
> + }
> +
> + if (info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]) {
> + params->supported_oper_classes =
> + nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]);
> + params->supported_oper_classes_len =
> + nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]);
> + }
> +
> return nl80211_parse_sta_wme(info, params);
> }
>
> @@ -4089,6 +4105,20 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
> return -EINVAL;
> }
>
> + if (info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]) {
> + params->supported_channels =
> + nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]);
> + params->supported_channels_len =
> + nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]);
> + }
> +
> + if (info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]) {
> + params->supported_oper_classes =
> + nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]);
> + params->supported_oper_classes_len =
> + nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]);
> + }
> +
> err = nl80211_parse_sta_wme(info, &params);
> if (err)
> return err;
> --
> 1.8.2.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2013-10-03 07:20:53

by Sunil Dutt

[permalink] [raw]
Subject: RE: [PATCH] cfg80211: Pass station supported channel and oper class info to kernel

VGhhbmtzIEpvaGFubmVzIGZvciB0aGUgcmV2aWV3Lg0KDQo+SXQgc2VlbXMgeW91IHNob3VsZCB2
YWxpZGF0ZSB0aGF0IHRoZSBsZW5ndGggaXMgZXZlbiwgYW5kIGF0IGxlYXN0IDI/DQpDYW4gSSBr
bm93IHdoeSB0aGUgY2hlY2sgZm9yIGV2ZW4vIGF0bGVhc3QgMiBpcz8gVGhvdWdoIEkgd291bGQg
dmFsaWRhdGUgZm9yIGEgbm9uIHplcm8gbGVuZ3RoIGFuZCByZXR1cm4gZmFpbHVyZSBpbiB0aGUg
ZWxzZSwgY29uc2lkZXJpbmcgYSBjYXNlIHdoZXJlIHRoZSBURExTIHBlZXIgYWR2ZXJ0aXNlcyBh
IHNpbmdsZSBjaGFubmVsLiBTaG91bGRuJ3QgaXQgc3VmZmljZT8NCg0KPiBEb2VzIHRoaXMgZXZl
biBtYWtlIHNlbnNlIGluIHNldF9zdGF0aW9uKCkgcmF0aGVyIHRoYW4gb25seSBuZXdfc3RhdGlv
bigpPw0KSSB3b3VsZCBoYXZlIHRoaXMgaW4gYm90aCBuZXdfc3RhdGlvbiBhbmQgc2V0X3N0YXRp
b24uIENvbnNpZGVyaW5nIHRoZSBjdXJyZW50IGJlaGF2aW9yIG9mIHRoZSBzdXBwbGljYW50IHdo
ZXJlIG5ld19zdGF0aW9uIGFuZCBzZXRfc3RhdGlvbiBhcmUgaW52b2tlZCBiZWZvcmUgYW5kIGFm
dGVyIHRoZSBUUEsgaGFuZ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HNo
b3VsZCB2YWxpZGF0ZSB0aGF0IHRoZSBsZW5ndGggaXMgZXZlbiwgYW5kIGF0IGxlYXN0IDI/DQoN
Cj4gKwlpZiAoaW5mby0+YXR0cnNbTkw4MDIxMV9BVFRSX1NUQV9TVVBQT1JURURfT1BFUl9DTEFT
U0VTXSkgew0KPiArCQlwYXJhbXMtPnN1cHBvcnRlZF9vcGVyX2NsYXNzZXMgPQ0KPiArCQkgbmxh
X2RhdGEoaW5mby0+YXR0cnNbTkw4MDIxMV9BVFRSX1NUQV9TVVBQT1JURURfT1BFUl9DTEFTU0VT
XSk7DQo+ICsJCXBhcmFtcy0+c3VwcG9ydGVkX29wZXJfY2xhc3Nlc19sZW4gPQ0KPiArCQkgIG5s
YV9sZW4oaW5mby0+YXR0cnNbTkw4MDIxMV9BVFRSX1NUQV9TVVBQT1JURURfT1BFUl9DTEFTU0VT
XSk7DQoNClNpbWlsYXJseSBoZXJlICh3aXRoIGRpZmZlcmVudCBydWxlcykNCg0KRG9lcyB0aGlz
IGV2ZW4gbWFrZSBzZW5zZSBpbiBzZXRfc3RhdGlvbigpIHJhdGhlciB0aGFuIG9ubHkgbmV3X3N0
YXRpb24oKT8NCg0Kam9oYW5uZXMNCg0K

2013-10-07 08:37:14

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] cfg80211: Pass station supported channel and oper class info to kernel

On Thu, 2013-10-03 at 07:20 +0000, Undekari, Sunil Dutt wrote:
> Thanks Johannes for the review.
>
> >It seems you should validate that the length is even, and at least 2?
> Can I know why the check for even/ atleast 2 is? Though I would
> validate for a non zero length and return failure in the else,
> considering a case where the TDLS peer advertises a single channel.
> Shouldn't it suffice?

Yes, if you look at the 802.11 spec you can know why. Hint: a single
channel is advertised using 2 bytes.

johannes


2013-10-09 09:14:10

by Sunil Dutt

[permalink] [raw]
Subject: RE: [PATCH] cfg80211: Pass station supported channel and oper class info to kernel

PiBJdCdzIGp1c3QgYSBxdWVzdGlvbiBvZiB3aGVyZSB0byBh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aWNhbnQuIEluIGEgd2F5LCBJJ2QgcmF0aGVyIGhhdmUgdGhl
IGtlcm5lbCByZWplY3QgaXQgYW5kIGRvIHRoZSBwb2xpY3kgb2YgaWdub3JpbmcgaW52YWxpZCBz
dHVmZiBpbiB0aGUgc3VwcGxpY2FudC4NCg0Kam9oYW5uZXMNCg0K

2013-10-09 09:17:46

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] cfg80211: Pass station supported channel and oper class info to kernel

On Wed, 2013-10-09 at 09:13 +0000, Undekari, Sunil Dutt wrote:
> > It's just a question of where to address this - in the kernel or the supplicant. In a way, I'd rather have the kernel reject it and do the policy of ignoring invalid stuff in the supplicant.
> The above statement from you made me to rethink for the following check in the patch sent.
>
> + if (params->supported_oper_classes_len < 2 ||
> + params->supported_oper_classes_len > 253)
> + return -EINVAL;
>
> Are you fine to return a failure for the invalid length for the supported_oper_classes_len? If yes, then shouldn't we also do the similar check for invalid supported_channels_len ( < 2 ).

Certainly works for me - but there should also be something like % 2 I
guess

johannes


2013-10-02 09:01:01

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] cfg80211: Pass station supported channel and oper class info to kernel

On Tue, 2013-08-27 at 11:14 +0530, Sunil Dutt wrote:

> + if (info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]) {
> + params->supported_channels =
> + nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]);
> + params->supported_channels_len =
> + nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]);

It seems you should validate that the length is even, and at least 2?

> + if (info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]) {
> + params->supported_oper_classes =
> + nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]);
> + params->supported_oper_classes_len =
> + nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]);

Similarly here (with different rules)

Does this even make sense in set_station() rather than only
new_station()?

johannes