Lines Matching +full:fixed +full:- +full:links
1 // SPDX-License-Identifier: GPL-2.0
6 * Copyright (C) 2009, 2020-2023 Intel Corporation
14 #include <net/cfg80211-wext.h>
15 #include "wext-compat.h"
26 lockdep_assert_wiphy(wdev->wiphy); in cfg80211_mgd_wext_connect()
28 if (!netif_running(wdev->netdev)) in cfg80211_mgd_wext_connect()
31 wdev->wext.connect.ie = wdev->wext.ie; in cfg80211_mgd_wext_connect()
32 wdev->wext.connect.ie_len = wdev->wext.ie_len; in cfg80211_mgd_wext_connect()
35 wdev->wext.connect.bg_scan_period = -1; in cfg80211_mgd_wext_connect()
37 if (wdev->wext.keys) { in cfg80211_mgd_wext_connect()
38 wdev->wext.keys->def = wdev->wext.default_key; in cfg80211_mgd_wext_connect()
39 if (wdev->wext.default_key != -1) in cfg80211_mgd_wext_connect()
40 wdev->wext.connect.privacy = true; in cfg80211_mgd_wext_connect()
43 if (!wdev->wext.connect.ssid_len) in cfg80211_mgd_wext_connect()
46 if (wdev->wext.keys && wdev->wext.keys->def != -1) { in cfg80211_mgd_wext_connect()
47 ck = kmemdup(wdev->wext.keys, sizeof(*ck), GFP_KERNEL); in cfg80211_mgd_wext_connect()
49 return -ENOMEM; in cfg80211_mgd_wext_connect()
51 ck->params[i].key = ck->data[i]; in cfg80211_mgd_wext_connect()
54 if (wdev->wext.prev_bssid_valid) in cfg80211_mgd_wext_connect()
55 prev_bssid = wdev->wext.prev_bssid; in cfg80211_mgd_wext_connect()
57 err = cfg80211_connect(rdev, wdev->netdev, in cfg80211_mgd_wext_connect()
58 &wdev->wext.connect, ck, prev_bssid); in cfg80211_mgd_wext_connect()
69 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_mgd_wext_siwfreq()
70 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_mgd_wext_siwfreq()
75 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) in cfg80211_mgd_wext_siwfreq()
76 return -EINVAL; in cfg80211_mgd_wext_siwfreq()
83 chan = ieee80211_get_channel(wdev->wiphy, freq); in cfg80211_mgd_wext_siwfreq()
85 return -EINVAL; in cfg80211_mgd_wext_siwfreq()
86 if (chan->flags & IEEE80211_CHAN_DISABLED) in cfg80211_mgd_wext_siwfreq()
87 return -EINVAL; in cfg80211_mgd_wext_siwfreq()
90 if (wdev->conn) { in cfg80211_mgd_wext_siwfreq()
93 if (wdev->wext.connect.channel == chan) in cfg80211_mgd_wext_siwfreq()
97 if (wdev->wext.connect.ssid_len) in cfg80211_mgd_wext_siwfreq()
105 wdev->wext.connect.channel = chan; in cfg80211_mgd_wext_siwfreq()
113 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_mgd_wext_giwfreq()
117 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) in cfg80211_mgd_wext_giwfreq()
118 return -EINVAL; in cfg80211_mgd_wext_giwfreq()
120 if (wdev->valid_links) in cfg80211_mgd_wext_giwfreq()
121 return -EOPNOTSUPP; in cfg80211_mgd_wext_giwfreq()
123 if (wdev->links[0].client.current_bss) in cfg80211_mgd_wext_giwfreq()
124 chan = wdev->links[0].client.current_bss->pub.channel; in cfg80211_mgd_wext_giwfreq()
125 else if (wdev->wext.connect.channel) in cfg80211_mgd_wext_giwfreq()
126 chan = wdev->wext.connect.channel; in cfg80211_mgd_wext_giwfreq()
129 freq->m = chan->center_freq; in cfg80211_mgd_wext_giwfreq()
130 freq->e = 6; in cfg80211_mgd_wext_giwfreq()
135 return -EINVAL; in cfg80211_mgd_wext_giwfreq()
142 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_mgd_wext_siwessid()
143 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_mgd_wext_siwessid()
144 size_t len = data->length; in cfg80211_mgd_wext_siwessid()
148 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) in cfg80211_mgd_wext_siwessid()
149 return -EINVAL; in cfg80211_mgd_wext_siwessid()
151 if (!data->flags) in cfg80211_mgd_wext_siwessid()
155 if (len > 0 && ssid[len - 1] == '\0') in cfg80211_mgd_wext_siwessid()
156 len--; in cfg80211_mgd_wext_siwessid()
158 if (wdev->conn) { in cfg80211_mgd_wext_siwessid()
161 if (wdev->wext.connect.ssid && len && in cfg80211_mgd_wext_siwessid()
162 len == wdev->wext.connect.ssid_len && in cfg80211_mgd_wext_siwessid()
163 memcmp(wdev->wext.connect.ssid, ssid, len) == 0) in cfg80211_mgd_wext_siwessid()
175 wdev->wext.prev_bssid_valid = false; in cfg80211_mgd_wext_siwessid()
176 wdev->wext.connect.ssid = wdev->wext.ssid; in cfg80211_mgd_wext_siwessid()
177 memcpy(wdev->wext.ssid, ssid, len); in cfg80211_mgd_wext_siwessid()
178 wdev->wext.connect.ssid_len = len; in cfg80211_mgd_wext_siwessid()
180 wdev->wext.connect.crypto.control_port = false; in cfg80211_mgd_wext_siwessid()
181 wdev->wext.connect.crypto.control_port_ethertype = in cfg80211_mgd_wext_siwessid()
191 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_mgd_wext_giwessid()
195 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) in cfg80211_mgd_wext_giwessid()
196 return -EINVAL; in cfg80211_mgd_wext_giwessid()
198 if (wdev->valid_links) in cfg80211_mgd_wext_giwessid()
199 return -EINVAL; in cfg80211_mgd_wext_giwessid()
201 data->flags = 0; in cfg80211_mgd_wext_giwessid()
203 if (wdev->links[0].client.current_bss) { in cfg80211_mgd_wext_giwessid()
208 &wdev->links[0].client.current_bss->pub, in cfg80211_mgd_wext_giwessid()
211 data->flags = 1; in cfg80211_mgd_wext_giwessid()
212 data->length = ssid_elem->datalen; in cfg80211_mgd_wext_giwessid()
213 if (data->length > IW_ESSID_MAX_SIZE) in cfg80211_mgd_wext_giwessid()
214 ret = -EINVAL; in cfg80211_mgd_wext_giwessid()
216 memcpy(ssid, ssid_elem->data, data->length); in cfg80211_mgd_wext_giwessid()
219 } else if (wdev->wext.connect.ssid && wdev->wext.connect.ssid_len) { in cfg80211_mgd_wext_giwessid()
220 data->flags = 1; in cfg80211_mgd_wext_giwessid()
221 data->length = wdev->wext.connect.ssid_len; in cfg80211_mgd_wext_giwessid()
222 memcpy(ssid, wdev->wext.connect.ssid, data->length); in cfg80211_mgd_wext_giwessid()
232 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_mgd_wext_siwap()
233 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_mgd_wext_siwap()
234 u8 *bssid = ap_addr->sa_data; in cfg80211_mgd_wext_siwap()
238 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) in cfg80211_mgd_wext_siwap()
239 return -EINVAL; in cfg80211_mgd_wext_siwap()
241 if (ap_addr->sa_family != ARPHRD_ETHER) in cfg80211_mgd_wext_siwap()
242 return -EINVAL; in cfg80211_mgd_wext_siwap()
248 if (wdev->conn) { in cfg80211_mgd_wext_siwap()
250 if (!bssid && !wdev->wext.connect.bssid) in cfg80211_mgd_wext_siwap()
253 /* fixed already - and no change */ in cfg80211_mgd_wext_siwap()
254 if (wdev->wext.connect.bssid && bssid && in cfg80211_mgd_wext_siwap()
255 ether_addr_equal(bssid, wdev->wext.connect.bssid)) in cfg80211_mgd_wext_siwap()
265 memcpy(wdev->wext.bssid, bssid, ETH_ALEN); in cfg80211_mgd_wext_siwap()
266 wdev->wext.connect.bssid = wdev->wext.bssid; in cfg80211_mgd_wext_siwap()
268 wdev->wext.connect.bssid = NULL; in cfg80211_mgd_wext_siwap()
277 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_mgd_wext_giwap()
280 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) in cfg80211_mgd_wext_giwap()
281 return -EINVAL; in cfg80211_mgd_wext_giwap()
283 ap_addr->sa_family = ARPHRD_ETHER; in cfg80211_mgd_wext_giwap()
285 if (wdev->valid_links) in cfg80211_mgd_wext_giwap()
286 return -EOPNOTSUPP; in cfg80211_mgd_wext_giwap()
288 if (wdev->links[0].client.current_bss) in cfg80211_mgd_wext_giwap()
289 memcpy(ap_addr->sa_data, in cfg80211_mgd_wext_giwap()
290 wdev->links[0].client.current_bss->pub.bssid, in cfg80211_mgd_wext_giwap()
293 eth_zero_addr(ap_addr->sa_data); in cfg80211_mgd_wext_giwap()
302 struct iw_point *data = &wrqu->data; in cfg80211_wext_siwgenie()
303 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_wext_siwgenie()
304 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_wext_siwgenie()
306 int ie_len = data->length, err; in cfg80211_wext_siwgenie()
308 if (wdev->iftype != NL80211_IFTYPE_STATION) in cfg80211_wext_siwgenie()
309 return -EOPNOTSUPP; in cfg80211_wext_siwgenie()
314 wiphy_lock(wdev->wiphy); in cfg80211_wext_siwgenie()
318 if (wdev->wext.ie_len == ie_len && in cfg80211_wext_siwgenie()
319 memcmp(wdev->wext.ie, ie, ie_len) == 0) in cfg80211_wext_siwgenie()
325 err = -ENOMEM; in cfg80211_wext_siwgenie()
331 kfree(wdev->wext.ie); in cfg80211_wext_siwgenie()
332 wdev->wext.ie = ie; in cfg80211_wext_siwgenie()
333 wdev->wext.ie_len = ie_len; in cfg80211_wext_siwgenie()
335 if (wdev->conn) { in cfg80211_wext_siwgenie()
345 wiphy_unlock(wdev->wiphy); in cfg80211_wext_siwgenie()
353 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_wext_siwmlme()
359 return -EOPNOTSUPP; in cfg80211_wext_siwmlme()
361 rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_wext_siwmlme()
363 if (wdev->iftype != NL80211_IFTYPE_STATION) in cfg80211_wext_siwmlme()
364 return -EINVAL; in cfg80211_wext_siwmlme()
366 if (mlme->addr.sa_family != ARPHRD_ETHER) in cfg80211_wext_siwmlme()
367 return -EINVAL; in cfg80211_wext_siwmlme()
369 wiphy_lock(&rdev->wiphy); in cfg80211_wext_siwmlme()
370 switch (mlme->cmd) { in cfg80211_wext_siwmlme()
373 err = cfg80211_disconnect(rdev, dev, mlme->reason_code, true); in cfg80211_wext_siwmlme()
376 err = -EOPNOTSUPP; in cfg80211_wext_siwmlme()
379 wiphy_unlock(&rdev->wiphy); in cfg80211_wext_siwmlme()