blob: d0ca6da33ca9df665eb9df038256eda5ea5b9f86 [file] [log] [blame]
Jiri Bencf0706e82007-05-05 11:45:53 -07001/*
2 * mac80211 configuration hooks for cfg80211
3 *
Johannes Berg62da92f2007-12-19 02:03:31 +01004 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
Jiri Bencf0706e82007-05-05 11:45:53 -07005 *
6 * This file is GPLv2 as found in COPYING.
7 */
8
Johannes Berge8cbb4c2007-12-19 02:03:30 +01009#include <linux/ieee80211.h>
Jiri Bencf0706e82007-05-05 11:45:53 -070010#include <linux/nl80211.h>
11#include <linux/rtnetlink.h>
Eric W. Biederman881d9662007-09-17 11:56:21 -070012#include <net/net_namespace.h>
Johannes Berg5dfdaf52007-12-19 02:03:33 +010013#include <linux/rcupdate.h>
Jiri Bencf0706e82007-05-05 11:45:53 -070014#include <net/cfg80211.h>
15#include "ieee80211_i.h"
Johannes Berg24487982009-04-23 18:52:52 +020016#include "driver-ops.h"
Michael Wue0eb6852007-09-18 17:29:21 -040017#include "cfg.h"
Johannes Berg2c8dccc2008-04-08 15:14:40 -040018#include "rate.h"
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +010019#include "mesh.h"
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +010020
Johannes Berg05c914f2008-09-11 00:01:58 +020021static bool nl80211_type_check(enum nl80211_iftype type)
Johannes Berg42613db2007-09-28 21:52:27 +020022{
23 switch (type) {
Johannes Berg42613db2007-09-28 21:52:27 +020024 case NL80211_IFTYPE_ADHOC:
Johannes Berg42613db2007-09-28 21:52:27 +020025 case NL80211_IFTYPE_STATION:
Johannes Berg42613db2007-09-28 21:52:27 +020026 case NL80211_IFTYPE_MONITOR:
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +010027#ifdef CONFIG_MAC80211_MESH
28 case NL80211_IFTYPE_MESH_POINT:
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +010029#endif
Jouni Malinenfbf18922008-10-30 19:50:30 +020030 case NL80211_IFTYPE_AP:
31 case NL80211_IFTYPE_AP_VLAN:
Johannes Bergb4540482008-04-14 15:37:03 +020032 case NL80211_IFTYPE_WDS:
Johannes Berg05c914f2008-09-11 00:01:58 +020033 return true;
Johannes Berg42613db2007-09-28 21:52:27 +020034 default:
Johannes Berg05c914f2008-09-11 00:01:58 +020035 return false;
Johannes Berg42613db2007-09-28 21:52:27 +020036 }
37}
38
Jiri Bencf0706e82007-05-05 11:45:53 -070039static int ieee80211_add_iface(struct wiphy *wiphy, char *name,
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +010040 enum nl80211_iftype type, u32 *flags,
41 struct vif_params *params)
Jiri Bencf0706e82007-05-05 11:45:53 -070042{
43 struct ieee80211_local *local = wiphy_priv(wiphy);
Michael Wu8cc9a732008-01-31 19:48:23 +010044 struct net_device *dev;
45 struct ieee80211_sub_if_data *sdata;
46 int err;
Jiri Bencf0706e82007-05-05 11:45:53 -070047
Johannes Berg05c914f2008-09-11 00:01:58 +020048 if (!nl80211_type_check(type))
Jiri Bencf0706e82007-05-05 11:45:53 -070049 return -EINVAL;
Jiri Bencf0706e82007-05-05 11:45:53 -070050
Johannes Berg05c914f2008-09-11 00:01:58 +020051 err = ieee80211_if_add(local, name, &dev, type, params);
52 if (err || type != NL80211_IFTYPE_MONITOR || !flags)
Michael Wu8cc9a732008-01-31 19:48:23 +010053 return err;
54
55 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
56 sdata->u.mntr_flags = *flags;
57 return 0;
Jiri Bencf0706e82007-05-05 11:45:53 -070058}
59
60static int ieee80211_del_iface(struct wiphy *wiphy, int ifindex)
61{
Jiri Bencf0706e82007-05-05 11:45:53 -070062 struct net_device *dev;
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +120063 struct ieee80211_sub_if_data *sdata;
Jiri Bencf0706e82007-05-05 11:45:53 -070064
Johannes Berg42613db2007-09-28 21:52:27 +020065 /* we're under RTNL */
66 dev = __dev_get_by_index(&init_net, ifindex);
Jiri Bencf0706e82007-05-05 11:45:53 -070067 if (!dev)
Johannes Berg75636522008-07-09 14:40:35 +020068 return -ENODEV;
Jiri Bencf0706e82007-05-05 11:45:53 -070069
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +120070 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
71
72 ieee80211_if_remove(sdata);
Jiri Bencf0706e82007-05-05 11:45:53 -070073
Johannes Berg75636522008-07-09 14:40:35 +020074 return 0;
Jiri Bencf0706e82007-05-05 11:45:53 -070075}
76
Johannes Berg42613db2007-09-28 21:52:27 +020077static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +010078 enum nl80211_iftype type, u32 *flags,
79 struct vif_params *params)
Johannes Berg42613db2007-09-28 21:52:27 +020080{
Johannes Berg42613db2007-09-28 21:52:27 +020081 struct net_device *dev;
Johannes Berg42613db2007-09-28 21:52:27 +020082 struct ieee80211_sub_if_data *sdata;
Johannes Bergf3947e22008-07-09 14:40:36 +020083 int ret;
Johannes Berg42613db2007-09-28 21:52:27 +020084
Johannes Berg42613db2007-09-28 21:52:27 +020085 /* we're under RTNL */
86 dev = __dev_get_by_index(&init_net, ifindex);
87 if (!dev)
88 return -ENODEV;
89
Johannes Berg05c914f2008-09-11 00:01:58 +020090 if (!nl80211_type_check(type))
Johannes Berg42613db2007-09-28 21:52:27 +020091 return -EINVAL;
92
93 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
94
Johannes Berg05c914f2008-09-11 00:01:58 +020095 ret = ieee80211_if_change_type(sdata, type);
Johannes Bergf3947e22008-07-09 14:40:36 +020096 if (ret)
97 return ret;
Johannes Berg42613db2007-09-28 21:52:27 +020098
Johannes Bergf8b25cd2008-09-16 20:22:21 +020099 if (netif_running(sdata->dev))
100 return -EBUSY;
101
Johannes Berg902acc72008-02-23 15:17:19 +0100102 if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len)
Johannes Berg472dbc42008-09-11 00:01:49 +0200103 ieee80211_sdata_set_mesh_id(sdata,
104 params->mesh_id_len,
105 params->mesh_id);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100106
Johannes Berg05c914f2008-09-11 00:01:58 +0200107 if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
Michael Wu8cc9a732008-01-31 19:48:23 +0100108 return 0;
109
110 sdata->u.mntr_flags = *flags;
Johannes Berg42613db2007-09-28 21:52:27 +0200111 return 0;
112}
113
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100114static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
115 u8 key_idx, u8 *mac_addr,
116 struct key_params *params)
117{
118 struct ieee80211_sub_if_data *sdata;
119 struct sta_info *sta = NULL;
120 enum ieee80211_key_alg alg;
Johannes Bergdb4d1162008-02-25 16:27:45 +0100121 struct ieee80211_key *key;
Johannes Berg3b967662008-04-08 17:56:52 +0200122 int err;
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100123
124 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
125
126 switch (params->cipher) {
127 case WLAN_CIPHER_SUITE_WEP40:
128 case WLAN_CIPHER_SUITE_WEP104:
129 alg = ALG_WEP;
130 break;
131 case WLAN_CIPHER_SUITE_TKIP:
132 alg = ALG_TKIP;
133 break;
134 case WLAN_CIPHER_SUITE_CCMP:
135 alg = ALG_CCMP;
136 break;
Jouni Malinen3cfcf6ac2009-01-08 13:32:02 +0200137 case WLAN_CIPHER_SUITE_AES_CMAC:
138 alg = ALG_AES_CMAC;
139 break;
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100140 default:
141 return -EINVAL;
142 }
143
Johannes Bergdb4d1162008-02-25 16:27:45 +0100144 key = ieee80211_key_alloc(alg, key_idx, params->key_len, params->key);
145 if (!key)
146 return -ENOMEM;
147
Johannes Berg3b967662008-04-08 17:56:52 +0200148 rcu_read_lock();
149
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100150 if (mac_addr) {
151 sta = sta_info_get(sdata->local, mac_addr);
Johannes Bergdb4d1162008-02-25 16:27:45 +0100152 if (!sta) {
153 ieee80211_key_free(key);
Johannes Berg3b967662008-04-08 17:56:52 +0200154 err = -ENOENT;
155 goto out_unlock;
Johannes Bergdb4d1162008-02-25 16:27:45 +0100156 }
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100157 }
158
Johannes Bergdb4d1162008-02-25 16:27:45 +0100159 ieee80211_key_link(key, sdata, sta);
160
Johannes Berg3b967662008-04-08 17:56:52 +0200161 err = 0;
162 out_unlock:
163 rcu_read_unlock();
164
165 return err;
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100166}
167
168static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
169 u8 key_idx, u8 *mac_addr)
170{
171 struct ieee80211_sub_if_data *sdata;
172 struct sta_info *sta;
173 int ret;
174
175 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
176
Johannes Berg3b967662008-04-08 17:56:52 +0200177 rcu_read_lock();
178
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100179 if (mac_addr) {
Johannes Berg3b967662008-04-08 17:56:52 +0200180 ret = -ENOENT;
181
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100182 sta = sta_info_get(sdata->local, mac_addr);
183 if (!sta)
Johannes Berg3b967662008-04-08 17:56:52 +0200184 goto out_unlock;
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100185
Johannes Bergdb4d1162008-02-25 16:27:45 +0100186 if (sta->key) {
Johannes Bergd0709a62008-02-25 16:27:46 +0100187 ieee80211_key_free(sta->key);
Johannes Bergdb4d1162008-02-25 16:27:45 +0100188 WARN_ON(sta->key);
Johannes Berg3b967662008-04-08 17:56:52 +0200189 ret = 0;
190 }
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100191
Johannes Berg3b967662008-04-08 17:56:52 +0200192 goto out_unlock;
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100193 }
194
Johannes Berg3b967662008-04-08 17:56:52 +0200195 if (!sdata->keys[key_idx]) {
196 ret = -ENOENT;
197 goto out_unlock;
198 }
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100199
Johannes Bergd0709a62008-02-25 16:27:46 +0100200 ieee80211_key_free(sdata->keys[key_idx]);
Johannes Bergdb4d1162008-02-25 16:27:45 +0100201 WARN_ON(sdata->keys[key_idx]);
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100202
Johannes Berg3b967662008-04-08 17:56:52 +0200203 ret = 0;
204 out_unlock:
205 rcu_read_unlock();
206
207 return ret;
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100208}
209
Johannes Berg62da92f2007-12-19 02:03:31 +0100210static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
211 u8 key_idx, u8 *mac_addr, void *cookie,
212 void (*callback)(void *cookie,
213 struct key_params *params))
214{
Johannes Berg14db74b2008-07-29 13:22:52 +0200215 struct ieee80211_sub_if_data *sdata;
Johannes Berg62da92f2007-12-19 02:03:31 +0100216 struct sta_info *sta = NULL;
217 u8 seq[6] = {0};
218 struct key_params params;
219 struct ieee80211_key *key;
220 u32 iv32;
221 u16 iv16;
222 int err = -ENOENT;
223
Johannes Berg14db74b2008-07-29 13:22:52 +0200224 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
225
Johannes Berg3b967662008-04-08 17:56:52 +0200226 rcu_read_lock();
227
Johannes Berg62da92f2007-12-19 02:03:31 +0100228 if (mac_addr) {
229 sta = sta_info_get(sdata->local, mac_addr);
230 if (!sta)
231 goto out;
232
233 key = sta->key;
234 } else
235 key = sdata->keys[key_idx];
236
237 if (!key)
238 goto out;
239
240 memset(&params, 0, sizeof(params));
241
242 switch (key->conf.alg) {
243 case ALG_TKIP:
244 params.cipher = WLAN_CIPHER_SUITE_TKIP;
245
Harvey Harrisonb0f76b32008-05-14 16:26:19 -0700246 iv32 = key->u.tkip.tx.iv32;
247 iv16 = key->u.tkip.tx.iv16;
Johannes Berg62da92f2007-12-19 02:03:31 +0100248
Johannes Berg24487982009-04-23 18:52:52 +0200249 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)
250 drv_get_tkip_seq(sdata->local,
251 key->conf.hw_key_idx,
252 &iv32, &iv16);
Johannes Berg62da92f2007-12-19 02:03:31 +0100253
254 seq[0] = iv16 & 0xff;
255 seq[1] = (iv16 >> 8) & 0xff;
256 seq[2] = iv32 & 0xff;
257 seq[3] = (iv32 >> 8) & 0xff;
258 seq[4] = (iv32 >> 16) & 0xff;
259 seq[5] = (iv32 >> 24) & 0xff;
260 params.seq = seq;
261 params.seq_len = 6;
262 break;
263 case ALG_CCMP:
264 params.cipher = WLAN_CIPHER_SUITE_CCMP;
265 seq[0] = key->u.ccmp.tx_pn[5];
266 seq[1] = key->u.ccmp.tx_pn[4];
267 seq[2] = key->u.ccmp.tx_pn[3];
268 seq[3] = key->u.ccmp.tx_pn[2];
269 seq[4] = key->u.ccmp.tx_pn[1];
270 seq[5] = key->u.ccmp.tx_pn[0];
271 params.seq = seq;
272 params.seq_len = 6;
273 break;
274 case ALG_WEP:
275 if (key->conf.keylen == 5)
276 params.cipher = WLAN_CIPHER_SUITE_WEP40;
277 else
278 params.cipher = WLAN_CIPHER_SUITE_WEP104;
279 break;
Jouni Malinen3cfcf6ac2009-01-08 13:32:02 +0200280 case ALG_AES_CMAC:
281 params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
282 seq[0] = key->u.aes_cmac.tx_pn[5];
283 seq[1] = key->u.aes_cmac.tx_pn[4];
284 seq[2] = key->u.aes_cmac.tx_pn[3];
285 seq[3] = key->u.aes_cmac.tx_pn[2];
286 seq[4] = key->u.aes_cmac.tx_pn[1];
287 seq[5] = key->u.aes_cmac.tx_pn[0];
288 params.seq = seq;
289 params.seq_len = 6;
290 break;
Johannes Berg62da92f2007-12-19 02:03:31 +0100291 }
292
293 params.key = key->conf.key;
294 params.key_len = key->conf.keylen;
295
296 callback(cookie, &params);
297 err = 0;
298
299 out:
Johannes Berg3b967662008-04-08 17:56:52 +0200300 rcu_read_unlock();
Johannes Berg62da92f2007-12-19 02:03:31 +0100301 return err;
302}
303
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100304static int ieee80211_config_default_key(struct wiphy *wiphy,
305 struct net_device *dev,
306 u8 key_idx)
307{
308 struct ieee80211_sub_if_data *sdata;
309
Johannes Berg3b967662008-04-08 17:56:52 +0200310 rcu_read_lock();
311
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100312 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
313 ieee80211_set_default_key(sdata, key_idx);
314
Johannes Berg3b967662008-04-08 17:56:52 +0200315 rcu_read_unlock();
316
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100317 return 0;
318}
319
Jouni Malinen3cfcf6ac2009-01-08 13:32:02 +0200320static int ieee80211_config_default_mgmt_key(struct wiphy *wiphy,
321 struct net_device *dev,
322 u8 key_idx)
323{
324 struct ieee80211_sub_if_data *sdata;
325
326 rcu_read_lock();
327
328 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
329 ieee80211_set_default_mgmt_key(sdata, key_idx);
330
331 rcu_read_unlock();
332
333 return 0;
334}
335
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100336static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
337{
Johannes Bergd0709a62008-02-25 16:27:46 +0100338 struct ieee80211_sub_if_data *sdata = sta->sdata;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100339
340 sinfo->filled = STATION_INFO_INACTIVE_TIME |
341 STATION_INFO_RX_BYTES |
Henning Rogge420e7fa2008-12-11 22:04:19 +0100342 STATION_INFO_TX_BYTES |
Jouni Malinen98c8a60a2009-02-17 13:24:57 +0200343 STATION_INFO_RX_PACKETS |
344 STATION_INFO_TX_PACKETS |
Henning Rogge420e7fa2008-12-11 22:04:19 +0100345 STATION_INFO_TX_BITRATE;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100346
347 sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
348 sinfo->rx_bytes = sta->rx_bytes;
349 sinfo->tx_bytes = sta->tx_bytes;
Jouni Malinen98c8a60a2009-02-17 13:24:57 +0200350 sinfo->rx_packets = sta->rx_packets;
351 sinfo->tx_packets = sta->tx_packets;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100352
Henning Rogge420e7fa2008-12-11 22:04:19 +0100353 if (sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
354 sinfo->filled |= STATION_INFO_SIGNAL;
355 sinfo->signal = (s8)sta->last_signal;
356 }
357
358 sinfo->txrate.flags = 0;
359 if (sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS)
360 sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS;
361 if (sta->last_tx_rate.flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
362 sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH;
363 if (sta->last_tx_rate.flags & IEEE80211_TX_RC_SHORT_GI)
364 sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI;
365
366 if (!(sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS)) {
367 struct ieee80211_supported_band *sband;
368 sband = sta->local->hw.wiphy->bands[
369 sta->local->hw.conf.channel->band];
370 sinfo->txrate.legacy =
371 sband->bitrates[sta->last_tx_rate.idx].bitrate;
372 } else
373 sinfo->txrate.mcs = sta->last_tx_rate.idx;
374
Johannes Berg902acc72008-02-23 15:17:19 +0100375 if (ieee80211_vif_is_mesh(&sdata->vif)) {
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100376#ifdef CONFIG_MAC80211_MESH
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100377 sinfo->filled |= STATION_INFO_LLID |
378 STATION_INFO_PLID |
379 STATION_INFO_PLINK_STATE;
380
381 sinfo->llid = le16_to_cpu(sta->llid);
382 sinfo->plid = le16_to_cpu(sta->plid);
383 sinfo->plink_state = sta->plink_state;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100384#endif
Johannes Berg902acc72008-02-23 15:17:19 +0100385 }
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100386}
387
388
389static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
390 int idx, u8 *mac, struct station_info *sinfo)
391{
392 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
393 struct sta_info *sta;
Johannes Bergd0709a62008-02-25 16:27:46 +0100394 int ret = -ENOENT;
395
396 rcu_read_lock();
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100397
398 sta = sta_info_get_by_idx(local, idx, dev);
Johannes Bergd0709a62008-02-25 16:27:46 +0100399 if (sta) {
400 ret = 0;
Johannes Berg17741cd2008-09-11 00:02:02 +0200401 memcpy(mac, sta->sta.addr, ETH_ALEN);
Johannes Bergd0709a62008-02-25 16:27:46 +0100402 sta_set_sinfo(sta, sinfo);
403 }
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100404
Johannes Bergd0709a62008-02-25 16:27:46 +0100405 rcu_read_unlock();
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100406
Johannes Bergd0709a62008-02-25 16:27:46 +0100407 return ret;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100408}
409
Johannes Berg7bbdd2d2007-12-19 02:03:37 +0100410static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100411 u8 *mac, struct station_info *sinfo)
Johannes Berg7bbdd2d2007-12-19 02:03:37 +0100412{
413 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
414 struct sta_info *sta;
Johannes Bergd0709a62008-02-25 16:27:46 +0100415 int ret = -ENOENT;
Johannes Berg7bbdd2d2007-12-19 02:03:37 +0100416
Johannes Bergd0709a62008-02-25 16:27:46 +0100417 rcu_read_lock();
Johannes Berg7bbdd2d2007-12-19 02:03:37 +0100418
419 /* XXX: verify sta->dev == dev */
Johannes Berg7bbdd2d2007-12-19 02:03:37 +0100420
Johannes Bergd0709a62008-02-25 16:27:46 +0100421 sta = sta_info_get(local, mac);
422 if (sta) {
423 ret = 0;
424 sta_set_sinfo(sta, sinfo);
425 }
426
427 rcu_read_unlock();
428
429 return ret;
Johannes Berg7bbdd2d2007-12-19 02:03:37 +0100430}
431
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100432/*
433 * This handles both adding a beacon and setting new beacon info
434 */
435static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
436 struct beacon_parameters *params)
437{
438 struct beacon_data *new, *old;
439 int new_head_len, new_tail_len;
440 int size;
441 int err = -EINVAL;
442
443 old = sdata->u.ap.beacon;
444
445 /* head must not be zero-length */
446 if (params->head && !params->head_len)
447 return -EINVAL;
448
449 /*
450 * This is a kludge. beacon interval should really be part
451 * of the beacon information.
452 */
Johannes Berg57c4d7b2009-04-23 16:10:04 +0200453 if (params->interval &&
454 (sdata->vif.bss_conf.beacon_int != params->interval)) {
455 sdata->vif.bss_conf.beacon_int = params->interval;
456 ieee80211_bss_info_change_notify(sdata,
457 BSS_CHANGED_BEACON_INT);
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100458 }
459
460 /* Need to have a beacon head if we don't have one yet */
461 if (!params->head && !old)
462 return err;
463
464 /* sorry, no way to start beaconing without dtim period */
465 if (!params->dtim_period && !old)
466 return err;
467
468 /* new or old head? */
469 if (params->head)
470 new_head_len = params->head_len;
471 else
472 new_head_len = old->head_len;
473
474 /* new or old tail? */
475 if (params->tail || !old)
476 /* params->tail_len will be zero for !params->tail */
477 new_tail_len = params->tail_len;
478 else
479 new_tail_len = old->tail_len;
480
481 size = sizeof(*new) + new_head_len + new_tail_len;
482
483 new = kzalloc(size, GFP_KERNEL);
484 if (!new)
485 return -ENOMEM;
486
487 /* start filling the new info now */
488
489 /* new or old dtim period? */
490 if (params->dtim_period)
491 new->dtim_period = params->dtim_period;
492 else
493 new->dtim_period = old->dtim_period;
494
495 /*
496 * pointers go into the block we allocated,
497 * memory is | beacon_data | head | tail |
498 */
499 new->head = ((u8 *) new) + sizeof(*new);
500 new->tail = new->head + new_head_len;
501 new->head_len = new_head_len;
502 new->tail_len = new_tail_len;
503
504 /* copy in head */
505 if (params->head)
506 memcpy(new->head, params->head, new_head_len);
507 else
508 memcpy(new->head, old->head, new_head_len);
509
510 /* copy in optional tail */
511 if (params->tail)
512 memcpy(new->tail, params->tail, new_tail_len);
513 else
514 if (old)
515 memcpy(new->tail, old->tail, new_tail_len);
516
517 rcu_assign_pointer(sdata->u.ap.beacon, new);
518
519 synchronize_rcu();
520
521 kfree(old);
522
Johannes Berg2d0ddec2009-04-23 16:13:26 +0200523 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED |
524 BSS_CHANGED_BEACON);
525 return 0;
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100526}
527
528static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
529 struct beacon_parameters *params)
530{
Johannes Berg14db74b2008-07-29 13:22:52 +0200531 struct ieee80211_sub_if_data *sdata;
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100532 struct beacon_data *old;
533
Johannes Berg14db74b2008-07-29 13:22:52 +0200534 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
535
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100536 old = sdata->u.ap.beacon;
537
538 if (old)
539 return -EALREADY;
540
541 return ieee80211_config_beacon(sdata, params);
542}
543
544static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
545 struct beacon_parameters *params)
546{
Johannes Berg14db74b2008-07-29 13:22:52 +0200547 struct ieee80211_sub_if_data *sdata;
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100548 struct beacon_data *old;
549
Johannes Berg14db74b2008-07-29 13:22:52 +0200550 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
551
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100552 old = sdata->u.ap.beacon;
553
554 if (!old)
555 return -ENOENT;
556
557 return ieee80211_config_beacon(sdata, params);
558}
559
560static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
561{
Johannes Berg14db74b2008-07-29 13:22:52 +0200562 struct ieee80211_sub_if_data *sdata;
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100563 struct beacon_data *old;
564
Johannes Berg14db74b2008-07-29 13:22:52 +0200565 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
566
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100567 old = sdata->u.ap.beacon;
568
569 if (!old)
570 return -ENOENT;
571
572 rcu_assign_pointer(sdata->u.ap.beacon, NULL);
573 synchronize_rcu();
574 kfree(old);
575
Johannes Berg2d0ddec2009-04-23 16:13:26 +0200576 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED);
577 return 0;
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100578}
579
Johannes Berg4fd69312007-12-19 02:03:35 +0100580/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
581struct iapp_layer2_update {
582 u8 da[ETH_ALEN]; /* broadcast */
583 u8 sa[ETH_ALEN]; /* STA addr */
584 __be16 len; /* 6 */
585 u8 dsap; /* 0 */
586 u8 ssap; /* 0 */
587 u8 control;
588 u8 xid_info[3];
589} __attribute__ ((packed));
590
591static void ieee80211_send_layer2_update(struct sta_info *sta)
592{
593 struct iapp_layer2_update *msg;
594 struct sk_buff *skb;
595
596 /* Send Level 2 Update Frame to update forwarding tables in layer 2
597 * bridge devices */
598
599 skb = dev_alloc_skb(sizeof(*msg));
600 if (!skb)
601 return;
602 msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg));
603
604 /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID)
605 * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */
606
607 memset(msg->da, 0xff, ETH_ALEN);
Johannes Berg17741cd2008-09-11 00:02:02 +0200608 memcpy(msg->sa, sta->sta.addr, ETH_ALEN);
Johannes Berg4fd69312007-12-19 02:03:35 +0100609 msg->len = htons(6);
610 msg->dsap = 0;
611 msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */
612 msg->control = 0xaf; /* XID response lsb.1111F101.
613 * F=0 (no poll command; unsolicited frame) */
614 msg->xid_info[0] = 0x81; /* XID format identifier */
615 msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */
616 msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */
617
Johannes Bergd0709a62008-02-25 16:27:46 +0100618 skb->dev = sta->sdata->dev;
619 skb->protocol = eth_type_trans(skb, sta->sdata->dev);
Johannes Berg4fd69312007-12-19 02:03:35 +0100620 memset(skb->cb, 0, sizeof(skb->cb));
621 netif_rx(skb);
622}
623
624static void sta_apply_parameters(struct ieee80211_local *local,
625 struct sta_info *sta,
626 struct station_parameters *params)
627{
628 u32 rates;
629 int i, j;
Johannes Berg8318d782008-01-24 19:38:38 +0100630 struct ieee80211_supported_band *sband;
Johannes Bergd0709a62008-02-25 16:27:46 +0100631 struct ieee80211_sub_if_data *sdata = sta->sdata;
Johannes Berg4fd69312007-12-19 02:03:35 +0100632
Johannes Bergae5eb022008-10-14 16:58:37 +0200633 sband = local->hw.wiphy->bands[local->oper_channel->band];
634
Johannes Berg73651ee2008-02-25 16:27:47 +0100635 /*
636 * FIXME: updating the flags is racy when this function is
637 * called from ieee80211_change_station(), this will
638 * be resolved in a future patch.
639 */
640
Johannes Berg4fd69312007-12-19 02:03:35 +0100641 if (params->station_flags & STATION_FLAG_CHANGED) {
Johannes Berg07346f812008-05-03 01:02:02 +0200642 spin_lock_bh(&sta->lock);
Johannes Berg4fd69312007-12-19 02:03:35 +0100643 sta->flags &= ~WLAN_STA_AUTHORIZED;
644 if (params->station_flags & STATION_FLAG_AUTHORIZED)
645 sta->flags |= WLAN_STA_AUTHORIZED;
646
647 sta->flags &= ~WLAN_STA_SHORT_PREAMBLE;
648 if (params->station_flags & STATION_FLAG_SHORT_PREAMBLE)
649 sta->flags |= WLAN_STA_SHORT_PREAMBLE;
650
651 sta->flags &= ~WLAN_STA_WME;
652 if (params->station_flags & STATION_FLAG_WME)
653 sta->flags |= WLAN_STA_WME;
Jouni Malinen5394af42009-01-08 13:31:59 +0200654
655 sta->flags &= ~WLAN_STA_MFP;
656 if (params->station_flags & STATION_FLAG_MFP)
657 sta->flags |= WLAN_STA_MFP;
Johannes Berg07346f812008-05-03 01:02:02 +0200658 spin_unlock_bh(&sta->lock);
Johannes Berg4fd69312007-12-19 02:03:35 +0100659 }
660
Johannes Berg73651ee2008-02-25 16:27:47 +0100661 /*
662 * FIXME: updating the following information is racy when this
663 * function is called from ieee80211_change_station().
664 * However, all this information should be static so
665 * maybe we should just reject attemps to change it.
666 */
667
Johannes Berg4fd69312007-12-19 02:03:35 +0100668 if (params->aid) {
Johannes Berg17741cd2008-09-11 00:02:02 +0200669 sta->sta.aid = params->aid;
670 if (sta->sta.aid > IEEE80211_MAX_AID)
671 sta->sta.aid = 0; /* XXX: should this be an error? */
Johannes Berg4fd69312007-12-19 02:03:35 +0100672 }
673
674 if (params->listen_interval >= 0)
675 sta->listen_interval = params->listen_interval;
676
677 if (params->supported_rates) {
678 rates = 0;
Johannes Berg8318d782008-01-24 19:38:38 +0100679
Johannes Berg4fd69312007-12-19 02:03:35 +0100680 for (i = 0; i < params->supported_rates_len; i++) {
681 int rate = (params->supported_rates[i] & 0x7f) * 5;
Johannes Berg8318d782008-01-24 19:38:38 +0100682 for (j = 0; j < sband->n_bitrates; j++) {
683 if (sband->bitrates[j].bitrate == rate)
Johannes Berg4fd69312007-12-19 02:03:35 +0100684 rates |= BIT(j);
685 }
686 }
Johannes Berg323ce792008-09-11 02:45:11 +0200687 sta->sta.supp_rates[local->oper_channel->band] = rates;
Johannes Berg4fd69312007-12-19 02:03:35 +0100688 }
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100689
Johannes Bergd9fe60d2008-10-09 12:13:49 +0200690 if (params->ht_capa)
Johannes Bergae5eb022008-10-14 16:58:37 +0200691 ieee80211_ht_cap_ie_to_sta_ht_cap(sband,
692 params->ht_capa,
Johannes Bergd9fe60d2008-10-09 12:13:49 +0200693 &sta->sta.ht_cap);
Jouni Malinen36aedc902008-08-25 11:58:58 +0300694
Johannes Berg902acc72008-02-23 15:17:19 +0100695 if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) {
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100696 switch (params->plink_action) {
697 case PLINK_ACTION_OPEN:
698 mesh_plink_open(sta);
699 break;
700 case PLINK_ACTION_BLOCK:
701 mesh_plink_block(sta);
702 break;
703 }
Johannes Berg902acc72008-02-23 15:17:19 +0100704 }
Johannes Berg4fd69312007-12-19 02:03:35 +0100705}
706
707static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
708 u8 *mac, struct station_parameters *params)
709{
Johannes Berg14db74b2008-07-29 13:22:52 +0200710 struct ieee80211_local *local = wiphy_priv(wiphy);
Johannes Berg4fd69312007-12-19 02:03:35 +0100711 struct sta_info *sta;
712 struct ieee80211_sub_if_data *sdata;
Johannes Berg73651ee2008-02-25 16:27:47 +0100713 int err;
Jouni Malinenb8d476c2008-12-12 17:08:31 +0200714 int layer2_update;
Johannes Berg4fd69312007-12-19 02:03:35 +0100715
Johannes Berg4fd69312007-12-19 02:03:35 +0100716 if (params->vlan) {
717 sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
718
Johannes Berg05c914f2008-09-11 00:01:58 +0200719 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
720 sdata->vif.type != NL80211_IFTYPE_AP)
Johannes Berg4fd69312007-12-19 02:03:35 +0100721 return -EINVAL;
722 } else
723 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
724
Johannes Berg03e44972008-02-27 09:56:40 +0100725 if (compare_ether_addr(mac, dev->dev_addr) == 0)
726 return -EINVAL;
727
728 if (is_multicast_ether_addr(mac))
729 return -EINVAL;
730
731 sta = sta_info_alloc(sdata, mac, GFP_KERNEL);
Johannes Berg73651ee2008-02-25 16:27:47 +0100732 if (!sta)
733 return -ENOMEM;
Johannes Berg4fd69312007-12-19 02:03:35 +0100734
735 sta->flags = WLAN_STA_AUTH | WLAN_STA_ASSOC;
736
737 sta_apply_parameters(local, sta, params);
738
Johannes Berg4b7679a2008-09-18 18:14:18 +0200739 rate_control_rate_init(sta);
Johannes Berg4fd69312007-12-19 02:03:35 +0100740
Jouni Malinenb8d476c2008-12-12 17:08:31 +0200741 layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
742 sdata->vif.type == NL80211_IFTYPE_AP;
743
Johannes Berg73651ee2008-02-25 16:27:47 +0100744 rcu_read_lock();
745
746 err = sta_info_insert(sta);
747 if (err) {
Johannes Berg93e5deb2008-04-01 15:21:00 +0200748 /* STA has been freed */
Jouni Malinenb8d476c2008-12-12 17:08:31 +0200749 if (err == -EEXIST && layer2_update) {
750 /* Need to update layer 2 devices on reassociation */
751 sta = sta_info_get(local, mac);
752 if (sta)
753 ieee80211_send_layer2_update(sta);
754 }
Johannes Berg73651ee2008-02-25 16:27:47 +0100755 rcu_read_unlock();
756 return err;
757 }
758
Jouni Malinenb8d476c2008-12-12 17:08:31 +0200759 if (layer2_update)
Johannes Berg73651ee2008-02-25 16:27:47 +0100760 ieee80211_send_layer2_update(sta);
761
762 rcu_read_unlock();
763
Johannes Berg4fd69312007-12-19 02:03:35 +0100764 return 0;
765}
766
767static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
768 u8 *mac)
769{
Johannes Berg14db74b2008-07-29 13:22:52 +0200770 struct ieee80211_local *local = wiphy_priv(wiphy);
771 struct ieee80211_sub_if_data *sdata;
Johannes Berg4fd69312007-12-19 02:03:35 +0100772 struct sta_info *sta;
773
Johannes Berg14db74b2008-07-29 13:22:52 +0200774 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
775
Johannes Berg4fd69312007-12-19 02:03:35 +0100776 if (mac) {
Johannes Berg98dd6a52008-04-10 15:36:09 +0200777 rcu_read_lock();
778
Johannes Berg4fd69312007-12-19 02:03:35 +0100779 /* XXX: get sta belonging to dev */
780 sta = sta_info_get(local, mac);
Johannes Berg98dd6a52008-04-10 15:36:09 +0200781 if (!sta) {
782 rcu_read_unlock();
Johannes Berg4fd69312007-12-19 02:03:35 +0100783 return -ENOENT;
Johannes Berg98dd6a52008-04-10 15:36:09 +0200784 }
Johannes Berg4fd69312007-12-19 02:03:35 +0100785
Johannes Bergd0709a62008-02-25 16:27:46 +0100786 sta_info_unlink(&sta);
Johannes Berg98dd6a52008-04-10 15:36:09 +0200787 rcu_read_unlock();
788
Johannes Berg4f6fab42008-03-31 19:23:02 +0200789 sta_info_destroy(sta);
Johannes Berg4fd69312007-12-19 02:03:35 +0100790 } else
Johannes Bergd0709a62008-02-25 16:27:46 +0100791 sta_info_flush(local, sdata);
Johannes Berg4fd69312007-12-19 02:03:35 +0100792
793 return 0;
794}
795
796static int ieee80211_change_station(struct wiphy *wiphy,
797 struct net_device *dev,
798 u8 *mac,
799 struct station_parameters *params)
800{
Johannes Berg14db74b2008-07-29 13:22:52 +0200801 struct ieee80211_local *local = wiphy_priv(wiphy);
Johannes Berg4fd69312007-12-19 02:03:35 +0100802 struct sta_info *sta;
803 struct ieee80211_sub_if_data *vlansdata;
804
Johannes Berg98dd6a52008-04-10 15:36:09 +0200805 rcu_read_lock();
806
Johannes Berg4fd69312007-12-19 02:03:35 +0100807 /* XXX: get sta belonging to dev */
808 sta = sta_info_get(local, mac);
Johannes Berg98dd6a52008-04-10 15:36:09 +0200809 if (!sta) {
810 rcu_read_unlock();
Johannes Berg4fd69312007-12-19 02:03:35 +0100811 return -ENOENT;
Johannes Berg98dd6a52008-04-10 15:36:09 +0200812 }
Johannes Berg4fd69312007-12-19 02:03:35 +0100813
Johannes Bergd0709a62008-02-25 16:27:46 +0100814 if (params->vlan && params->vlan != sta->sdata->dev) {
Johannes Berg4fd69312007-12-19 02:03:35 +0100815 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
816
Johannes Berg05c914f2008-09-11 00:01:58 +0200817 if (vlansdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
818 vlansdata->vif.type != NL80211_IFTYPE_AP) {
Johannes Berg98dd6a52008-04-10 15:36:09 +0200819 rcu_read_unlock();
Johannes Berg4fd69312007-12-19 02:03:35 +0100820 return -EINVAL;
Johannes Berg98dd6a52008-04-10 15:36:09 +0200821 }
Johannes Berg4fd69312007-12-19 02:03:35 +0100822
Johannes Berg14db74b2008-07-29 13:22:52 +0200823 sta->sdata = vlansdata;
Johannes Berg4fd69312007-12-19 02:03:35 +0100824 ieee80211_send_layer2_update(sta);
825 }
826
827 sta_apply_parameters(local, sta, params);
828
Johannes Berg98dd6a52008-04-10 15:36:09 +0200829 rcu_read_unlock();
830
Johannes Berg4fd69312007-12-19 02:03:35 +0100831 return 0;
832}
833
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100834#ifdef CONFIG_MAC80211_MESH
835static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
836 u8 *dst, u8 *next_hop)
837{
Johannes Berg14db74b2008-07-29 13:22:52 +0200838 struct ieee80211_local *local = wiphy_priv(wiphy);
839 struct ieee80211_sub_if_data *sdata;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100840 struct mesh_path *mpath;
841 struct sta_info *sta;
842 int err;
843
Johannes Berg14db74b2008-07-29 13:22:52 +0200844 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
845
Johannes Bergd0709a62008-02-25 16:27:46 +0100846 rcu_read_lock();
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100847 sta = sta_info_get(local, next_hop);
Johannes Bergd0709a62008-02-25 16:27:46 +0100848 if (!sta) {
849 rcu_read_unlock();
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100850 return -ENOENT;
Johannes Bergd0709a62008-02-25 16:27:46 +0100851 }
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100852
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200853 err = mesh_path_add(dst, sdata);
Johannes Bergd0709a62008-02-25 16:27:46 +0100854 if (err) {
855 rcu_read_unlock();
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100856 return err;
Johannes Bergd0709a62008-02-25 16:27:46 +0100857 }
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100858
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200859 mpath = mesh_path_lookup(dst, sdata);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100860 if (!mpath) {
861 rcu_read_unlock();
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100862 return -ENXIO;
863 }
864 mesh_path_fix_nexthop(mpath, sta);
Johannes Bergd0709a62008-02-25 16:27:46 +0100865
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100866 rcu_read_unlock();
867 return 0;
868}
869
870static int ieee80211_del_mpath(struct wiphy *wiphy, struct net_device *dev,
871 u8 *dst)
872{
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200873 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100874
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200875 if (dst)
876 return mesh_path_del(dst, sdata);
877
878 mesh_path_flush(sdata);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100879 return 0;
880}
881
882static int ieee80211_change_mpath(struct wiphy *wiphy,
883 struct net_device *dev,
884 u8 *dst, u8 *next_hop)
885{
Johannes Berg14db74b2008-07-29 13:22:52 +0200886 struct ieee80211_local *local = wiphy_priv(wiphy);
887 struct ieee80211_sub_if_data *sdata;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100888 struct mesh_path *mpath;
889 struct sta_info *sta;
890
Johannes Berg14db74b2008-07-29 13:22:52 +0200891 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
892
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100893 rcu_read_lock();
Johannes Bergd0709a62008-02-25 16:27:46 +0100894
895 sta = sta_info_get(local, next_hop);
896 if (!sta) {
897 rcu_read_unlock();
898 return -ENOENT;
899 }
900
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200901 mpath = mesh_path_lookup(dst, sdata);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100902 if (!mpath) {
903 rcu_read_unlock();
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100904 return -ENOENT;
905 }
906
907 mesh_path_fix_nexthop(mpath, sta);
Johannes Bergd0709a62008-02-25 16:27:46 +0100908
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100909 rcu_read_unlock();
910 return 0;
911}
912
913static void mpath_set_pinfo(struct mesh_path *mpath, u8 *next_hop,
914 struct mpath_info *pinfo)
915{
916 if (mpath->next_hop)
Johannes Berg17741cd2008-09-11 00:02:02 +0200917 memcpy(next_hop, mpath->next_hop->sta.addr, ETH_ALEN);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100918 else
919 memset(next_hop, 0, ETH_ALEN);
920
921 pinfo->filled = MPATH_INFO_FRAME_QLEN |
922 MPATH_INFO_DSN |
923 MPATH_INFO_METRIC |
924 MPATH_INFO_EXPTIME |
925 MPATH_INFO_DISCOVERY_TIMEOUT |
926 MPATH_INFO_DISCOVERY_RETRIES |
927 MPATH_INFO_FLAGS;
928
929 pinfo->frame_qlen = mpath->frame_queue.qlen;
930 pinfo->dsn = mpath->dsn;
931 pinfo->metric = mpath->metric;
932 if (time_before(jiffies, mpath->exp_time))
933 pinfo->exptime = jiffies_to_msecs(mpath->exp_time - jiffies);
934 pinfo->discovery_timeout =
935 jiffies_to_msecs(mpath->discovery_timeout);
936 pinfo->discovery_retries = mpath->discovery_retries;
937 pinfo->flags = 0;
938 if (mpath->flags & MESH_PATH_ACTIVE)
939 pinfo->flags |= NL80211_MPATH_FLAG_ACTIVE;
940 if (mpath->flags & MESH_PATH_RESOLVING)
941 pinfo->flags |= NL80211_MPATH_FLAG_RESOLVING;
942 if (mpath->flags & MESH_PATH_DSN_VALID)
943 pinfo->flags |= NL80211_MPATH_FLAG_DSN_VALID;
944 if (mpath->flags & MESH_PATH_FIXED)
945 pinfo->flags |= NL80211_MPATH_FLAG_FIXED;
946 if (mpath->flags & MESH_PATH_RESOLVING)
947 pinfo->flags |= NL80211_MPATH_FLAG_RESOLVING;
948
949 pinfo->flags = mpath->flags;
950}
951
952static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev,
953 u8 *dst, u8 *next_hop, struct mpath_info *pinfo)
954
955{
Johannes Berg14db74b2008-07-29 13:22:52 +0200956 struct ieee80211_sub_if_data *sdata;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100957 struct mesh_path *mpath;
958
Johannes Berg14db74b2008-07-29 13:22:52 +0200959 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
960
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100961 rcu_read_lock();
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200962 mpath = mesh_path_lookup(dst, sdata);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100963 if (!mpath) {
964 rcu_read_unlock();
965 return -ENOENT;
966 }
967 memcpy(dst, mpath->dst, ETH_ALEN);
968 mpath_set_pinfo(mpath, next_hop, pinfo);
969 rcu_read_unlock();
970 return 0;
971}
972
973static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
974 int idx, u8 *dst, u8 *next_hop,
975 struct mpath_info *pinfo)
976{
Johannes Berg14db74b2008-07-29 13:22:52 +0200977 struct ieee80211_sub_if_data *sdata;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100978 struct mesh_path *mpath;
979
Johannes Berg14db74b2008-07-29 13:22:52 +0200980 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
981
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100982 rcu_read_lock();
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200983 mpath = mesh_path_lookup_by_idx(idx, sdata);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100984 if (!mpath) {
985 rcu_read_unlock();
986 return -ENOENT;
987 }
988 memcpy(dst, mpath->dst, ETH_ALEN);
989 mpath_set_pinfo(mpath, next_hop, pinfo);
990 rcu_read_unlock();
991 return 0;
992}
colin@cozybit.com93da9cc2008-10-21 12:03:48 -0700993
994static int ieee80211_get_mesh_params(struct wiphy *wiphy,
995 struct net_device *dev,
996 struct mesh_config *conf)
997{
998 struct ieee80211_sub_if_data *sdata;
999 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1000
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001001 memcpy(conf, &(sdata->u.mesh.mshcfg), sizeof(struct mesh_config));
1002 return 0;
1003}
1004
1005static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm, u32 mask)
1006{
1007 return (mask >> (parm-1)) & 0x1;
1008}
1009
1010static int ieee80211_set_mesh_params(struct wiphy *wiphy,
1011 struct net_device *dev,
1012 const struct mesh_config *nconf, u32 mask)
1013{
1014 struct mesh_config *conf;
1015 struct ieee80211_sub_if_data *sdata;
1016 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1017
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001018 /* Set the config options which we are interested in setting */
1019 conf = &(sdata->u.mesh.mshcfg);
1020 if (_chg_mesh_attr(NL80211_MESHCONF_RETRY_TIMEOUT, mask))
1021 conf->dot11MeshRetryTimeout = nconf->dot11MeshRetryTimeout;
1022 if (_chg_mesh_attr(NL80211_MESHCONF_CONFIRM_TIMEOUT, mask))
1023 conf->dot11MeshConfirmTimeout = nconf->dot11MeshConfirmTimeout;
1024 if (_chg_mesh_attr(NL80211_MESHCONF_HOLDING_TIMEOUT, mask))
1025 conf->dot11MeshHoldingTimeout = nconf->dot11MeshHoldingTimeout;
1026 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_PEER_LINKS, mask))
1027 conf->dot11MeshMaxPeerLinks = nconf->dot11MeshMaxPeerLinks;
1028 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_RETRIES, mask))
1029 conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries;
1030 if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask))
1031 conf->dot11MeshTTL = nconf->dot11MeshTTL;
1032 if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask))
1033 conf->auto_open_plinks = nconf->auto_open_plinks;
1034 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, mask))
1035 conf->dot11MeshHWMPmaxPREQretries =
1036 nconf->dot11MeshHWMPmaxPREQretries;
1037 if (_chg_mesh_attr(NL80211_MESHCONF_PATH_REFRESH_TIME, mask))
1038 conf->path_refresh_time = nconf->path_refresh_time;
1039 if (_chg_mesh_attr(NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, mask))
1040 conf->min_discovery_timeout = nconf->min_discovery_timeout;
1041 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, mask))
1042 conf->dot11MeshHWMPactivePathTimeout =
1043 nconf->dot11MeshHWMPactivePathTimeout;
1044 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, mask))
1045 conf->dot11MeshHWMPpreqMinInterval =
1046 nconf->dot11MeshHWMPpreqMinInterval;
1047 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
1048 mask))
1049 conf->dot11MeshHWMPnetDiameterTraversalTime =
1050 nconf->dot11MeshHWMPnetDiameterTraversalTime;
1051 return 0;
1052}
1053
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +01001054#endif
1055
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001056static int ieee80211_change_bss(struct wiphy *wiphy,
1057 struct net_device *dev,
1058 struct bss_parameters *params)
1059{
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001060 struct ieee80211_sub_if_data *sdata;
1061 u32 changed = 0;
1062
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001063 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1064
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001065 if (params->use_cts_prot >= 0) {
Johannes Bergbda39332008-10-11 01:51:51 +02001066 sdata->vif.bss_conf.use_cts_prot = params->use_cts_prot;
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001067 changed |= BSS_CHANGED_ERP_CTS_PROT;
1068 }
1069 if (params->use_short_preamble >= 0) {
Johannes Bergbda39332008-10-11 01:51:51 +02001070 sdata->vif.bss_conf.use_short_preamble =
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001071 params->use_short_preamble;
1072 changed |= BSS_CHANGED_ERP_PREAMBLE;
1073 }
1074 if (params->use_short_slot_time >= 0) {
Johannes Bergbda39332008-10-11 01:51:51 +02001075 sdata->vif.bss_conf.use_short_slot =
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001076 params->use_short_slot_time;
1077 changed |= BSS_CHANGED_ERP_SLOT;
1078 }
1079
Jouni Malinen90c97a02008-10-30 16:59:22 +02001080 if (params->basic_rates) {
1081 int i, j;
1082 u32 rates = 0;
1083 struct ieee80211_local *local = wiphy_priv(wiphy);
1084 struct ieee80211_supported_band *sband =
1085 wiphy->bands[local->oper_channel->band];
1086
1087 for (i = 0; i < params->basic_rates_len; i++) {
1088 int rate = (params->basic_rates[i] & 0x7f) * 5;
1089 for (j = 0; j < sband->n_bitrates; j++) {
1090 if (sband->bitrates[j].bitrate == rate)
1091 rates |= BIT(j);
1092 }
1093 }
1094 sdata->vif.bss_conf.basic_rates = rates;
1095 changed |= BSS_CHANGED_BASIC_RATES;
1096 }
1097
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001098 ieee80211_bss_info_change_notify(sdata, changed);
1099
1100 return 0;
1101}
1102
Jouni Malinen31888482008-10-30 16:59:24 +02001103static int ieee80211_set_txq_params(struct wiphy *wiphy,
1104 struct ieee80211_txq_params *params)
1105{
1106 struct ieee80211_local *local = wiphy_priv(wiphy);
1107 struct ieee80211_tx_queue_params p;
1108
1109 if (!local->ops->conf_tx)
1110 return -EOPNOTSUPP;
1111
1112 memset(&p, 0, sizeof(p));
1113 p.aifs = params->aifs;
1114 p.cw_max = params->cwmax;
1115 p.cw_min = params->cwmin;
1116 p.txop = params->txop;
Johannes Berg24487982009-04-23 18:52:52 +02001117 if (drv_conf_tx(local, params->queue, &p)) {
Jouni Malinen31888482008-10-30 16:59:24 +02001118 printk(KERN_DEBUG "%s: failed to set TX queue "
1119 "parameters for queue %d\n", local->mdev->name,
1120 params->queue);
1121 return -EINVAL;
1122 }
1123
1124 return 0;
1125}
1126
Jouni Malinen72bdcf32008-11-26 16:15:24 +02001127static int ieee80211_set_channel(struct wiphy *wiphy,
1128 struct ieee80211_channel *chan,
Sujith094d05d2008-12-12 11:57:43 +05301129 enum nl80211_channel_type channel_type)
Jouni Malinen72bdcf32008-11-26 16:15:24 +02001130{
1131 struct ieee80211_local *local = wiphy_priv(wiphy);
1132
1133 local->oper_channel = chan;
Sujith094d05d2008-12-12 11:57:43 +05301134 local->oper_channel_type = channel_type;
Jouni Malinen72bdcf32008-11-26 16:15:24 +02001135
1136 return ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
1137}
1138
Bob Copeland665af4f2009-01-19 11:20:53 -05001139#ifdef CONFIG_PM
1140static int ieee80211_suspend(struct wiphy *wiphy)
1141{
1142 return __ieee80211_suspend(wiphy_priv(wiphy));
1143}
1144
1145static int ieee80211_resume(struct wiphy *wiphy)
1146{
1147 return __ieee80211_resume(wiphy_priv(wiphy));
1148}
1149#else
1150#define ieee80211_suspend NULL
1151#define ieee80211_resume NULL
1152#endif
1153
Johannes Berg2a519312009-02-10 21:25:55 +01001154static int ieee80211_scan(struct wiphy *wiphy,
1155 struct net_device *dev,
1156 struct cfg80211_scan_request *req)
1157{
1158 struct ieee80211_sub_if_data *sdata;
1159
Johannes Berg2a519312009-02-10 21:25:55 +01001160 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1161
1162 if (sdata->vif.type != NL80211_IFTYPE_STATION &&
1163 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
Jouni Malinen357303e2009-04-16 18:44:53 +03001164 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
1165 (sdata->vif.type != NL80211_IFTYPE_AP || sdata->u.ap.beacon))
Johannes Berg2a519312009-02-10 21:25:55 +01001166 return -EOPNOTSUPP;
1167
1168 return ieee80211_request_scan(sdata, req);
1169}
1170
Jouni Malinen636a5d32009-03-19 13:39:22 +02001171static int ieee80211_auth(struct wiphy *wiphy, struct net_device *dev,
1172 struct cfg80211_auth_request *req)
1173{
1174 struct ieee80211_sub_if_data *sdata;
1175
Jouni Malinen636a5d32009-03-19 13:39:22 +02001176 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1177
Jouni Malinen636a5d32009-03-19 13:39:22 +02001178 switch (req->auth_type) {
1179 case NL80211_AUTHTYPE_OPEN_SYSTEM:
1180 sdata->u.mgd.auth_algs = IEEE80211_AUTH_ALG_OPEN;
1181 break;
1182 case NL80211_AUTHTYPE_SHARED_KEY:
1183 sdata->u.mgd.auth_algs = IEEE80211_AUTH_ALG_SHARED_KEY;
1184 break;
1185 case NL80211_AUTHTYPE_FT:
1186 sdata->u.mgd.auth_algs = IEEE80211_AUTH_ALG_FT;
1187 break;
1188 case NL80211_AUTHTYPE_NETWORK_EAP:
1189 sdata->u.mgd.auth_algs = IEEE80211_AUTH_ALG_LEAP;
1190 break;
1191 default:
1192 return -EOPNOTSUPP;
1193 }
1194
1195 memcpy(sdata->u.mgd.bssid, req->peer_addr, ETH_ALEN);
1196 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
1197 sdata->u.mgd.flags |= IEEE80211_STA_BSSID_SET;
1198
1199 /* TODO: req->chan */
1200 sdata->u.mgd.flags |= IEEE80211_STA_AUTO_CHANNEL_SEL;
1201
1202 if (req->ssid) {
1203 sdata->u.mgd.flags |= IEEE80211_STA_SSID_SET;
1204 memcpy(sdata->u.mgd.ssid, req->ssid, req->ssid_len);
1205 sdata->u.mgd.ssid_len = req->ssid_len;
1206 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
1207 }
1208
1209 kfree(sdata->u.mgd.sme_auth_ie);
1210 sdata->u.mgd.sme_auth_ie = NULL;
1211 sdata->u.mgd.sme_auth_ie_len = 0;
1212 if (req->ie) {
1213 sdata->u.mgd.sme_auth_ie = kmalloc(req->ie_len, GFP_KERNEL);
1214 if (sdata->u.mgd.sme_auth_ie == NULL)
1215 return -ENOMEM;
1216 memcpy(sdata->u.mgd.sme_auth_ie, req->ie, req->ie_len);
1217 sdata->u.mgd.sme_auth_ie_len = req->ie_len;
1218 }
1219
1220 sdata->u.mgd.flags |= IEEE80211_STA_EXT_SME;
1221 sdata->u.mgd.state = IEEE80211_STA_MLME_DIRECT_PROBE;
1222 ieee80211_sta_req_auth(sdata);
1223 return 0;
1224}
1225
1226static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev,
1227 struct cfg80211_assoc_request *req)
1228{
1229 struct ieee80211_sub_if_data *sdata;
1230 int ret;
1231
Jouni Malinen636a5d32009-03-19 13:39:22 +02001232 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1233
Jouni Malinen636a5d32009-03-19 13:39:22 +02001234 if (memcmp(sdata->u.mgd.bssid, req->peer_addr, ETH_ALEN) != 0 ||
1235 !(sdata->u.mgd.flags & IEEE80211_STA_AUTHENTICATED))
1236 return -ENOLINK; /* not authenticated */
1237
1238 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
1239 sdata->u.mgd.flags |= IEEE80211_STA_BSSID_SET;
1240
1241 /* TODO: req->chan */
1242 sdata->u.mgd.flags |= IEEE80211_STA_AUTO_CHANNEL_SEL;
1243
1244 if (req->ssid) {
1245 sdata->u.mgd.flags |= IEEE80211_STA_SSID_SET;
1246 memcpy(sdata->u.mgd.ssid, req->ssid, req->ssid_len);
1247 sdata->u.mgd.ssid_len = req->ssid_len;
1248 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
1249 } else
1250 sdata->u.mgd.flags |= IEEE80211_STA_AUTO_SSID_SEL;
1251
1252 ret = ieee80211_sta_set_extra_ie(sdata, req->ie, req->ie_len);
1253 if (ret)
1254 return ret;
1255
1256 sdata->u.mgd.flags |= IEEE80211_STA_EXT_SME;
1257 sdata->u.mgd.state = IEEE80211_STA_MLME_ASSOCIATE;
1258 ieee80211_sta_req_auth(sdata);
1259 return 0;
1260}
1261
1262static int ieee80211_deauth(struct wiphy *wiphy, struct net_device *dev,
1263 struct cfg80211_deauth_request *req)
1264{
Johannes Berg691597c2009-04-19 19:57:45 +02001265 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
Jouni Malinen636a5d32009-03-19 13:39:22 +02001266
Johannes Berg691597c2009-04-19 19:57:45 +02001267 /* TODO: req->ie, req->peer_addr */
Jouni Malinen636a5d32009-03-19 13:39:22 +02001268 return ieee80211_sta_deauthenticate(sdata, req->reason_code);
1269}
1270
1271static int ieee80211_disassoc(struct wiphy *wiphy, struct net_device *dev,
1272 struct cfg80211_disassoc_request *req)
1273{
Johannes Berg691597c2009-04-19 19:57:45 +02001274 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
Jouni Malinen636a5d32009-03-19 13:39:22 +02001275
Johannes Berg691597c2009-04-19 19:57:45 +02001276 /* TODO: req->ie, req->peer_addr */
Jouni Malinen636a5d32009-03-19 13:39:22 +02001277 return ieee80211_sta_disassociate(sdata, req->reason_code);
1278}
1279
Johannes Bergaf8cdcd2009-04-19 21:25:43 +02001280static int ieee80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
1281 struct cfg80211_ibss_params *params)
1282{
1283 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1284
1285 return ieee80211_ibss_join(sdata, params);
1286}
1287
1288static int ieee80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
1289{
1290 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1291
1292 return ieee80211_ibss_leave(sdata);
1293}
1294
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02001295static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
1296{
1297 struct ieee80211_local *local = wiphy_priv(wiphy);
Johannes Berg24487982009-04-23 18:52:52 +02001298 int err;
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02001299
1300 if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
Johannes Berg24487982009-04-23 18:52:52 +02001301 err = drv_set_rts_threshold(local, wiphy->rts_threshold);
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02001302
Johannes Berg24487982009-04-23 18:52:52 +02001303 if (err)
1304 return err;
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02001305 }
1306
1307 if (changed & WIPHY_PARAM_RETRY_SHORT)
1308 local->hw.conf.short_frame_max_tx_count = wiphy->retry_short;
1309 if (changed & WIPHY_PARAM_RETRY_LONG)
1310 local->hw.conf.long_frame_max_tx_count = wiphy->retry_long;
1311 if (changed &
1312 (WIPHY_PARAM_RETRY_SHORT | WIPHY_PARAM_RETRY_LONG))
1313 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_RETRY_LIMITS);
1314
1315 return 0;
1316}
1317
Jiri Bencf0706e82007-05-05 11:45:53 -07001318struct cfg80211_ops mac80211_config_ops = {
1319 .add_virtual_intf = ieee80211_add_iface,
1320 .del_virtual_intf = ieee80211_del_iface,
Johannes Berg42613db2007-09-28 21:52:27 +02001321 .change_virtual_intf = ieee80211_change_iface,
Johannes Berge8cbb4c2007-12-19 02:03:30 +01001322 .add_key = ieee80211_add_key,
1323 .del_key = ieee80211_del_key,
Johannes Berg62da92f2007-12-19 02:03:31 +01001324 .get_key = ieee80211_get_key,
Johannes Berge8cbb4c2007-12-19 02:03:30 +01001325 .set_default_key = ieee80211_config_default_key,
Jouni Malinen3cfcf6ac2009-01-08 13:32:02 +02001326 .set_default_mgmt_key = ieee80211_config_default_mgmt_key,
Johannes Berg5dfdaf52007-12-19 02:03:33 +01001327 .add_beacon = ieee80211_add_beacon,
1328 .set_beacon = ieee80211_set_beacon,
1329 .del_beacon = ieee80211_del_beacon,
Johannes Berg4fd69312007-12-19 02:03:35 +01001330 .add_station = ieee80211_add_station,
1331 .del_station = ieee80211_del_station,
1332 .change_station = ieee80211_change_station,
Johannes Berg7bbdd2d2007-12-19 02:03:37 +01001333 .get_station = ieee80211_get_station,
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +01001334 .dump_station = ieee80211_dump_station,
1335#ifdef CONFIG_MAC80211_MESH
1336 .add_mpath = ieee80211_add_mpath,
1337 .del_mpath = ieee80211_del_mpath,
1338 .change_mpath = ieee80211_change_mpath,
1339 .get_mpath = ieee80211_get_mpath,
1340 .dump_mpath = ieee80211_dump_mpath,
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001341 .set_mesh_params = ieee80211_set_mesh_params,
1342 .get_mesh_params = ieee80211_get_mesh_params,
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +01001343#endif
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001344 .change_bss = ieee80211_change_bss,
Jouni Malinen31888482008-10-30 16:59:24 +02001345 .set_txq_params = ieee80211_set_txq_params,
Jouni Malinen72bdcf32008-11-26 16:15:24 +02001346 .set_channel = ieee80211_set_channel,
Bob Copeland665af4f2009-01-19 11:20:53 -05001347 .suspend = ieee80211_suspend,
1348 .resume = ieee80211_resume,
Johannes Berg2a519312009-02-10 21:25:55 +01001349 .scan = ieee80211_scan,
Jouni Malinen636a5d32009-03-19 13:39:22 +02001350 .auth = ieee80211_auth,
1351 .assoc = ieee80211_assoc,
1352 .deauth = ieee80211_deauth,
1353 .disassoc = ieee80211_disassoc,
Johannes Bergaf8cdcd2009-04-19 21:25:43 +02001354 .join_ibss = ieee80211_join_ibss,
1355 .leave_ibss = ieee80211_leave_ibss,
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02001356 .set_wiphy_params = ieee80211_set_wiphy_params,
Jiri Bencf0706e82007-05-05 11:45:53 -07001357};