Lines Matching +full:fixed +full:- +full:links
1 // SPDX-License-Identifier: GPL-2.0
6 * Copyright (C) 2009, 2020-2022 Intel Corporation
14 #include <net/cfg80211-wext.h>
15 #include "wext-compat.h"
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()
92 if (wdev->conn) { in cfg80211_mgd_wext_siwfreq()
95 if (wdev->wext.connect.channel == chan) { in cfg80211_mgd_wext_siwfreq()
101 if (wdev->wext.connect.ssid_len) in cfg80211_mgd_wext_siwfreq()
109 wdev->wext.connect.channel = chan; in cfg80211_mgd_wext_siwfreq()
120 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_mgd_wext_giwfreq()
124 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) in cfg80211_mgd_wext_giwfreq()
125 return -EINVAL; in cfg80211_mgd_wext_giwfreq()
127 if (wdev->valid_links) in cfg80211_mgd_wext_giwfreq()
128 return -EOPNOTSUPP; in cfg80211_mgd_wext_giwfreq()
131 if (wdev->links[0].client.current_bss) in cfg80211_mgd_wext_giwfreq()
132 chan = wdev->links[0].client.current_bss->pub.channel; in cfg80211_mgd_wext_giwfreq()
133 else if (wdev->wext.connect.channel) in cfg80211_mgd_wext_giwfreq()
134 chan = wdev->wext.connect.channel; in cfg80211_mgd_wext_giwfreq()
138 freq->m = chan->center_freq; in cfg80211_mgd_wext_giwfreq()
139 freq->e = 6; in cfg80211_mgd_wext_giwfreq()
144 return -EINVAL; in cfg80211_mgd_wext_giwfreq()
151 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_mgd_wext_siwessid()
152 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_mgd_wext_siwessid()
153 size_t len = data->length; in cfg80211_mgd_wext_siwessid()
157 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) in cfg80211_mgd_wext_siwessid()
158 return -EINVAL; in cfg80211_mgd_wext_siwessid()
160 if (!data->flags) in cfg80211_mgd_wext_siwessid()
164 if (len > 0 && ssid[len - 1] == '\0') in cfg80211_mgd_wext_siwessid()
165 len--; in cfg80211_mgd_wext_siwessid()
171 if (wdev->conn) { in cfg80211_mgd_wext_siwessid()
174 if (wdev->wext.connect.ssid && len && in cfg80211_mgd_wext_siwessid()
175 len == wdev->wext.connect.ssid_len && in cfg80211_mgd_wext_siwessid()
176 memcmp(wdev->wext.connect.ssid, ssid, len) == 0) in cfg80211_mgd_wext_siwessid()
188 wdev->wext.prev_bssid_valid = false; in cfg80211_mgd_wext_siwessid()
189 wdev->wext.connect.ssid = wdev->wext.ssid; in cfg80211_mgd_wext_siwessid()
190 memcpy(wdev->wext.ssid, ssid, len); in cfg80211_mgd_wext_siwessid()
191 wdev->wext.connect.ssid_len = len; in cfg80211_mgd_wext_siwessid()
193 wdev->wext.connect.crypto.control_port = false; in cfg80211_mgd_wext_siwessid()
194 wdev->wext.connect.crypto.control_port_ethertype = in cfg80211_mgd_wext_siwessid()
207 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_mgd_wext_giwessid()
211 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) in cfg80211_mgd_wext_giwessid()
212 return -EINVAL; in cfg80211_mgd_wext_giwessid()
214 if (wdev->valid_links) in cfg80211_mgd_wext_giwessid()
215 return -EINVAL; in cfg80211_mgd_wext_giwessid()
217 data->flags = 0; in cfg80211_mgd_wext_giwessid()
220 if (wdev->links[0].client.current_bss) { in cfg80211_mgd_wext_giwessid()
225 &wdev->links[0].client.current_bss->pub, in cfg80211_mgd_wext_giwessid()
228 data->flags = 1; in cfg80211_mgd_wext_giwessid()
229 data->length = ssid_elem->datalen; in cfg80211_mgd_wext_giwessid()
230 if (data->length > IW_ESSID_MAX_SIZE) in cfg80211_mgd_wext_giwessid()
231 ret = -EINVAL; in cfg80211_mgd_wext_giwessid()
233 memcpy(ssid, ssid_elem->data, data->length); in cfg80211_mgd_wext_giwessid()
236 } else if (wdev->wext.connect.ssid && wdev->wext.connect.ssid_len) { in cfg80211_mgd_wext_giwessid()
237 data->flags = 1; in cfg80211_mgd_wext_giwessid()
238 data->length = wdev->wext.connect.ssid_len; in cfg80211_mgd_wext_giwessid()
239 memcpy(ssid, wdev->wext.connect.ssid, data->length); in cfg80211_mgd_wext_giwessid()
250 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_mgd_wext_siwap()
251 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_mgd_wext_siwap()
252 u8 *bssid = ap_addr->sa_data; in cfg80211_mgd_wext_siwap()
256 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) in cfg80211_mgd_wext_siwap()
257 return -EINVAL; in cfg80211_mgd_wext_siwap()
259 if (ap_addr->sa_family != ARPHRD_ETHER) in cfg80211_mgd_wext_siwap()
260 return -EINVAL; in cfg80211_mgd_wext_siwap()
268 if (wdev->conn) { in cfg80211_mgd_wext_siwap()
271 if (!bssid && !wdev->wext.connect.bssid) in cfg80211_mgd_wext_siwap()
274 /* fixed already - and no change */ in cfg80211_mgd_wext_siwap()
275 if (wdev->wext.connect.bssid && bssid && in cfg80211_mgd_wext_siwap()
276 ether_addr_equal(bssid, wdev->wext.connect.bssid)) in cfg80211_mgd_wext_siwap()
286 memcpy(wdev->wext.bssid, bssid, ETH_ALEN); in cfg80211_mgd_wext_siwap()
287 wdev->wext.connect.bssid = wdev->wext.bssid; in cfg80211_mgd_wext_siwap()
289 wdev->wext.connect.bssid = NULL; in cfg80211_mgd_wext_siwap()
301 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_mgd_wext_giwap()
304 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) in cfg80211_mgd_wext_giwap()
305 return -EINVAL; in cfg80211_mgd_wext_giwap()
307 ap_addr->sa_family = ARPHRD_ETHER; in cfg80211_mgd_wext_giwap()
310 if (wdev->valid_links) { in cfg80211_mgd_wext_giwap()
312 return -EOPNOTSUPP; in cfg80211_mgd_wext_giwap()
314 if (wdev->links[0].client.current_bss) in cfg80211_mgd_wext_giwap()
315 memcpy(ap_addr->sa_data, in cfg80211_mgd_wext_giwap()
316 wdev->links[0].client.current_bss->pub.bssid, in cfg80211_mgd_wext_giwap()
319 eth_zero_addr(ap_addr->sa_data); in cfg80211_mgd_wext_giwap()
329 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_wext_siwgenie()
330 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_wext_siwgenie()
332 int ie_len = data->length, err; in cfg80211_wext_siwgenie()
334 if (wdev->iftype != NL80211_IFTYPE_STATION) in cfg80211_wext_siwgenie()
335 return -EOPNOTSUPP; in cfg80211_wext_siwgenie()
344 if (wdev->wext.ie_len == ie_len && in cfg80211_wext_siwgenie()
345 memcmp(wdev->wext.ie, ie, ie_len) == 0) in cfg80211_wext_siwgenie()
351 err = -ENOMEM; in cfg80211_wext_siwgenie()
357 kfree(wdev->wext.ie); in cfg80211_wext_siwgenie()
358 wdev->wext.ie = ie; in cfg80211_wext_siwgenie()
359 wdev->wext.ie_len = ie_len; in cfg80211_wext_siwgenie()
361 if (wdev->conn) { in cfg80211_wext_siwgenie()
379 struct wireless_dev *wdev = dev->ieee80211_ptr; in cfg80211_wext_siwmlme()
385 return -EOPNOTSUPP; in cfg80211_wext_siwmlme()
387 rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_wext_siwmlme()
389 if (wdev->iftype != NL80211_IFTYPE_STATION) in cfg80211_wext_siwmlme()
390 return -EINVAL; in cfg80211_wext_siwmlme()
392 if (mlme->addr.sa_family != ARPHRD_ETHER) in cfg80211_wext_siwmlme()
393 return -EINVAL; in cfg80211_wext_siwmlme()
395 wiphy_lock(&rdev->wiphy); in cfg80211_wext_siwmlme()
397 switch (mlme->cmd) { in cfg80211_wext_siwmlme()
400 err = cfg80211_disconnect(rdev, dev, mlme->reason_code, true); in cfg80211_wext_siwmlme()
403 err = -EOPNOTSUPP; in cfg80211_wext_siwmlme()
407 wiphy_unlock(&rdev->wiphy); in cfg80211_wext_siwmlme()