summaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorSrinivas Dasari <dasaris@codeaurora.org>2019-01-23 07:36:56 -0500
committerJohannes Berg <johannes.berg@intel.com>2019-01-25 15:08:05 -0500
commitfe4943702c850fa07f963eaa6f1530d9d4c2da78 (patch)
tree79fceee9004e3669d2c97a8906c63ef0e8fa4dac /net/wireless
parentab4dfa20534e32e48de6b761b42d943518fb26f7 (diff)
cfg80211: Authentication offload to user space in AP mode
commit 40cbfa90218b ("cfg80211/nl80211: Optional authentication offload to userspace")' introduced authentication offload to user space by the host drivers in station mode. This commit extends the same for the AP mode too. Extend NL80211_ATTR_EXTERNAL_AUTH_SUPPORT to also claim the support of external authentication from the user space in AP mode. A new flag parameter is introduced in cfg80211_ap_settings to intend the same while "start ap". Host driver to use NL80211_CMD_FRAME interface to transmit and receive the authentication frames to / from the user space. Host driver to indicate the flag NL80211_RXMGMT_FLAG_EXTERNAL_AUTH while sending the authentication frame to the user space. This intends to the user space that the driver wishes it to process the authentication frame for certain protocols, though it had initially advertised the support for SME functionality. User space shall accordingly do the authentication and indicate its final status through the command NL80211_CMD_EXTERNAL_AUTH. Allow the command even if userspace doesn't include the attribute NL80211_ATTR_SSID for AP interface. Host driver shall continue with the association sequence and indicate the STA connection status through cfg80211_new_sta. To facilitate the host drivers in AP mode for matching the pmkid by the stations during the association, NL80211_CMD_EXTERNAL_AUTH is also enhanced to include the pmkid to drivers after the authentication. This pmkid can also be used in the STA mode to include in the association request. Also modify nl80211_external_auth to not mandate SSID in AP mode. Signed-off-by: Srinivas Dasari <dasaris@codeaurora.org> [remove useless nla_get_flag() usage] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/nl80211.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index eb4437fa0539..dc96077afe5e 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4550,6 +4550,9 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
4550 4550
4551 nl80211_calculate_ap_params(&params); 4551 nl80211_calculate_ap_params(&params);
4552 4552
4553 if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])
4554 params.flags |= AP_SETTINGS_EXTERNAL_AUTH_SUPPORT;
4555
4553 wdev_lock(wdev); 4556 wdev_lock(wdev);
4554 err = rdev_start_ap(rdev, dev, &params); 4557 err = rdev_start_ap(rdev, dev, &params);
4555 if (!err) { 4558 if (!err) {
@@ -13086,7 +13089,9 @@ static int nl80211_external_auth(struct sk_buff *skb, struct genl_info *info)
13086 if (!rdev->ops->external_auth) 13089 if (!rdev->ops->external_auth)
13087 return -EOPNOTSUPP; 13090 return -EOPNOTSUPP;
13088 13091
13089 if (!info->attrs[NL80211_ATTR_SSID]) 13092 if (!info->attrs[NL80211_ATTR_SSID] &&
13093 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
13094 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
13090 return -EINVAL; 13095 return -EINVAL;
13091 13096
13092 if (!info->attrs[NL80211_ATTR_BSSID]) 13097 if (!info->attrs[NL80211_ATTR_BSSID])
@@ -13097,18 +13102,24 @@ static int nl80211_external_auth(struct sk_buff *skb, struct genl_info *info)
13097 13102
13098 memset(&params, 0, sizeof(params)); 13103 memset(&params, 0, sizeof(params));
13099 13104
13100 params.ssid.ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); 13105 if (info->attrs[NL80211_ATTR_SSID]) {
13101 if (params.ssid.ssid_len == 0 || 13106 params.ssid.ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]);
13102 params.ssid.ssid_len > IEEE80211_MAX_SSID_LEN) 13107 if (params.ssid.ssid_len == 0 ||
13103 return -EINVAL; 13108 params.ssid.ssid_len > IEEE80211_MAX_SSID_LEN)
13104 memcpy(params.ssid.ssid, nla_data(info->attrs[NL80211_ATTR_SSID]), 13109 return -EINVAL;
13105 params.ssid.ssid_len); 13110 memcpy(params.ssid.ssid,
13111 nla_data(info->attrs[NL80211_ATTR_SSID]),
13112 params.ssid.ssid_len);
13113 }
13106 13114
13107 memcpy(params.bssid, nla_data(info->attrs[NL80211_ATTR_BSSID]), 13115 memcpy(params.bssid, nla_data(info->attrs[NL80211_ATTR_BSSID]),
13108 ETH_ALEN); 13116 ETH_ALEN);
13109 13117
13110 params.status = nla_get_u16(info->attrs[NL80211_ATTR_STATUS_CODE]); 13118 params.status = nla_get_u16(info->attrs[NL80211_ATTR_STATUS_CODE]);
13111 13119
13120 if (info->attrs[NL80211_ATTR_PMKID])
13121 params.pmkid = nla_data(info->attrs[NL80211_ATTR_PMKID]);
13122
13112 return rdev_external_auth(rdev, dev, &params); 13123 return rdev_external_auth(rdev, dev, &params);
13113} 13124}
13114 13125