Skip to content

Commit 291c49d

Browse files
Aloka Dixitjmberg-intel
authored andcommitted
nl80211: Add FILS discovery support
FILS discovery attribute, NL80211_ATTR_FILS_DISCOVERY, is nested which supports following parameters as given in IEEE Std 802.11ai-2016, Annex C.3 MIB detail: (1) NL80211_FILS_DISCOVERY_ATTR_INT_MIN - Minimum packet interval (2) NL80211_FILS_DISCOVERY_ATTR_INT_MAX - Maximum packet interval (3) NL80211_FILS_DISCOVERY_ATTR_TMPL - Template data Signed-off-by: Aloka Dixit <alokad@codeaurora.org> Link: https://lore.kernel.org/r/20200805011838.28166-2-alokad@codeaurora.org [fix attribute and other names, use NLA_RANGE(), use policy only once] Link: https://lore.kernel.org/r/010101747a7b38a8-306f06b2-9061-4baf-81c1-054a42a18e22-000000@us-west-2.amazonses.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 5595870 commit 291c49d

3 files changed

Lines changed: 112 additions & 0 deletions

File tree

‎include/net/cfg80211.h‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,23 @@ struct cfg80211_acl_data {
10821082
struct mac_address mac_addrs[];
10831083
};
10841084

1085+
/**
1086+
* struct cfg80211_fils_discovery - FILS discovery parameters from
1087+
* IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
1088+
*
1089+
* @min_interval: Minimum packet interval in TUs (0 - 10000)
1090+
* @max_interval: Maximum packet interval in TUs (0 - 10000)
1091+
* @tmpl_len: Template length
1092+
* @tmpl: Template data for FILS discovery frame including the action
1093+
* frame headers.
1094+
*/
1095+
struct cfg80211_fils_discovery {
1096+
u32 min_interval;
1097+
u32 max_interval;
1098+
size_t tmpl_len;
1099+
const u8 *tmpl;
1100+
};
1101+
10851102
/**
10861103
* enum cfg80211_ap_settings_flags - AP settings flags
10871104
*
@@ -1129,6 +1146,7 @@ enum cfg80211_ap_settings_flags {
11291146
* @he_obss_pd: OBSS Packet Detection settings
11301147
* @he_bss_color: BSS Color settings
11311148
* @he_oper: HE operation IE (or %NULL if HE isn't enabled)
1149+
* @fils_discovery: FILS discovery transmission parameters
11321150
*/
11331151
struct cfg80211_ap_settings {
11341152
struct cfg80211_chan_def chandef;
@@ -1159,6 +1177,7 @@ struct cfg80211_ap_settings {
11591177
u32 flags;
11601178
struct ieee80211_he_obss_pd he_obss_pd;
11611179
struct cfg80211_he_bss_color he_bss_color;
1180+
struct cfg80211_fils_discovery fils_discovery;
11621181
};
11631182

11641183
/**

‎include/uapi/linux/nl80211.h‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,6 +2513,10 @@ enum nl80211_commands {
25132513
* @NL80211_ATTR_HE_6GHZ_CAPABILITY: HE 6 GHz Band Capability element (from
25142514
* association request when used with NL80211_CMD_NEW_STATION).
25152515
*
2516+
* @NL80211_ATTR_FILS_DISCOVERY: Optional parameter to configure FILS
2517+
* discovery. It is a nested attribute, see
2518+
* &enum nl80211_fils_discovery_attributes.
2519+
*
25162520
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
25172521
* @NL80211_ATTR_MAX: highest attribute number currently defined
25182522
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2995,6 +2999,8 @@ enum nl80211_attrs {
29952999

29963000
NL80211_ATTR_HE_6GHZ_CAPABILITY,
29973001

3002+
NL80211_ATTR_FILS_DISCOVERY,
3003+
29983004
/* add attributes here, update the policy in nl80211.c */
29993005

30003006
__NL80211_ATTR_AFTER_LAST,
@@ -5867,6 +5873,9 @@ enum nl80211_feature_flags {
58675873
* @NL80211_EXT_FEATURE_SAE_OFFLOAD_AP: Device wants to do SAE authentication
58685874
* in AP mode (SAE password is passed as part of the start AP command).
58695875
*
5876+
* @NL80211_EXT_FEATURE_FILS_DISCOVERY: Driver/device supports FILS discovery
5877+
* frames transmission
5878+
*
58705879
* @NUM_NL80211_EXT_FEATURES: number of extended features.
58715880
* @MAX_NL80211_EXT_FEATURES: highest extended feature index.
58725881
*/
@@ -5925,6 +5934,7 @@ enum nl80211_ext_feature_index {
59255934
NL80211_EXT_FEATURE_OPERATING_CHANNEL_VALIDATION,
59265935
NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK,
59275936
NL80211_EXT_FEATURE_SAE_OFFLOAD_AP,
5937+
NL80211_EXT_FEATURE_FILS_DISCOVERY,
59285938

59295939
/* add new features before the definition below */
59305940
NUM_NL80211_EXT_FEATURES,
@@ -7019,4 +7029,38 @@ enum nl80211_iftype_akm_attributes {
70197029
NL80211_IFTYPE_AKM_ATTR_MAX = __NL80211_IFTYPE_AKM_ATTR_LAST - 1,
70207030
};
70217031

7032+
/**
7033+
* enum nl80211_fils_discovery_attributes - FILS discovery configuration
7034+
* from IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
7035+
*
7036+
* @__NL80211_FILS_DISCOVERY_ATTR_INVALID: Invalid
7037+
*
7038+
* @NL80211_FILS_DISCOVERY_ATTR_INT_MIN: Minimum packet interval (u32, TU).
7039+
* Allowed range: 0..10000 (TU = Time Unit)
7040+
* @NL80211_FILS_DISCOVERY_ATTR_INT_MAX: Maximum packet interval (u32, TU).
7041+
* Allowed range: 0..10000 (TU = Time Unit)
7042+
* @NL80211_FILS_DISCOVERY_ATTR_TMPL: Template data for FILS discovery action
7043+
* frame including the headers.
7044+
*
7045+
* @__NL80211_FILS_DISCOVERY_ATTR_LAST: Internal
7046+
* @NL80211_FILS_DISCOVERY_ATTR_MAX: highest attribute
7047+
*/
7048+
enum nl80211_fils_discovery_attributes {
7049+
__NL80211_FILS_DISCOVERY_ATTR_INVALID,
7050+
7051+
NL80211_FILS_DISCOVERY_ATTR_INT_MIN,
7052+
NL80211_FILS_DISCOVERY_ATTR_INT_MAX,
7053+
NL80211_FILS_DISCOVERY_ATTR_TMPL,
7054+
7055+
/* keep last */
7056+
__NL80211_FILS_DISCOVERY_ATTR_LAST,
7057+
NL80211_FILS_DISCOVERY_ATTR_MAX = __NL80211_FILS_DISCOVERY_ATTR_LAST - 1
7058+
};
7059+
7060+
/*
7061+
* FILS discovery template minimum length with action frame headers and
7062+
* mandatory fields.
7063+
*/
7064+
#define NL80211_FILS_DISCOVERY_TMPL_MIN_LEN 42
7065+
70227066
#endif /* __LINUX_NL80211_H */

‎net/wireless/nl80211.c‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,15 @@ nl80211_tid_config_attr_policy[NL80211_TID_CONFIG_ATTR_MAX + 1] = {
376376
NLA_POLICY_NESTED(nl80211_txattr_policy),
377377
};
378378

379+
static const struct nla_policy
380+
nl80211_fils_discovery_policy[NL80211_FILS_DISCOVERY_ATTR_MAX + 1] = {
381+
[NL80211_FILS_DISCOVERY_ATTR_INT_MIN] = NLA_POLICY_MAX(NLA_U32, 10000),
382+
[NL80211_FILS_DISCOVERY_ATTR_INT_MAX] = NLA_POLICY_MAX(NLA_U32, 10000),
383+
NLA_POLICY_RANGE(NLA_BINARY,
384+
NL80211_FILS_DISCOVERY_TMPL_MIN_LEN,
385+
IEEE80211_MAX_DATA_LEN),
386+
};
387+
379388
static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
380389
[0] = { .strict_start_type = NL80211_ATTR_HE_OBSS_PD },
381390
[NL80211_ATTR_WIPHY] = { .type = NLA_U32 },
@@ -684,6 +693,8 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
684693
[NL80211_ATTR_SCAN_FREQ_KHZ] = { .type = NLA_NESTED },
685694
[NL80211_ATTR_HE_6GHZ_CAPABILITY] =
686695
NLA_POLICY_EXACT_LEN(sizeof(struct ieee80211_he_6ghz_capa)),
696+
[NL80211_ATTR_FILS_DISCOVERY] =
697+
NLA_POLICY_NESTED(nl80211_fils_discovery_policy),
687698
};
688699

689700
/* policy for the key attributes */
@@ -4874,6 +4885,36 @@ static int nl80211_parse_he_bss_color(struct nlattr *attrs,
48744885
return 0;
48754886
}
48764887

4888+
static int nl80211_parse_fils_discovery(struct cfg80211_registered_device *rdev,
4889+
struct nlattr *attrs,
4890+
struct cfg80211_ap_settings *params)
4891+
{
4892+
struct nlattr *tb[NL80211_FILS_DISCOVERY_ATTR_MAX + 1];
4893+
int ret;
4894+
struct cfg80211_fils_discovery *fd = &params->fils_discovery;
4895+
4896+
if (!wiphy_ext_feature_isset(&rdev->wiphy,
4897+
NL80211_EXT_FEATURE_FILS_DISCOVERY))
4898+
return -EINVAL;
4899+
4900+
ret = nla_parse_nested(tb, NL80211_FILS_DISCOVERY_ATTR_MAX, attrs,
4901+
NULL, NULL);
4902+
if (ret)
4903+
return ret;
4904+
4905+
if (!tb[NL80211_FILS_DISCOVERY_ATTR_INT_MIN] ||
4906+
!tb[NL80211_FILS_DISCOVERY_ATTR_INT_MAX] ||
4907+
!tb[NL80211_FILS_DISCOVERY_ATTR_TMPL])
4908+
return -EINVAL;
4909+
4910+
fd->tmpl_len = nla_len(tb[NL80211_FILS_DISCOVERY_ATTR_TMPL]);
4911+
fd->tmpl = nla_data(tb[NL80211_FILS_DISCOVERY_ATTR_TMPL]);
4912+
fd->min_interval = nla_get_u32(tb[NL80211_FILS_DISCOVERY_ATTR_INT_MIN]);
4913+
fd->max_interval = nla_get_u32(tb[NL80211_FILS_DISCOVERY_ATTR_INT_MAX]);
4914+
4915+
return 0;
4916+
}
4917+
48774918
static void nl80211_check_ap_rate_selectors(struct cfg80211_ap_settings *params,
48784919
const u8 *rates)
48794920
{
@@ -5182,6 +5223,14 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
51825223
goto out;
51835224
}
51845225

5226+
if (info->attrs[NL80211_ATTR_FILS_DISCOVERY]) {
5227+
err = nl80211_parse_fils_discovery(rdev,
5228+
info->attrs[NL80211_ATTR_FILS_DISCOVERY],
5229+
&params);
5230+
if (err)
5231+
goto out;
5232+
}
5233+
51855234
nl80211_calculate_ap_params(&params);
51865235

51875236
if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])

0 commit comments

Comments
 (0)