Commit 7f9a3e15 authored by Vidyullatha Kanchanapally's avatar Vidyullatha Kanchanapally Committed by Johannes Berg

nl80211: Update ERP info using NL80211_CMD_UPDATE_CONNECT_PARAMS

Use NL80211_CMD_UPDATE_CONNECT_PARAMS to update new ERP information,
Association IEs and the Authentication type to driver / firmware which
will be used in subsequent roamings.
Signed-off-by: default avatarVidyullatha Kanchanapally <vidyullatha@codeaurora.org>
[arend: extended fils-sk kernel doc and added check in wiphy_register()]
Reviewed-by: default avatarJithu Jance <jithu.jance@broadcom.com>
Reviewed-by: default avatarEylon Pedinovsky <eylon.pedinovsky@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent e841b7b1
...@@ -2225,9 +2225,14 @@ struct cfg80211_connect_params { ...@@ -2225,9 +2225,14 @@ struct cfg80211_connect_params {
* have to be updated as part of update_connect_params() call. * have to be updated as part of update_connect_params() call.
* *
* @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
* @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
* username, erp sequence number and rrk) are updated
* @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
*/ */
enum cfg80211_connect_params_changed { enum cfg80211_connect_params_changed {
UPDATE_ASSOC_IES = BIT(0), UPDATE_ASSOC_IES = BIT(0),
UPDATE_FILS_ERP_INFO = BIT(1),
UPDATE_AUTH_TYPE = BIT(2),
}; };
/** /**
......
...@@ -204,7 +204,8 @@ ...@@ -204,7 +204,8 @@
* FILS shared key authentication offload should be able to construct the * FILS shared key authentication offload should be able to construct the
* authentication and association frames for FILS shared key authentication and * authentication and association frames for FILS shared key authentication and
* eventually do a key derivation as per IEEE 802.11ai. The below additional * eventually do a key derivation as per IEEE 802.11ai. The below additional
* parameters should be given to driver in %NL80211_CMD_CONNECT. * parameters should be given to driver in %NL80211_CMD_CONNECT and/or in
* %NL80211_CMD_UPDATE_CONNECT_PARAMS.
* %NL80211_ATTR_FILS_ERP_USERNAME - used to construct keyname_nai * %NL80211_ATTR_FILS_ERP_USERNAME - used to construct keyname_nai
* %NL80211_ATTR_FILS_ERP_REALM - used to construct keyname_nai * %NL80211_ATTR_FILS_ERP_REALM - used to construct keyname_nai
* %NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM - used to construct erp message * %NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM - used to construct erp message
......
...@@ -725,6 +725,10 @@ int wiphy_register(struct wiphy *wiphy) ...@@ -725,6 +725,10 @@ int wiphy_register(struct wiphy *wiphy)
(!rdev->ops->set_pmk || !rdev->ops->del_pmk))) (!rdev->ops->set_pmk || !rdev->ops->del_pmk)))
return -EINVAL; return -EINVAL;
if (WARN_ON(!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_FW_ROAM) &&
rdev->ops->update_connect_params))
return -EINVAL;
if (wiphy->addresses) if (wiphy->addresses)
memcpy(wiphy->perm_addr, wiphy->addresses[0].addr, ETH_ALEN); memcpy(wiphy->perm_addr, wiphy->addresses[0].addr, ETH_ALEN);
......
...@@ -9429,6 +9429,8 @@ static int nl80211_update_connect_params(struct sk_buff *skb, ...@@ -9429,6 +9429,8 @@ static int nl80211_update_connect_params(struct sk_buff *skb,
struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct cfg80211_registered_device *rdev = info->user_ptr[0];
struct net_device *dev = info->user_ptr[1]; struct net_device *dev = info->user_ptr[1];
struct wireless_dev *wdev = dev->ieee80211_ptr; struct wireless_dev *wdev = dev->ieee80211_ptr;
bool fils_sk_offload;
u32 auth_type;
u32 changed = 0; u32 changed = 0;
int ret; int ret;
...@@ -9443,6 +9445,56 @@ static int nl80211_update_connect_params(struct sk_buff *skb, ...@@ -9443,6 +9445,56 @@ static int nl80211_update_connect_params(struct sk_buff *skb,
changed |= UPDATE_ASSOC_IES; changed |= UPDATE_ASSOC_IES;
} }
fils_sk_offload = wiphy_ext_feature_isset(&rdev->wiphy,
NL80211_EXT_FEATURE_FILS_SK_OFFLOAD);
/*
* when driver supports fils-sk offload all attributes must be
* provided. So the else covers "fils-sk-not-all" and
* "no-fils-sk-any".
*/
if (fils_sk_offload &&
info->attrs[NL80211_ATTR_FILS_ERP_USERNAME] &&
info->attrs[NL80211_ATTR_FILS_ERP_REALM] &&
info->attrs[NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM] &&
info->attrs[NL80211_ATTR_FILS_ERP_RRK]) {
connect.fils_erp_username =
nla_data(info->attrs[NL80211_ATTR_FILS_ERP_USERNAME]);
connect.fils_erp_username_len =
nla_len(info->attrs[NL80211_ATTR_FILS_ERP_USERNAME]);
connect.fils_erp_realm =
nla_data(info->attrs[NL80211_ATTR_FILS_ERP_REALM]);
connect.fils_erp_realm_len =
nla_len(info->attrs[NL80211_ATTR_FILS_ERP_REALM]);
connect.fils_erp_next_seq_num =
nla_get_u16(
info->attrs[NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM]);
connect.fils_erp_rrk =
nla_data(info->attrs[NL80211_ATTR_FILS_ERP_RRK]);
connect.fils_erp_rrk_len =
nla_len(info->attrs[NL80211_ATTR_FILS_ERP_RRK]);
changed |= UPDATE_FILS_ERP_INFO;
} else if (info->attrs[NL80211_ATTR_FILS_ERP_USERNAME] ||
info->attrs[NL80211_ATTR_FILS_ERP_REALM] ||
info->attrs[NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM] ||
info->attrs[NL80211_ATTR_FILS_ERP_RRK]) {
return -EINVAL;
}
if (info->attrs[NL80211_ATTR_AUTH_TYPE]) {
auth_type = nla_get_u32(info->attrs[NL80211_ATTR_AUTH_TYPE]);
if (!nl80211_valid_auth_type(rdev, auth_type,
NL80211_CMD_CONNECT))
return -EINVAL;
if (auth_type == NL80211_AUTHTYPE_FILS_SK &&
fils_sk_offload && !(changed & UPDATE_FILS_ERP_INFO))
return -EINVAL;
connect.auth_type = auth_type;
changed |= UPDATE_AUTH_TYPE;
}
wdev_lock(dev->ieee80211_ptr); wdev_lock(dev->ieee80211_ptr);
if (!wdev->current_bss) if (!wdev->current_bss)
ret = -ENOLINK; ret = -ENOLINK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment