Lines Matching +full:assoc +full:- +full:select
1 // SPDX-License-Identifier: GPL-2.0
8 * Copyright (C) 2009, 2020, 2022-2024 Intel Corporation. All rights reserved.
23 #include "rdev-ops.h"
26 * Software SME in cfg80211, using auth/assoc/deauth calls to the
33 /* these are sub-states of the _CONNECTING sme_state */
56 if (!wdev->conn) in cfg80211_sme_free()
59 kfree(wdev->conn->ie); in cfg80211_sme_free()
60 kfree(wdev->conn); in cfg80211_sme_free()
61 wdev->conn = NULL; in cfg80211_sme_free()
66 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_conn_scan()
70 lockdep_assert_wiphy(wdev->wiphy); in cfg80211_conn_scan()
72 if (rdev->scan_req || rdev->scan_msg) in cfg80211_conn_scan()
73 return -EBUSY; in cfg80211_conn_scan()
75 if (wdev->conn->params.channel) in cfg80211_conn_scan()
78 n_channels = ieee80211_get_num_supported_channels(wdev->wiphy); in cfg80211_conn_scan()
80 request = kzalloc(sizeof(*request) + sizeof(request->ssids[0]) + in cfg80211_conn_scan()
81 sizeof(request->channels[0]) * n_channels, in cfg80211_conn_scan()
84 return -ENOMEM; in cfg80211_conn_scan()
86 if (wdev->conn->params.channel) { in cfg80211_conn_scan()
87 enum nl80211_band band = wdev->conn->params.channel->band; in cfg80211_conn_scan()
89 wdev->wiphy->bands[band]; in cfg80211_conn_scan()
93 return -EINVAL; in cfg80211_conn_scan()
95 request->channels[0] = wdev->conn->params.channel; in cfg80211_conn_scan()
96 request->rates[band] = (1 << sband->n_bitrates) - 1; in cfg80211_conn_scan()
104 bands = wdev->wiphy->bands[band]; in cfg80211_conn_scan()
107 for (j = 0; j < bands->n_channels; j++) { in cfg80211_conn_scan()
108 channel = &bands->channels[j]; in cfg80211_conn_scan()
109 if (channel->flags & IEEE80211_CHAN_DISABLED) in cfg80211_conn_scan()
111 request->channels[i++] = channel; in cfg80211_conn_scan()
113 request->rates[band] = (1 << bands->n_bitrates) - 1; in cfg80211_conn_scan()
117 request->n_channels = n_channels; in cfg80211_conn_scan()
118 request->ssids = (void *)request + in cfg80211_conn_scan()
120 request->n_ssids = 1; in cfg80211_conn_scan()
122 memcpy(request->ssids[0].ssid, wdev->conn->params.ssid, in cfg80211_conn_scan()
123 wdev->conn->params.ssid_len); in cfg80211_conn_scan()
124 request->ssids[0].ssid_len = wdev->conn->params.ssid_len; in cfg80211_conn_scan()
126 eth_broadcast_addr(request->bssid); in cfg80211_conn_scan()
128 request->wdev = wdev; in cfg80211_conn_scan()
129 request->wiphy = &rdev->wiphy; in cfg80211_conn_scan()
130 request->scan_start = jiffies; in cfg80211_conn_scan()
132 rdev->scan_req = request; in cfg80211_conn_scan()
136 wdev->conn->state = CFG80211_CONN_SCANNING; in cfg80211_conn_scan()
138 dev_hold(wdev->netdev); in cfg80211_conn_scan()
140 rdev->scan_req = NULL; in cfg80211_conn_scan()
149 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_conn_do_work()
155 lockdep_assert_wiphy(wdev->wiphy); in cfg80211_conn_do_work()
157 if (!wdev->conn) in cfg80211_conn_do_work()
160 params = &wdev->conn->params; in cfg80211_conn_do_work()
162 switch (wdev->conn->state) { in cfg80211_conn_do_work()
165 return -ENOENT; in cfg80211_conn_do_work()
169 if (WARN_ON(!rdev->ops->auth)) in cfg80211_conn_do_work()
170 return -EOPNOTSUPP; in cfg80211_conn_do_work()
171 wdev->conn->state = CFG80211_CONN_AUTHENTICATING; in cfg80211_conn_do_work()
172 auth_req.key = params->key; in cfg80211_conn_do_work()
173 auth_req.key_len = params->key_len; in cfg80211_conn_do_work()
174 auth_req.key_idx = params->key_idx; in cfg80211_conn_do_work()
175 auth_req.auth_type = params->auth_type; in cfg80211_conn_do_work()
176 auth_req.bss = cfg80211_get_bss(&rdev->wiphy, params->channel, in cfg80211_conn_do_work()
177 params->bssid, in cfg80211_conn_do_work()
178 params->ssid, params->ssid_len, in cfg80211_conn_do_work()
181 auth_req.link_id = -1; in cfg80211_conn_do_work()
182 err = cfg80211_mlme_auth(rdev, wdev->netdev, &auth_req); in cfg80211_conn_do_work()
183 cfg80211_put_bss(&rdev->wiphy, auth_req.bss); in cfg80211_conn_do_work()
187 return -ENOTCONN; in cfg80211_conn_do_work()
189 if (WARN_ON(!rdev->ops->assoc)) in cfg80211_conn_do_work()
190 return -EOPNOTSUPP; in cfg80211_conn_do_work()
191 wdev->conn->state = CFG80211_CONN_ASSOCIATING; in cfg80211_conn_do_work()
192 if (wdev->conn->prev_bssid_valid) in cfg80211_conn_do_work()
193 req.prev_bssid = wdev->conn->prev_bssid; in cfg80211_conn_do_work()
194 req.ie = params->ie; in cfg80211_conn_do_work()
195 req.ie_len = params->ie_len; in cfg80211_conn_do_work()
196 req.use_mfp = params->mfp != NL80211_MFP_NO; in cfg80211_conn_do_work()
197 req.crypto = params->crypto; in cfg80211_conn_do_work()
198 req.flags = params->flags; in cfg80211_conn_do_work()
199 req.ht_capa = params->ht_capa; in cfg80211_conn_do_work()
200 req.ht_capa_mask = params->ht_capa_mask; in cfg80211_conn_do_work()
201 req.vht_capa = params->vht_capa; in cfg80211_conn_do_work()
202 req.vht_capa_mask = params->vht_capa_mask; in cfg80211_conn_do_work()
203 req.link_id = -1; in cfg80211_conn_do_work()
205 req.bss = cfg80211_get_bss(&rdev->wiphy, params->channel, in cfg80211_conn_do_work()
206 params->bssid, in cfg80211_conn_do_work()
207 params->ssid, params->ssid_len, in cfg80211_conn_do_work()
211 err = -ENOENT; in cfg80211_conn_do_work()
213 err = cfg80211_mlme_assoc(rdev, wdev->netdev, in cfg80211_conn_do_work()
215 cfg80211_put_bss(&rdev->wiphy, req.bss); in cfg80211_conn_do_work()
219 cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid, in cfg80211_conn_do_work()
228 cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid, in cfg80211_conn_do_work()
231 return -ENOTCONN; in cfg80211_conn_do_work()
233 cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid, in cfg80211_conn_do_work()
254 wiphy_lock(&rdev->wiphy); in cfg80211_conn_work()
256 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { in cfg80211_conn_work()
257 if (!wdev->netdev) in cfg80211_conn_work()
260 if (!netif_running(wdev->netdev)) in cfg80211_conn_work()
263 if (!wdev->conn || in cfg80211_conn_work()
264 wdev->conn->state == CFG80211_CONN_CONNECTED) in cfg80211_conn_work()
267 if (wdev->conn->params.bssid) { in cfg80211_conn_work()
268 memcpy(bssid_buf, wdev->conn->params.bssid, ETH_ALEN); in cfg80211_conn_work()
276 cr.status = -1; in cfg80211_conn_work()
279 __cfg80211_connect_result(wdev->netdev, &cr, false); in cfg80211_conn_work()
283 wiphy_unlock(&rdev->wiphy); in cfg80211_conn_work()
289 memcpy(conn->bssid, bss->bssid, ETH_ALEN); in cfg80211_step_auth_next()
290 conn->params.bssid = conn->bssid; in cfg80211_step_auth_next()
291 conn->params.channel = bss->channel; in cfg80211_step_auth_next()
292 conn->state = CFG80211_CONN_AUTHENTICATE_NEXT; in cfg80211_step_auth_next()
298 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_get_conn_bss()
301 lockdep_assert_wiphy(wdev->wiphy); in cfg80211_get_conn_bss()
303 bss = cfg80211_get_bss(wdev->wiphy, wdev->conn->params.channel, in cfg80211_get_conn_bss()
304 wdev->conn->params.bssid, in cfg80211_get_conn_bss()
305 wdev->conn->params.ssid, in cfg80211_get_conn_bss()
306 wdev->conn->params.ssid_len, in cfg80211_get_conn_bss()
307 wdev->conn_bss_type, in cfg80211_get_conn_bss()
308 IEEE80211_PRIVACY(wdev->conn->params.privacy)); in cfg80211_get_conn_bss()
312 cfg80211_step_auth_next(wdev->conn, bss); in cfg80211_get_conn_bss()
313 schedule_work(&rdev->conn_work); in cfg80211_get_conn_bss()
320 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_sme_scan_done()
321 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_sme_scan_done()
324 lockdep_assert_wiphy(wdev->wiphy); in cfg80211_sme_scan_done()
326 if (!wdev->conn) in cfg80211_sme_scan_done()
329 if (wdev->conn->state != CFG80211_CONN_SCANNING && in cfg80211_sme_scan_done()
330 wdev->conn->state != CFG80211_CONN_SCAN_AGAIN) in cfg80211_sme_scan_done()
335 cfg80211_put_bss(&rdev->wiphy, bss); in cfg80211_sme_scan_done()
337 schedule_work(&rdev->conn_work); in cfg80211_sme_scan_done()
342 struct wiphy *wiphy = wdev->wiphy; in cfg80211_sme_rx_auth()
345 u16 status_code = le16_to_cpu(mgmt->u.auth.status_code); in cfg80211_sme_rx_auth()
347 lockdep_assert_wiphy(wdev->wiphy); in cfg80211_sme_rx_auth()
349 if (!wdev->conn || wdev->conn->state == CFG80211_CONN_CONNECTED) in cfg80211_sme_rx_auth()
353 wdev->conn->auto_auth && in cfg80211_sme_rx_auth()
354 wdev->conn->params.auth_type != NL80211_AUTHTYPE_NETWORK_EAP) { in cfg80211_sme_rx_auth()
355 /* select automatically between only open, shared, leap */ in cfg80211_sme_rx_auth()
356 switch (wdev->conn->params.auth_type) { in cfg80211_sme_rx_auth()
358 if (wdev->connect_keys) in cfg80211_sme_rx_auth()
359 wdev->conn->params.auth_type = in cfg80211_sme_rx_auth()
362 wdev->conn->params.auth_type = in cfg80211_sme_rx_auth()
366 wdev->conn->params.auth_type = in cfg80211_sme_rx_auth()
371 wdev->conn->params.auth_type = in cfg80211_sme_rx_auth()
375 wdev->conn->state = CFG80211_CONN_AUTHENTICATE_NEXT; in cfg80211_sme_rx_auth()
376 schedule_work(&rdev->conn_work); in cfg80211_sme_rx_auth()
382 cr.links[0].bssid = mgmt->bssid; in cfg80211_sme_rx_auth()
384 __cfg80211_connect_result(wdev->netdev, &cr, false); in cfg80211_sme_rx_auth()
385 } else if (wdev->conn->state == CFG80211_CONN_AUTHENTICATING) { in cfg80211_sme_rx_auth()
386 wdev->conn->state = CFG80211_CONN_ASSOCIATE_NEXT; in cfg80211_sme_rx_auth()
387 schedule_work(&rdev->conn_work); in cfg80211_sme_rx_auth()
393 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_sme_rx_assoc_resp()
395 if (!wdev->conn) in cfg80211_sme_rx_assoc_resp()
399 wdev->conn->state = CFG80211_CONN_CONNECTED; in cfg80211_sme_rx_assoc_resp()
403 if (wdev->conn->prev_bssid_valid) { in cfg80211_sme_rx_assoc_resp()
406 * need to fall back to trying regular assoc; in cfg80211_sme_rx_assoc_resp()
409 wdev->conn->prev_bssid_valid = false; in cfg80211_sme_rx_assoc_resp()
410 wdev->conn->state = CFG80211_CONN_ASSOCIATE_NEXT; in cfg80211_sme_rx_assoc_resp()
411 schedule_work(&rdev->conn_work); in cfg80211_sme_rx_assoc_resp()
415 wdev->conn->state = CFG80211_CONN_ASSOC_FAILED; in cfg80211_sme_rx_assoc_resp()
416 schedule_work(&rdev->conn_work); in cfg80211_sme_rx_assoc_resp()
427 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_sme_auth_timeout()
429 if (!wdev->conn) in cfg80211_sme_auth_timeout()
432 wdev->conn->state = CFG80211_CONN_AUTH_FAILED_TIMEOUT; in cfg80211_sme_auth_timeout()
433 schedule_work(&rdev->conn_work); in cfg80211_sme_auth_timeout()
438 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_sme_disassoc()
440 if (!wdev->conn) in cfg80211_sme_disassoc()
443 wdev->conn->state = CFG80211_CONN_DEAUTH; in cfg80211_sme_disassoc()
444 schedule_work(&rdev->conn_work); in cfg80211_sme_disassoc()
449 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_sme_assoc_timeout()
451 if (!wdev->conn) in cfg80211_sme_assoc_timeout()
454 wdev->conn->state = CFG80211_CONN_ASSOC_FAILED_TIMEOUT; in cfg80211_sme_assoc_timeout()
455 schedule_work(&rdev->conn_work); in cfg80211_sme_assoc_timeout()
460 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_sme_abandon_assoc()
462 if (!wdev->conn) in cfg80211_sme_abandon_assoc()
465 wdev->conn->state = CFG80211_CONN_ABANDON; in cfg80211_sme_abandon_assoc()
466 schedule_work(&rdev->conn_work); in cfg80211_sme_abandon_assoc()
474 if (!wdev->links[link].client.current_bss) in cfg80211_wdev_release_bsses()
476 cfg80211_unhold_bss(wdev->links[link].client.current_bss); in cfg80211_wdev_release_bsses()
477 cfg80211_put_bss(wdev->wiphy, in cfg80211_wdev_release_bsses()
478 &wdev->links[link].client.current_bss->pub); in cfg80211_wdev_release_bsses()
479 wdev->links[link].client.current_bss = NULL; in cfg80211_wdev_release_bsses()
488 if (!wdev->links[link].client.current_bss || in cfg80211_wdev_release_link_bsses()
491 cfg80211_unhold_bss(wdev->links[link].client.current_bss); in cfg80211_wdev_release_link_bsses()
492 cfg80211_put_bss(wdev->wiphy, in cfg80211_wdev_release_link_bsses()
493 &wdev->links[link].client.current_bss->pub); in cfg80211_wdev_release_link_bsses()
494 wdev->links[link].client.current_bss = NULL; in cfg80211_wdev_release_link_bsses()
502 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_sme_get_conn_ies()
506 if (!rdev->wiphy.extended_capabilities_len || in cfg80211_sme_get_conn_ies()
510 return -ENOMEM; in cfg80211_sme_get_conn_ies()
515 buf = kmalloc(ies_len + rdev->wiphy.extended_capabilities_len + 2, in cfg80211_sme_get_conn_ies()
518 return -ENOMEM; in cfg80211_sme_get_conn_ies()
535 memcpy(buf + offs + rdev->wiphy.extended_capabilities_len + 2, in cfg80211_sme_get_conn_ies()
536 ies + offs, ies_len - offs); in cfg80211_sme_get_conn_ies()
543 buf[offs + 1] = rdev->wiphy.extended_capabilities_len; in cfg80211_sme_get_conn_ies()
545 rdev->wiphy.extended_capabilities, in cfg80211_sme_get_conn_ies()
546 rdev->wiphy.extended_capabilities_len); in cfg80211_sme_get_conn_ies()
549 *out_ies_len = ies_len + rdev->wiphy.extended_capabilities_len + 2; in cfg80211_sme_get_conn_ies()
558 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_sme_connect()
562 if (!rdev->ops->auth || !rdev->ops->assoc) in cfg80211_sme_connect()
563 return -EOPNOTSUPP; in cfg80211_sme_connect()
567 if (wdev->connected) { in cfg80211_sme_connect()
569 wdev->connected = false; in cfg80211_sme_connect()
572 if (wdev->conn) in cfg80211_sme_connect()
573 return -EINPROGRESS; in cfg80211_sme_connect()
575 wdev->conn = kzalloc(sizeof(*wdev->conn), GFP_KERNEL); in cfg80211_sme_connect()
576 if (!wdev->conn) in cfg80211_sme_connect()
577 return -ENOMEM; in cfg80211_sme_connect()
582 memcpy(&wdev->conn->params, connect, sizeof(*connect)); in cfg80211_sme_connect()
583 if (connect->bssid) { in cfg80211_sme_connect()
584 wdev->conn->params.bssid = wdev->conn->bssid; in cfg80211_sme_connect()
585 memcpy(wdev->conn->bssid, connect->bssid, ETH_ALEN); in cfg80211_sme_connect()
588 if (cfg80211_sme_get_conn_ies(wdev, connect->ie, connect->ie_len, in cfg80211_sme_connect()
589 &wdev->conn->ie, in cfg80211_sme_connect()
590 &wdev->conn->params.ie_len)) { in cfg80211_sme_connect()
591 kfree(wdev->conn); in cfg80211_sme_connect()
592 wdev->conn = NULL; in cfg80211_sme_connect()
593 return -ENOMEM; in cfg80211_sme_connect()
595 wdev->conn->params.ie = wdev->conn->ie; in cfg80211_sme_connect()
597 if (connect->auth_type == NL80211_AUTHTYPE_AUTOMATIC) { in cfg80211_sme_connect()
598 wdev->conn->auto_auth = true; in cfg80211_sme_connect()
600 wdev->conn->params.auth_type = in cfg80211_sme_connect()
603 wdev->conn->auto_auth = false; in cfg80211_sme_connect()
606 wdev->conn->params.ssid = wdev->u.client.ssid; in cfg80211_sme_connect()
607 wdev->conn->params.ssid_len = wdev->u.client.ssid_len; in cfg80211_sme_connect()
610 bss = cfg80211_get_bss(wdev->wiphy, wdev->conn->params.channel, in cfg80211_sme_connect()
611 wdev->conn->params.bssid, in cfg80211_sme_connect()
612 wdev->conn->params.ssid, in cfg80211_sme_connect()
613 wdev->conn->params.ssid_len, in cfg80211_sme_connect()
614 wdev->conn_bss_type, in cfg80211_sme_connect()
615 IEEE80211_PRIVACY(wdev->conn->params.privacy)); in cfg80211_sme_connect()
618 memcpy(wdev->conn->prev_bssid, prev_bssid, ETH_ALEN); in cfg80211_sme_connect()
619 wdev->conn->prev_bssid_valid = true; in cfg80211_sme_connect()
626 cfg80211_step_auth_next(wdev->conn, bss); in cfg80211_sme_connect()
628 cfg80211_put_bss(wdev->wiphy, bss); in cfg80211_sme_connect()
638 if (err == -EBUSY) { in cfg80211_sme_connect()
640 wdev->conn->state = CFG80211_CONN_SCAN_AGAIN; in cfg80211_sme_connect()
652 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_sme_disconnect()
655 if (!wdev->conn) in cfg80211_sme_disconnect()
658 if (!rdev->ops->deauth) in cfg80211_sme_disconnect()
659 return -EOPNOTSUPP; in cfg80211_sme_disconnect()
661 if (wdev->conn->state == CFG80211_CONN_SCANNING || in cfg80211_sme_disconnect()
662 wdev->conn->state == CFG80211_CONN_SCAN_AGAIN) { in cfg80211_sme_disconnect()
667 /* wdev->conn->params.bssid must be set if > SCANNING */ in cfg80211_sme_disconnect()
668 err = cfg80211_mlme_deauth(rdev, wdev->netdev, in cfg80211_sme_disconnect()
669 wdev->conn->params.bssid, in cfg80211_sme_disconnect()
677 * code shared for in-device and software SME
695 wiphy_lock(&rdev->wiphy); in cfg80211_is_all_idle()
696 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { in cfg80211_is_all_idle()
697 if (wdev->conn || wdev->connected || in cfg80211_is_all_idle()
701 wiphy_unlock(&rdev->wiphy); in cfg80211_is_all_idle()
724 if (!cr->links[link].bss) in cfg80211_connect_result_release_bsses()
726 cfg80211_unhold_bss(bss_from_pub(cr->links[link].bss)); in cfg80211_connect_result_release_bsses()
727 cfg80211_put_bss(wdev->wiphy, cr->links[link].bss); in cfg80211_connect_result_release_bsses()
741 struct wireless_dev *wdev = dev->ieee80211_ptr; in __cfg80211_connect_result()
753 lockdep_assert_wiphy(wdev->wiphy); in __cfg80211_connect_result()
755 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION && in __cfg80211_connect_result()
756 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)) in __cfg80211_connect_result()
759 if (cr->valid_links) { in __cfg80211_connect_result()
760 if (WARN_ON(!cr->ap_mld_addr)) in __cfg80211_connect_result()
764 if (WARN_ON(!cr->links[link].addr)) in __cfg80211_connect_result()
768 if (WARN_ON(wdev->connect_keys)) in __cfg80211_connect_result()
772 wdev->unprot_beacon_reported = 0; in __cfg80211_connect_result()
773 nl80211_send_connect_result(wiphy_to_rdev(wdev->wiphy), dev, cr, in __cfg80211_connect_result()
775 connected_addr = cr->valid_links ? cr->ap_mld_addr : cr->links[0].bssid; in __cfg80211_connect_result()
778 if (wextev && !cr->valid_links) { in __cfg80211_connect_result()
779 if (cr->req_ie && cr->status == WLAN_STATUS_SUCCESS) { in __cfg80211_connect_result()
781 wrqu.data.length = cr->req_ie_len; in __cfg80211_connect_result()
783 cr->req_ie); in __cfg80211_connect_result()
786 if (cr->resp_ie && cr->status == WLAN_STATUS_SUCCESS) { in __cfg80211_connect_result()
788 wrqu.data.length = cr->resp_ie_len; in __cfg80211_connect_result()
790 cr->resp_ie); in __cfg80211_connect_result()
795 if (connected_addr && cr->status == WLAN_STATUS_SUCCESS) { in __cfg80211_connect_result()
797 memcpy(wdev->wext.prev_bssid, connected_addr, ETH_ALEN); in __cfg80211_connect_result()
798 wdev->wext.prev_bssid_valid = true; in __cfg80211_connect_result()
804 if (cr->status == WLAN_STATUS_SUCCESS) { in __cfg80211_connect_result()
805 if (!wiphy_to_rdev(wdev->wiphy)->ops->connect) { in __cfg80211_connect_result()
807 if (WARN_ON_ONCE(!cr->links[link].bss)) in __cfg80211_connect_result()
814 if (cr->links[link].status != WLAN_STATUS_SUCCESS) in __cfg80211_connect_result()
817 if (cr->links[link].bss) in __cfg80211_connect_result()
820 cr->links[link].bss = in __cfg80211_connect_result()
821 cfg80211_get_bss(wdev->wiphy, NULL, in __cfg80211_connect_result()
822 cr->links[link].bssid, in __cfg80211_connect_result()
823 wdev->u.client.ssid, in __cfg80211_connect_result()
824 wdev->u.client.ssid_len, in __cfg80211_connect_result()
825 wdev->conn_bss_type, in __cfg80211_connect_result()
827 if (!cr->links[link].bss) { in __cfg80211_connect_result()
831 cfg80211_hold_bss(bss_from_pub(cr->links[link].bss)); in __cfg80211_connect_result()
837 if (cr->status != WLAN_STATUS_SUCCESS) { in __cfg80211_connect_result()
838 kfree_sensitive(wdev->connect_keys); in __cfg80211_connect_result()
839 wdev->connect_keys = NULL; in __cfg80211_connect_result()
840 wdev->u.client.ssid_len = 0; in __cfg80211_connect_result()
841 wdev->conn_owner_nlportid = 0; in __cfg80211_connect_result()
852 memset(wdev->links, 0, sizeof(wdev->links)); in __cfg80211_connect_result()
854 if (cr->links[link].status == WLAN_STATUS_SUCCESS) in __cfg80211_connect_result()
856 cr->valid_links &= ~BIT(link); in __cfg80211_connect_result()
858 if (!cr->links[link].bss) in __cfg80211_connect_result()
860 cfg80211_unhold_bss(bss_from_pub(cr->links[link].bss)); in __cfg80211_connect_result()
861 cfg80211_put_bss(wdev->wiphy, cr->links[link].bss); in __cfg80211_connect_result()
863 wdev->valid_links = cr->valid_links; in __cfg80211_connect_result()
865 wdev->links[link].client.current_bss = in __cfg80211_connect_result()
866 bss_from_pub(cr->links[link].bss); in __cfg80211_connect_result()
867 wdev->connected = true; in __cfg80211_connect_result()
868 ether_addr_copy(wdev->u.client.connected_addr, connected_addr); in __cfg80211_connect_result()
869 if (cr->valid_links) { in __cfg80211_connect_result()
871 memcpy(wdev->links[link].addr, cr->links[link].addr, in __cfg80211_connect_result()
880 ieee80211_bss_get_elem(cr->links[link].bss, in __cfg80211_connect_result()
890 country_datalen = country_elem->datalen; in __cfg80211_connect_result()
891 country_data = kmemdup(country_elem->data, country_datalen, GFP_ATOMIC); in __cfg80211_connect_result()
897 regulatory_hint_country_ie(wdev->wiphy, in __cfg80211_connect_result()
898 cr->links[link].bss->channel->band, in __cfg80211_connect_result()
902 if (!wdev->u.client.ssid_len) { in __cfg80211_connect_result()
905 ssid = ieee80211_bss_get_elem(cr->links[link].bss, in __cfg80211_connect_result()
908 if (!ssid || !ssid->datalen) in __cfg80211_connect_result()
911 memcpy(wdev->u.client.ssid, ssid->data, ssid->datalen); in __cfg80211_connect_result()
912 wdev->u.client.ssid_len = ssid->datalen; in __cfg80211_connect_result()
921 cfg80211_put_bss(wdev->wiphy, cr->links[link].bss); in __cfg80211_connect_result()
927 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_update_link_bss()
934 if (list_empty(&ibss->list)) { in cfg80211_update_link_bss()
937 found = cfg80211_get_bss(wdev->wiphy, NULL, in cfg80211_update_link_bss()
938 (*bss)->bssid, in cfg80211_update_link_bss()
939 wdev->u.client.ssid, in cfg80211_update_link_bss()
940 wdev->u.client.ssid_len, in cfg80211_update_link_bss()
941 wdev->conn_bss_type, in cfg80211_update_link_bss()
959 ibss->ts); in cfg80211_update_link_bss()
962 cfg80211_put_bss(wdev->wiphy, tmp); in cfg80211_update_link_bss()
971 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_connect_done()
972 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_connect_done()
980 cfg80211_update_link_bss(wdev, ¶ms->links[link].bss); in cfg80211_connect_done()
981 link_info_size += params->links[link].bssid ? ETH_ALEN : 0; in cfg80211_connect_done()
982 link_info_size += params->links[link].addr ? ETH_ALEN : 0; in cfg80211_connect_done()
985 ev = kzalloc(sizeof(*ev) + (params->ap_mld_addr ? ETH_ALEN : 0) + in cfg80211_connect_done()
986 params->req_ie_len + params->resp_ie_len + in cfg80211_connect_done()
987 params->fils.kek_len + params->fils.pmk_len + in cfg80211_connect_done()
988 (params->fils.pmkid ? WLAN_PMKID_LEN : 0) + link_info_size, in cfg80211_connect_done()
993 cfg80211_put_bss(wdev->wiphy, in cfg80211_connect_done()
994 params->links[link].bss); in cfg80211_connect_done()
998 ev->type = EVENT_CONNECT_RESULT; in cfg80211_connect_done()
1000 if (params->ap_mld_addr) { in cfg80211_connect_done()
1001 ev->cr.ap_mld_addr = next; in cfg80211_connect_done()
1002 memcpy((void *)ev->cr.ap_mld_addr, params->ap_mld_addr, in cfg80211_connect_done()
1006 if (params->req_ie_len) { in cfg80211_connect_done()
1007 ev->cr.req_ie = next; in cfg80211_connect_done()
1008 ev->cr.req_ie_len = params->req_ie_len; in cfg80211_connect_done()
1009 memcpy((void *)ev->cr.req_ie, params->req_ie, in cfg80211_connect_done()
1010 params->req_ie_len); in cfg80211_connect_done()
1011 next += params->req_ie_len; in cfg80211_connect_done()
1013 if (params->resp_ie_len) { in cfg80211_connect_done()
1014 ev->cr.resp_ie = next; in cfg80211_connect_done()
1015 ev->cr.resp_ie_len = params->resp_ie_len; in cfg80211_connect_done()
1016 memcpy((void *)ev->cr.resp_ie, params->resp_ie, in cfg80211_connect_done()
1017 params->resp_ie_len); in cfg80211_connect_done()
1018 next += params->resp_ie_len; in cfg80211_connect_done()
1020 if (params->fils.kek_len) { in cfg80211_connect_done()
1021 ev->cr.fils.kek = next; in cfg80211_connect_done()
1022 ev->cr.fils.kek_len = params->fils.kek_len; in cfg80211_connect_done()
1023 memcpy((void *)ev->cr.fils.kek, params->fils.kek, in cfg80211_connect_done()
1024 params->fils.kek_len); in cfg80211_connect_done()
1025 next += params->fils.kek_len; in cfg80211_connect_done()
1027 if (params->fils.pmk_len) { in cfg80211_connect_done()
1028 ev->cr.fils.pmk = next; in cfg80211_connect_done()
1029 ev->cr.fils.pmk_len = params->fils.pmk_len; in cfg80211_connect_done()
1030 memcpy((void *)ev->cr.fils.pmk, params->fils.pmk, in cfg80211_connect_done()
1031 params->fils.pmk_len); in cfg80211_connect_done()
1032 next += params->fils.pmk_len; in cfg80211_connect_done()
1034 if (params->fils.pmkid) { in cfg80211_connect_done()
1035 ev->cr.fils.pmkid = next; in cfg80211_connect_done()
1036 memcpy((void *)ev->cr.fils.pmkid, params->fils.pmkid, in cfg80211_connect_done()
1040 ev->cr.fils.update_erp_next_seq_num = params->fils.update_erp_next_seq_num; in cfg80211_connect_done()
1041 if (params->fils.update_erp_next_seq_num) in cfg80211_connect_done()
1042 ev->cr.fils.erp_next_seq_num = params->fils.erp_next_seq_num; in cfg80211_connect_done()
1043 ev->cr.valid_links = params->valid_links; in cfg80211_connect_done()
1045 if (params->links[link].bss) in cfg80211_connect_done()
1047 bss_from_pub(params->links[link].bss)); in cfg80211_connect_done()
1048 ev->cr.links[link].bss = params->links[link].bss; in cfg80211_connect_done()
1049 ev->cr.links[link].status = params->links[link].status; in cfg80211_connect_done()
1051 if (params->links[link].addr) { in cfg80211_connect_done()
1052 ev->cr.links[link].addr = next; in cfg80211_connect_done()
1053 memcpy((void *)ev->cr.links[link].addr, in cfg80211_connect_done()
1054 params->links[link].addr, in cfg80211_connect_done()
1058 if (params->links[link].bssid) { in cfg80211_connect_done()
1059 ev->cr.links[link].bssid = next; in cfg80211_connect_done()
1060 memcpy((void *)ev->cr.links[link].bssid, in cfg80211_connect_done()
1061 params->links[link].bssid, in cfg80211_connect_done()
1066 ev->cr.status = params->status; in cfg80211_connect_done()
1067 ev->cr.timeout_reason = params->timeout_reason; in cfg80211_connect_done()
1069 spin_lock_irqsave(&wdev->event_lock, flags); in cfg80211_connect_done()
1070 list_add_tail(&ev->list, &wdev->event_list); in cfg80211_connect_done()
1071 spin_unlock_irqrestore(&wdev->event_lock, flags); in cfg80211_connect_done()
1072 queue_work(cfg80211_wq, &rdev->event_work); in cfg80211_connect_done()
1086 lockdep_assert_wiphy(wdev->wiphy); in __cfg80211_roamed()
1088 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION && in __cfg80211_roamed()
1089 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)) in __cfg80211_roamed()
1092 if (WARN_ON(!wdev->connected)) in __cfg80211_roamed()
1095 if (info->valid_links) { in __cfg80211_roamed()
1096 if (WARN_ON(!info->ap_mld_addr)) in __cfg80211_roamed()
1100 if (WARN_ON(!info->links[link].addr)) in __cfg80211_roamed()
1108 if (WARN_ON(!info->links[link].bss)) in __cfg80211_roamed()
1112 memset(wdev->links, 0, sizeof(wdev->links)); in __cfg80211_roamed()
1113 wdev->valid_links = info->valid_links; in __cfg80211_roamed()
1115 cfg80211_hold_bss(bss_from_pub(info->links[link].bss)); in __cfg80211_roamed()
1116 wdev->links[link].client.current_bss = in __cfg80211_roamed()
1117 bss_from_pub(info->links[link].bss); in __cfg80211_roamed()
1120 connected_addr = info->valid_links ? in __cfg80211_roamed()
1121 info->ap_mld_addr : in __cfg80211_roamed()
1122 info->links[0].bss->bssid; in __cfg80211_roamed()
1123 ether_addr_copy(wdev->u.client.connected_addr, connected_addr); in __cfg80211_roamed()
1124 if (info->valid_links) { in __cfg80211_roamed()
1126 memcpy(wdev->links[link].addr, info->links[link].addr, in __cfg80211_roamed()
1129 wdev->unprot_beacon_reported = 0; in __cfg80211_roamed()
1130 nl80211_send_roamed(wiphy_to_rdev(wdev->wiphy), in __cfg80211_roamed()
1131 wdev->netdev, info, GFP_KERNEL); in __cfg80211_roamed()
1134 if (!info->valid_links) { in __cfg80211_roamed()
1135 if (info->req_ie) { in __cfg80211_roamed()
1137 wrqu.data.length = info->req_ie_len; in __cfg80211_roamed()
1138 wireless_send_event(wdev->netdev, IWEVASSOCREQIE, in __cfg80211_roamed()
1139 &wrqu, info->req_ie); in __cfg80211_roamed()
1142 if (info->resp_ie) { in __cfg80211_roamed()
1144 wrqu.data.length = info->resp_ie_len; in __cfg80211_roamed()
1145 wireless_send_event(wdev->netdev, IWEVASSOCRESPIE, in __cfg80211_roamed()
1146 &wrqu, info->resp_ie); in __cfg80211_roamed()
1152 memcpy(wdev->wext.prev_bssid, connected_addr, ETH_ALEN); in __cfg80211_roamed()
1153 wdev->wext.prev_bssid_valid = true; in __cfg80211_roamed()
1154 wireless_send_event(wdev->netdev, SIOCGIWAP, &wrqu, NULL); in __cfg80211_roamed()
1161 cfg80211_put_bss(wdev->wiphy, info->links[link].bss); in __cfg80211_roamed()
1164 /* Consumes info->links.bss object(s) one way or another */
1168 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_roamed()
1169 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_roamed()
1178 link_info_size += info->links[link].addr ? ETH_ALEN : 0; in cfg80211_roamed()
1179 link_info_size += info->links[link].bssid ? ETH_ALEN : 0; in cfg80211_roamed()
1181 if (info->links[link].bss) in cfg80211_roamed()
1184 info->links[link].bss = in cfg80211_roamed()
1185 cfg80211_get_bss(wdev->wiphy, in cfg80211_roamed()
1186 info->links[link].channel, in cfg80211_roamed()
1187 info->links[link].bssid, in cfg80211_roamed()
1188 wdev->u.client.ssid, in cfg80211_roamed()
1189 wdev->u.client.ssid_len, in cfg80211_roamed()
1190 wdev->conn_bss_type, in cfg80211_roamed()
1193 if (!info->links[link].bss) { in cfg80211_roamed()
1202 ev = kzalloc(sizeof(*ev) + info->req_ie_len + info->resp_ie_len + in cfg80211_roamed()
1203 info->fils.kek_len + info->fils.pmk_len + in cfg80211_roamed()
1204 (info->fils.pmkid ? WLAN_PMKID_LEN : 0) + in cfg80211_roamed()
1205 (info->ap_mld_addr ? ETH_ALEN : 0) + link_info_size, gfp); in cfg80211_roamed()
1209 ev->type = EVENT_ROAMED; in cfg80211_roamed()
1211 if (info->req_ie_len) { in cfg80211_roamed()
1212 ev->rm.req_ie = next; in cfg80211_roamed()
1213 ev->rm.req_ie_len = info->req_ie_len; in cfg80211_roamed()
1214 memcpy((void *)ev->rm.req_ie, info->req_ie, info->req_ie_len); in cfg80211_roamed()
1215 next += info->req_ie_len; in cfg80211_roamed()
1217 if (info->resp_ie_len) { in cfg80211_roamed()
1218 ev->rm.resp_ie = next; in cfg80211_roamed()
1219 ev->rm.resp_ie_len = info->resp_ie_len; in cfg80211_roamed()
1220 memcpy((void *)ev->rm.resp_ie, info->resp_ie, in cfg80211_roamed()
1221 info->resp_ie_len); in cfg80211_roamed()
1222 next += info->resp_ie_len; in cfg80211_roamed()
1224 if (info->fils.kek_len) { in cfg80211_roamed()
1225 ev->rm.fils.kek = next; in cfg80211_roamed()
1226 ev->rm.fils.kek_len = info->fils.kek_len; in cfg80211_roamed()
1227 memcpy((void *)ev->rm.fils.kek, info->fils.kek, in cfg80211_roamed()
1228 info->fils.kek_len); in cfg80211_roamed()
1229 next += info->fils.kek_len; in cfg80211_roamed()
1231 if (info->fils.pmk_len) { in cfg80211_roamed()
1232 ev->rm.fils.pmk = next; in cfg80211_roamed()
1233 ev->rm.fils.pmk_len = info->fils.pmk_len; in cfg80211_roamed()
1234 memcpy((void *)ev->rm.fils.pmk, info->fils.pmk, in cfg80211_roamed()
1235 info->fils.pmk_len); in cfg80211_roamed()
1236 next += info->fils.pmk_len; in cfg80211_roamed()
1238 if (info->fils.pmkid) { in cfg80211_roamed()
1239 ev->rm.fils.pmkid = next; in cfg80211_roamed()
1240 memcpy((void *)ev->rm.fils.pmkid, info->fils.pmkid, in cfg80211_roamed()
1244 ev->rm.fils.update_erp_next_seq_num = info->fils.update_erp_next_seq_num; in cfg80211_roamed()
1245 if (info->fils.update_erp_next_seq_num) in cfg80211_roamed()
1246 ev->rm.fils.erp_next_seq_num = info->fils.erp_next_seq_num; in cfg80211_roamed()
1247 if (info->ap_mld_addr) { in cfg80211_roamed()
1248 ev->rm.ap_mld_addr = next; in cfg80211_roamed()
1249 memcpy((void *)ev->rm.ap_mld_addr, info->ap_mld_addr, in cfg80211_roamed()
1253 ev->rm.valid_links = info->valid_links; in cfg80211_roamed()
1255 ev->rm.links[link].bss = info->links[link].bss; in cfg80211_roamed()
1257 if (info->links[link].addr) { in cfg80211_roamed()
1258 ev->rm.links[link].addr = next; in cfg80211_roamed()
1259 memcpy((void *)ev->rm.links[link].addr, in cfg80211_roamed()
1260 info->links[link].addr, in cfg80211_roamed()
1265 if (info->links[link].bssid) { in cfg80211_roamed()
1266 ev->rm.links[link].bssid = next; in cfg80211_roamed()
1267 memcpy((void *)ev->rm.links[link].bssid, in cfg80211_roamed()
1268 info->links[link].bssid, in cfg80211_roamed()
1274 spin_lock_irqsave(&wdev->event_lock, flags); in cfg80211_roamed()
1275 list_add_tail(&ev->list, &wdev->event_list); in cfg80211_roamed()
1276 spin_unlock_irqrestore(&wdev->event_lock, flags); in cfg80211_roamed()
1277 queue_work(cfg80211_wq, &rdev->event_work); in cfg80211_roamed()
1282 cfg80211_put_bss(wdev->wiphy, info->links[link].bss); in cfg80211_roamed()
1290 lockdep_assert_wiphy(wdev->wiphy); in __cfg80211_port_authorized()
1292 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION && in __cfg80211_port_authorized()
1293 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT && in __cfg80211_port_authorized()
1294 wdev->iftype != NL80211_IFTYPE_AP && in __cfg80211_port_authorized()
1295 wdev->iftype != NL80211_IFTYPE_P2P_GO)) in __cfg80211_port_authorized()
1298 if (wdev->iftype == NL80211_IFTYPE_STATION || in __cfg80211_port_authorized()
1299 wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) { in __cfg80211_port_authorized()
1300 if (WARN_ON(!wdev->connected) || in __cfg80211_port_authorized()
1301 WARN_ON(!ether_addr_equal(wdev->u.client.connected_addr, peer_addr))) in __cfg80211_port_authorized()
1305 nl80211_send_port_authorized(wiphy_to_rdev(wdev->wiphy), wdev->netdev, in __cfg80211_port_authorized()
1312 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_port_authorized()
1313 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_port_authorized()
1324 ev->type = EVENT_PORT_AUTHORIZED; in cfg80211_port_authorized()
1325 memcpy(ev->pa.peer_addr, peer_addr, ETH_ALEN); in cfg80211_port_authorized()
1326 ev->pa.td_bitmap = ((u8 *)ev) + sizeof(*ev); in cfg80211_port_authorized()
1327 ev->pa.td_bitmap_len = td_bitmap_len; in cfg80211_port_authorized()
1328 memcpy((void *)ev->pa.td_bitmap, td_bitmap, td_bitmap_len); in cfg80211_port_authorized()
1334 spin_lock_irqsave(&wdev->event_lock, flags); in cfg80211_port_authorized()
1335 list_add_tail(&ev->list, &wdev->event_list); in cfg80211_port_authorized()
1336 spin_unlock_irqrestore(&wdev->event_lock, flags); in cfg80211_port_authorized()
1337 queue_work(cfg80211_wq, &rdev->event_work); in cfg80211_port_authorized()
1344 struct wireless_dev *wdev = dev->ieee80211_ptr; in __cfg80211_disconnected()
1345 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in __cfg80211_disconnected()
1351 lockdep_assert_wiphy(wdev->wiphy); in __cfg80211_disconnected()
1353 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION && in __cfg80211_disconnected()
1354 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)) in __cfg80211_disconnected()
1358 wdev->valid_links = 0; in __cfg80211_disconnected()
1359 wdev->connected = false; in __cfg80211_disconnected()
1360 wdev->u.client.ssid_len = 0; in __cfg80211_disconnected()
1361 wdev->conn_owner_nlportid = 0; in __cfg80211_disconnected()
1362 kfree_sensitive(wdev->connect_keys); in __cfg80211_disconnected()
1363 wdev->connect_keys = NULL; in __cfg80211_disconnected()
1368 if (rdev->ops->crit_proto_stop && rdev->crit_proto_nlportid) { in __cfg80211_disconnected()
1369 rdev->crit_proto_nlportid = 0; in __cfg80211_disconnected()
1377 if (rdev->ops->del_key) { in __cfg80211_disconnected()
1381 wdev->wiphy, in __cfg80211_disconnected()
1384 wdev->wiphy, in __cfg80211_disconnected()
1388 rdev_del_key(rdev, dev, -1, i, false, NULL); in __cfg80211_disconnected()
1397 wdev->wext.connect.ssid_len = 0; in __cfg80211_disconnected()
1409 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_disconnected()
1410 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_disconnected()
1418 ev->type = EVENT_DISCONNECTED; in cfg80211_disconnected()
1419 ev->dc.ie = ((u8 *)ev) + sizeof(*ev); in cfg80211_disconnected()
1420 ev->dc.ie_len = ie_len; in cfg80211_disconnected()
1421 memcpy((void *)ev->dc.ie, ie, ie_len); in cfg80211_disconnected()
1422 ev->dc.reason = reason; in cfg80211_disconnected()
1423 ev->dc.locally_generated = locally_generated; in cfg80211_disconnected()
1425 spin_lock_irqsave(&wdev->event_lock, flags); in cfg80211_disconnected()
1426 list_add_tail(&ev->list, &wdev->event_list); in cfg80211_disconnected()
1427 spin_unlock_irqrestore(&wdev->event_lock, flags); in cfg80211_disconnected()
1428 queue_work(cfg80211_wq, &rdev->event_work); in cfg80211_disconnected()
1441 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_connect()
1444 lockdep_assert_wiphy(wdev->wiphy); in cfg80211_connect()
1449 * same (which is the case for re-association.) in cfg80211_connect()
1451 if (wdev->u.client.ssid_len && in cfg80211_connect()
1452 (wdev->u.client.ssid_len != connect->ssid_len || in cfg80211_connect()
1453 memcmp(wdev->u.client.ssid, connect->ssid, wdev->u.client.ssid_len))) in cfg80211_connect()
1454 return -EALREADY; in cfg80211_connect()
1457 * If connected, reject (re-)association unless prev_bssid in cfg80211_connect()
1460 if (wdev->connected) { in cfg80211_connect()
1462 return -EALREADY; in cfg80211_connect()
1464 wdev->u.client.connected_addr)) in cfg80211_connect()
1465 return -ENOTCONN; in cfg80211_connect()
1473 if (wdev->connect_keys) in cfg80211_connect()
1474 return -EINPROGRESS; in cfg80211_connect()
1476 cfg80211_oper_and_ht_capa(&connect->ht_capa_mask, in cfg80211_connect()
1477 rdev->wiphy.ht_capa_mod_mask); in cfg80211_connect()
1478 cfg80211_oper_and_vht_capa(&connect->vht_capa_mask, in cfg80211_connect()
1479 rdev->wiphy.vht_capa_mod_mask); in cfg80211_connect()
1481 if (connkeys && connkeys->def >= 0) { in cfg80211_connect()
1485 idx = connkeys->def; in cfg80211_connect()
1486 cipher = connkeys->params[idx].cipher; in cfg80211_connect()
1490 connect->key_idx = idx; in cfg80211_connect()
1491 connect->key = connkeys->params[idx].key; in cfg80211_connect()
1492 connect->key_len = connkeys->params[idx].key_len; in cfg80211_connect()
1498 if (connect->crypto.cipher_group == 0) in cfg80211_connect()
1499 connect->crypto.cipher_group = cipher; in cfg80211_connect()
1501 if (connect->crypto.n_ciphers_pairwise == 0) { in cfg80211_connect()
1502 connect->crypto.n_ciphers_pairwise = 1; in cfg80211_connect()
1503 connect->crypto.ciphers_pairwise[0] = cipher; in cfg80211_connect()
1508 return -EINVAL; in cfg80211_connect()
1510 /* connect can point to wdev->wext.connect which in cfg80211_connect()
1513 connect->key = NULL; in cfg80211_connect()
1514 connect->key_len = 0; in cfg80211_connect()
1515 connect->key_idx = 0; in cfg80211_connect()
1518 wdev->connect_keys = connkeys; in cfg80211_connect()
1519 memcpy(wdev->u.client.ssid, connect->ssid, connect->ssid_len); in cfg80211_connect()
1520 wdev->u.client.ssid_len = connect->ssid_len; in cfg80211_connect()
1522 wdev->conn_bss_type = connect->pbss ? IEEE80211_BSS_TYPE_PBSS : in cfg80211_connect()
1525 if (!rdev->ops->connect) in cfg80211_connect()
1531 wdev->connect_keys = NULL; in cfg80211_connect()
1536 if (!wdev->connected) in cfg80211_connect()
1537 wdev->u.client.ssid_len = 0; in cfg80211_connect()
1547 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_disconnect()
1550 lockdep_assert_wiphy(wdev->wiphy); in cfg80211_disconnect()
1552 kfree_sensitive(wdev->connect_keys); in cfg80211_disconnect()
1553 wdev->connect_keys = NULL; in cfg80211_disconnect()
1555 wdev->conn_owner_nlportid = 0; in cfg80211_disconnect()
1557 if (wdev->conn) in cfg80211_disconnect()
1559 else if (!rdev->ops->disconnect) in cfg80211_disconnect()
1561 else if (wdev->u.client.ssid_len) in cfg80211_disconnect()
1569 if (!wdev->connected) in cfg80211_disconnect()
1570 wdev->u.client.ssid_len = 0; in cfg80211_disconnect()
1583 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_autodisconnect_wk()
1585 wiphy_lock(wdev->wiphy); in cfg80211_autodisconnect_wk()
1587 if (wdev->conn_owner_nlportid) { in cfg80211_autodisconnect_wk()
1588 switch (wdev->iftype) { in cfg80211_autodisconnect_wk()
1590 cfg80211_leave_ibss(rdev, wdev->netdev, false); in cfg80211_autodisconnect_wk()
1594 cfg80211_stop_ap(rdev, wdev->netdev, -1, false); in cfg80211_autodisconnect_wk()
1597 cfg80211_leave_mesh(rdev, wdev->netdev); in cfg80211_autodisconnect_wk()
1603 * ops->disconnect not implemented. Otherwise we can in cfg80211_autodisconnect_wk()
1606 if (rdev->ops->disconnect || wdev->connected) in cfg80211_autodisconnect_wk()
1607 cfg80211_disconnect(rdev, wdev->netdev, in cfg80211_autodisconnect_wk()
1611 cfg80211_mlme_deauth(rdev, wdev->netdev, in cfg80211_autodisconnect_wk()
1612 wdev->disconnect_bssid, in cfg80211_autodisconnect_wk()
1622 wiphy_unlock(wdev->wiphy); in cfg80211_autodisconnect_wk()