blob: a898ccd3f2c9178c6758f2877733d456bab67c70 [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"
Michael Wue0eb6852007-09-18 17:29:21 -040016#include "cfg.h"
Johannes Berg2c8dccc2008-04-08 15:14:40 -040017#include "rate.h"
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +010018#include "mesh.h"
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +010019
Johannes Berg05c914f2008-09-11 00:01:58 +020020static bool nl80211_type_check(enum nl80211_iftype type)
Johannes Berg42613db2007-09-28 21:52:27 +020021{
22 switch (type) {
Johannes Berg42613db2007-09-28 21:52:27 +020023 case NL80211_IFTYPE_ADHOC:
Johannes Berg42613db2007-09-28 21:52:27 +020024 case NL80211_IFTYPE_STATION:
Johannes Berg42613db2007-09-28 21:52:27 +020025 case NL80211_IFTYPE_MONITOR:
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +010026#ifdef CONFIG_MAC80211_MESH
27 case NL80211_IFTYPE_MESH_POINT:
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +010028#endif
Jouni Malinenfbf18922008-10-30 19:50:30 +020029 case NL80211_IFTYPE_AP:
30 case NL80211_IFTYPE_AP_VLAN:
Johannes Bergb4540482008-04-14 15:37:03 +020031 case NL80211_IFTYPE_WDS:
Johannes Berg05c914f2008-09-11 00:01:58 +020032 return true;
Johannes Berg42613db2007-09-28 21:52:27 +020033 default:
Johannes Berg05c914f2008-09-11 00:01:58 +020034 return false;
Johannes Berg42613db2007-09-28 21:52:27 +020035 }
36}
37
Jiri Bencf0706e82007-05-05 11:45:53 -070038static int ieee80211_add_iface(struct wiphy *wiphy, char *name,
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +010039 enum nl80211_iftype type, u32 *flags,
40 struct vif_params *params)
Jiri Bencf0706e82007-05-05 11:45:53 -070041{
42 struct ieee80211_local *local = wiphy_priv(wiphy);
Michael Wu8cc9a732008-01-31 19:48:23 +010043 struct net_device *dev;
44 struct ieee80211_sub_if_data *sdata;
45 int err;
Jiri Bencf0706e82007-05-05 11:45:53 -070046
Johannes Berg05c914f2008-09-11 00:01:58 +020047 if (!nl80211_type_check(type))
Jiri Bencf0706e82007-05-05 11:45:53 -070048 return -EINVAL;
Jiri Bencf0706e82007-05-05 11:45:53 -070049
Johannes Berg05c914f2008-09-11 00:01:58 +020050 err = ieee80211_if_add(local, name, &dev, type, params);
51 if (err || type != NL80211_IFTYPE_MONITOR || !flags)
Michael Wu8cc9a732008-01-31 19:48:23 +010052 return err;
53
54 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
55 sdata->u.mntr_flags = *flags;
56 return 0;
Jiri Bencf0706e82007-05-05 11:45:53 -070057}
58
59static int ieee80211_del_iface(struct wiphy *wiphy, int ifindex)
60{
Jiri Bencf0706e82007-05-05 11:45:53 -070061 struct net_device *dev;
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +120062 struct ieee80211_sub_if_data *sdata;
Jiri Bencf0706e82007-05-05 11:45:53 -070063
Johannes Berg42613db2007-09-28 21:52:27 +020064 /* we're under RTNL */
65 dev = __dev_get_by_index(&init_net, ifindex);
Jiri Bencf0706e82007-05-05 11:45:53 -070066 if (!dev)
Johannes Berg75636522008-07-09 14:40:35 +020067 return -ENODEV;
Jiri Bencf0706e82007-05-05 11:45:53 -070068
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +120069 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
70
71 ieee80211_if_remove(sdata);
Jiri Bencf0706e82007-05-05 11:45:53 -070072
Johannes Berg75636522008-07-09 14:40:35 +020073 return 0;
Jiri Bencf0706e82007-05-05 11:45:53 -070074}
75
Johannes Berg42613db2007-09-28 21:52:27 +020076static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +010077 enum nl80211_iftype type, u32 *flags,
78 struct vif_params *params)
Johannes Berg42613db2007-09-28 21:52:27 +020079{
Johannes Berg42613db2007-09-28 21:52:27 +020080 struct net_device *dev;
Johannes Berg42613db2007-09-28 21:52:27 +020081 struct ieee80211_sub_if_data *sdata;
Johannes Bergf3947e22008-07-09 14:40:36 +020082 int ret;
Johannes Berg42613db2007-09-28 21:52:27 +020083
Johannes Berg42613db2007-09-28 21:52:27 +020084 /* we're under RTNL */
85 dev = __dev_get_by_index(&init_net, ifindex);
86 if (!dev)
87 return -ENODEV;
88
Johannes Berg05c914f2008-09-11 00:01:58 +020089 if (!nl80211_type_check(type))
Johannes Berg42613db2007-09-28 21:52:27 +020090 return -EINVAL;
91
92 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
93
Johannes Berg05c914f2008-09-11 00:01:58 +020094 ret = ieee80211_if_change_type(sdata, type);
Johannes Bergf3947e22008-07-09 14:40:36 +020095 if (ret)
96 return ret;
Johannes Berg42613db2007-09-28 21:52:27 +020097
Johannes Bergf8b25cd2008-09-16 20:22:21 +020098 if (netif_running(sdata->dev))
99 return -EBUSY;
100
Johannes Berg902acc72008-02-23 15:17:19 +0100101 if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len)
Johannes Berg472dbc42008-09-11 00:01:49 +0200102 ieee80211_sdata_set_mesh_id(sdata,
103 params->mesh_id_len,
104 params->mesh_id);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100105
Johannes Berg05c914f2008-09-11 00:01:58 +0200106 if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
Michael Wu8cc9a732008-01-31 19:48:23 +0100107 return 0;
108
109 sdata->u.mntr_flags = *flags;
Johannes Berg42613db2007-09-28 21:52:27 +0200110 return 0;
111}
112
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100113static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
114 u8 key_idx, u8 *mac_addr,
115 struct key_params *params)
116{
117 struct ieee80211_sub_if_data *sdata;
118 struct sta_info *sta = NULL;
119 enum ieee80211_key_alg alg;
Johannes Bergdb4d1162008-02-25 16:27:45 +0100120 struct ieee80211_key *key;
Johannes Berg3b967662008-04-08 17:56:52 +0200121 int err;
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100122
123 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
124
125 switch (params->cipher) {
126 case WLAN_CIPHER_SUITE_WEP40:
127 case WLAN_CIPHER_SUITE_WEP104:
128 alg = ALG_WEP;
129 break;
130 case WLAN_CIPHER_SUITE_TKIP:
131 alg = ALG_TKIP;
132 break;
133 case WLAN_CIPHER_SUITE_CCMP:
134 alg = ALG_CCMP;
135 break;
Jouni Malinen3cfcf6a2009-01-08 13:32:02 +0200136 case WLAN_CIPHER_SUITE_AES_CMAC:
137 alg = ALG_AES_CMAC;
138 break;
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100139 default:
140 return -EINVAL;
141 }
142
Johannes Bergdb4d1162008-02-25 16:27:45 +0100143 key = ieee80211_key_alloc(alg, key_idx, params->key_len, params->key);
144 if (!key)
145 return -ENOMEM;
146
Johannes Berg3b967662008-04-08 17:56:52 +0200147 rcu_read_lock();
148
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100149 if (mac_addr) {
150 sta = sta_info_get(sdata->local, mac_addr);
Johannes Bergdb4d1162008-02-25 16:27:45 +0100151 if (!sta) {
152 ieee80211_key_free(key);
Johannes Berg3b967662008-04-08 17:56:52 +0200153 err = -ENOENT;
154 goto out_unlock;
Johannes Bergdb4d1162008-02-25 16:27:45 +0100155 }
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100156 }
157
Johannes Bergdb4d1162008-02-25 16:27:45 +0100158 ieee80211_key_link(key, sdata, sta);
159
Johannes Berg3b967662008-04-08 17:56:52 +0200160 err = 0;
161 out_unlock:
162 rcu_read_unlock();
163
164 return err;
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100165}
166
167static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
168 u8 key_idx, u8 *mac_addr)
169{
170 struct ieee80211_sub_if_data *sdata;
171 struct sta_info *sta;
172 int ret;
173
174 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
175
Johannes Berg3b967662008-04-08 17:56:52 +0200176 rcu_read_lock();
177
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100178 if (mac_addr) {
Johannes Berg3b967662008-04-08 17:56:52 +0200179 ret = -ENOENT;
180
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100181 sta = sta_info_get(sdata->local, mac_addr);
182 if (!sta)
Johannes Berg3b967662008-04-08 17:56:52 +0200183 goto out_unlock;
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100184
Johannes Bergdb4d1162008-02-25 16:27:45 +0100185 if (sta->key) {
Johannes Bergd0709a62008-02-25 16:27:46 +0100186 ieee80211_key_free(sta->key);
Johannes Bergdb4d1162008-02-25 16:27:45 +0100187 WARN_ON(sta->key);
Johannes Berg3b967662008-04-08 17:56:52 +0200188 ret = 0;
189 }
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100190
Johannes Berg3b967662008-04-08 17:56:52 +0200191 goto out_unlock;
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100192 }
193
Johannes Berg3b967662008-04-08 17:56:52 +0200194 if (!sdata->keys[key_idx]) {
195 ret = -ENOENT;
196 goto out_unlock;
197 }
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100198
Johannes Bergd0709a62008-02-25 16:27:46 +0100199 ieee80211_key_free(sdata->keys[key_idx]);
Johannes Bergdb4d1162008-02-25 16:27:45 +0100200 WARN_ON(sdata->keys[key_idx]);
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100201
Johannes Berg3b967662008-04-08 17:56:52 +0200202 ret = 0;
203 out_unlock:
204 rcu_read_unlock();
205
206 return ret;
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100207}
208
Johannes Berg62da92f2007-12-19 02:03:31 +0100209static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
210 u8 key_idx, u8 *mac_addr, void *cookie,
211 void (*callback)(void *cookie,
212 struct key_params *params))
213{
Johannes Berg14db74b2008-07-29 13:22:52 +0200214 struct ieee80211_sub_if_data *sdata;
Johannes Berg62da92f2007-12-19 02:03:31 +0100215 struct sta_info *sta = NULL;
216 u8 seq[6] = {0};
217 struct key_params params;
218 struct ieee80211_key *key;
219 u32 iv32;
220 u16 iv16;
221 int err = -ENOENT;
222
Johannes Berg14db74b2008-07-29 13:22:52 +0200223 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
224
Johannes Berg3b967662008-04-08 17:56:52 +0200225 rcu_read_lock();
226
Johannes Berg62da92f2007-12-19 02:03:31 +0100227 if (mac_addr) {
228 sta = sta_info_get(sdata->local, mac_addr);
229 if (!sta)
230 goto out;
231
232 key = sta->key;
233 } else
234 key = sdata->keys[key_idx];
235
236 if (!key)
237 goto out;
238
239 memset(&params, 0, sizeof(params));
240
241 switch (key->conf.alg) {
242 case ALG_TKIP:
243 params.cipher = WLAN_CIPHER_SUITE_TKIP;
244
Harvey Harrisonb0f76b32008-05-14 16:26:19 -0700245 iv32 = key->u.tkip.tx.iv32;
246 iv16 = key->u.tkip.tx.iv16;
Johannes Berg62da92f2007-12-19 02:03:31 +0100247
248 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE &&
249 sdata->local->ops->get_tkip_seq)
250 sdata->local->ops->get_tkip_seq(
251 local_to_hw(sdata->local),
252 key->conf.hw_key_idx,
253 &iv32, &iv16);
254
255 seq[0] = iv16 & 0xff;
256 seq[1] = (iv16 >> 8) & 0xff;
257 seq[2] = iv32 & 0xff;
258 seq[3] = (iv32 >> 8) & 0xff;
259 seq[4] = (iv32 >> 16) & 0xff;
260 seq[5] = (iv32 >> 24) & 0xff;
261 params.seq = seq;
262 params.seq_len = 6;
263 break;
264 case ALG_CCMP:
265 params.cipher = WLAN_CIPHER_SUITE_CCMP;
266 seq[0] = key->u.ccmp.tx_pn[5];
267 seq[1] = key->u.ccmp.tx_pn[4];
268 seq[2] = key->u.ccmp.tx_pn[3];
269 seq[3] = key->u.ccmp.tx_pn[2];
270 seq[4] = key->u.ccmp.tx_pn[1];
271 seq[5] = key->u.ccmp.tx_pn[0];
272 params.seq = seq;
273 params.seq_len = 6;
274 break;
275 case ALG_WEP:
276 if (key->conf.keylen == 5)
277 params.cipher = WLAN_CIPHER_SUITE_WEP40;
278 else
279 params.cipher = WLAN_CIPHER_SUITE_WEP104;
280 break;
Jouni Malinen3cfcf6a2009-01-08 13:32:02 +0200281 case ALG_AES_CMAC:
282 params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
283 seq[0] = key->u.aes_cmac.tx_pn[5];
284 seq[1] = key->u.aes_cmac.tx_pn[4];
285 seq[2] = key->u.aes_cmac.tx_pn[3];
286 seq[3] = key->u.aes_cmac.tx_pn[2];
287 seq[4] = key->u.aes_cmac.tx_pn[1];
288 seq[5] = key->u.aes_cmac.tx_pn[0];
289 params.seq = seq;
290 params.seq_len = 6;
291 break;
Johannes Berg62da92f2007-12-19 02:03:31 +0100292 }
293
294 params.key = key->conf.key;
295 params.key_len = key->conf.keylen;
296
297 callback(cookie, &params);
298 err = 0;
299
300 out:
Johannes Berg3b967662008-04-08 17:56:52 +0200301 rcu_read_unlock();
Johannes Berg62da92f2007-12-19 02:03:31 +0100302 return err;
303}
304
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100305static int ieee80211_config_default_key(struct wiphy *wiphy,
306 struct net_device *dev,
307 u8 key_idx)
308{
309 struct ieee80211_sub_if_data *sdata;
310
Johannes Berg3b967662008-04-08 17:56:52 +0200311 rcu_read_lock();
312
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100313 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
314 ieee80211_set_default_key(sdata, key_idx);
315
Johannes Berg3b967662008-04-08 17:56:52 +0200316 rcu_read_unlock();
317
Johannes Berge8cbb4c2007-12-19 02:03:30 +0100318 return 0;
319}
320
Jouni Malinen3cfcf6a2009-01-08 13:32:02 +0200321static int ieee80211_config_default_mgmt_key(struct wiphy *wiphy,
322 struct net_device *dev,
323 u8 key_idx)
324{
325 struct ieee80211_sub_if_data *sdata;
326
327 rcu_read_lock();
328
329 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
330 ieee80211_set_default_mgmt_key(sdata, key_idx);
331
332 rcu_read_unlock();
333
334 return 0;
335}
336
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100337static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
338{
Johannes Bergd0709a62008-02-25 16:27:46 +0100339 struct ieee80211_sub_if_data *sdata = sta->sdata;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100340
341 sinfo->filled = STATION_INFO_INACTIVE_TIME |
342 STATION_INFO_RX_BYTES |
Henning Rogge420e7fa2008-12-11 22:04:19 +0100343 STATION_INFO_TX_BYTES |
Jouni Malinen98c8a60a2009-02-17 13:24:57 +0200344 STATION_INFO_RX_PACKETS |
345 STATION_INFO_TX_PACKETS |
Henning Rogge420e7fa2008-12-11 22:04:19 +0100346 STATION_INFO_TX_BITRATE;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100347
348 sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
349 sinfo->rx_bytes = sta->rx_bytes;
350 sinfo->tx_bytes = sta->tx_bytes;
Jouni Malinen98c8a60a2009-02-17 13:24:57 +0200351 sinfo->rx_packets = sta->rx_packets;
352 sinfo->tx_packets = sta->tx_packets;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100353
Henning Rogge420e7fa2008-12-11 22:04:19 +0100354 if (sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
355 sinfo->filled |= STATION_INFO_SIGNAL;
356 sinfo->signal = (s8)sta->last_signal;
357 }
358
359 sinfo->txrate.flags = 0;
360 if (sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS)
361 sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS;
362 if (sta->last_tx_rate.flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
363 sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH;
364 if (sta->last_tx_rate.flags & IEEE80211_TX_RC_SHORT_GI)
365 sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI;
366
367 if (!(sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS)) {
368 struct ieee80211_supported_band *sband;
369 sband = sta->local->hw.wiphy->bands[
370 sta->local->hw.conf.channel->band];
371 sinfo->txrate.legacy =
372 sband->bitrates[sta->last_tx_rate.idx].bitrate;
373 } else
374 sinfo->txrate.mcs = sta->last_tx_rate.idx;
375
Johannes Berg902acc72008-02-23 15:17:19 +0100376 if (ieee80211_vif_is_mesh(&sdata->vif)) {
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100377#ifdef CONFIG_MAC80211_MESH
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100378 sinfo->filled |= STATION_INFO_LLID |
379 STATION_INFO_PLID |
380 STATION_INFO_PLINK_STATE;
381
382 sinfo->llid = le16_to_cpu(sta->llid);
383 sinfo->plid = le16_to_cpu(sta->plid);
384 sinfo->plink_state = sta->plink_state;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100385#endif
Johannes Berg902acc72008-02-23 15:17:19 +0100386 }
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100387}
388
389
390static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
391 int idx, u8 *mac, struct station_info *sinfo)
392{
393 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
394 struct sta_info *sta;
Johannes Bergd0709a62008-02-25 16:27:46 +0100395 int ret = -ENOENT;
396
397 rcu_read_lock();
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100398
399 sta = sta_info_get_by_idx(local, idx, dev);
Johannes Bergd0709a62008-02-25 16:27:46 +0100400 if (sta) {
401 ret = 0;
Johannes Berg17741cd2008-09-11 00:02:02 +0200402 memcpy(mac, sta->sta.addr, ETH_ALEN);
Johannes Bergd0709a62008-02-25 16:27:46 +0100403 sta_set_sinfo(sta, sinfo);
404 }
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100405
Johannes Bergd0709a62008-02-25 16:27:46 +0100406 rcu_read_unlock();
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100407
Johannes Bergd0709a62008-02-25 16:27:46 +0100408 return ret;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100409}
410
Johannes Berg7bbdd2d2007-12-19 02:03:37 +0100411static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100412 u8 *mac, struct station_info *sinfo)
Johannes Berg7bbdd2d2007-12-19 02:03:37 +0100413{
414 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
415 struct sta_info *sta;
Johannes Bergd0709a62008-02-25 16:27:46 +0100416 int ret = -ENOENT;
Johannes Berg7bbdd2d2007-12-19 02:03:37 +0100417
Johannes Bergd0709a62008-02-25 16:27:46 +0100418 rcu_read_lock();
Johannes Berg7bbdd2d2007-12-19 02:03:37 +0100419
420 /* XXX: verify sta->dev == dev */
Johannes Berg7bbdd2d2007-12-19 02:03:37 +0100421
Johannes Bergd0709a62008-02-25 16:27:46 +0100422 sta = sta_info_get(local, mac);
423 if (sta) {
424 ret = 0;
425 sta_set_sinfo(sta, sinfo);
426 }
427
428 rcu_read_unlock();
429
430 return ret;
Johannes Berg7bbdd2d2007-12-19 02:03:37 +0100431}
432
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100433/*
434 * This handles both adding a beacon and setting new beacon info
435 */
436static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
437 struct beacon_parameters *params)
438{
439 struct beacon_data *new, *old;
440 int new_head_len, new_tail_len;
441 int size;
442 int err = -EINVAL;
443
444 old = sdata->u.ap.beacon;
445
446 /* head must not be zero-length */
447 if (params->head && !params->head_len)
448 return -EINVAL;
449
450 /*
451 * This is a kludge. beacon interval should really be part
452 * of the beacon information.
453 */
Johannes Berg57c4d7b2009-04-23 16:10:04 +0200454 if (params->interval &&
455 (sdata->vif.bss_conf.beacon_int != params->interval)) {
456 sdata->vif.bss_conf.beacon_int = params->interval;
457 ieee80211_bss_info_change_notify(sdata,
458 BSS_CHANGED_BEACON_INT);
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100459 }
460
461 /* Need to have a beacon head if we don't have one yet */
462 if (!params->head && !old)
463 return err;
464
465 /* sorry, no way to start beaconing without dtim period */
466 if (!params->dtim_period && !old)
467 return err;
468
469 /* new or old head? */
470 if (params->head)
471 new_head_len = params->head_len;
472 else
473 new_head_len = old->head_len;
474
475 /* new or old tail? */
476 if (params->tail || !old)
477 /* params->tail_len will be zero for !params->tail */
478 new_tail_len = params->tail_len;
479 else
480 new_tail_len = old->tail_len;
481
482 size = sizeof(*new) + new_head_len + new_tail_len;
483
484 new = kzalloc(size, GFP_KERNEL);
485 if (!new)
486 return -ENOMEM;
487
488 /* start filling the new info now */
489
490 /* new or old dtim period? */
491 if (params->dtim_period)
492 new->dtim_period = params->dtim_period;
493 else
494 new->dtim_period = old->dtim_period;
495
496 /*
497 * pointers go into the block we allocated,
498 * memory is | beacon_data | head | tail |
499 */
500 new->head = ((u8 *) new) + sizeof(*new);
501 new->tail = new->head + new_head_len;
502 new->head_len = new_head_len;
503 new->tail_len = new_tail_len;
504
505 /* copy in head */
506 if (params->head)
507 memcpy(new->head, params->head, new_head_len);
508 else
509 memcpy(new->head, old->head, new_head_len);
510
511 /* copy in optional tail */
512 if (params->tail)
513 memcpy(new->tail, params->tail, new_tail_len);
514 else
515 if (old)
516 memcpy(new->tail, old->tail, new_tail_len);
517
518 rcu_assign_pointer(sdata->u.ap.beacon, new);
519
520 synchronize_rcu();
521
522 kfree(old);
523
Johannes Berg078e1e62009-01-22 18:07:31 +0100524 return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON |
525 IEEE80211_IFCC_BEACON_ENABLED);
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 Berg078e1e62009-01-22 18:07:31 +0100576 return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON_ENABLED);
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100577}
578
Johannes Berg4fd69312007-12-19 02:03:35 +0100579/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
580struct iapp_layer2_update {
581 u8 da[ETH_ALEN]; /* broadcast */
582 u8 sa[ETH_ALEN]; /* STA addr */
583 __be16 len; /* 6 */
584 u8 dsap; /* 0 */
585 u8 ssap; /* 0 */
586 u8 control;
587 u8 xid_info[3];
588} __attribute__ ((packed));
589
590static void ieee80211_send_layer2_update(struct sta_info *sta)
591{
592 struct iapp_layer2_update *msg;
593 struct sk_buff *skb;
594
595 /* Send Level 2 Update Frame to update forwarding tables in layer 2
596 * bridge devices */
597
598 skb = dev_alloc_skb(sizeof(*msg));
599 if (!skb)
600 return;
601 msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg));
602
603 /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID)
604 * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */
605
606 memset(msg->da, 0xff, ETH_ALEN);
Johannes Berg17741cd2008-09-11 00:02:02 +0200607 memcpy(msg->sa, sta->sta.addr, ETH_ALEN);
Johannes Berg4fd69312007-12-19 02:03:35 +0100608 msg->len = htons(6);
609 msg->dsap = 0;
610 msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */
611 msg->control = 0xaf; /* XID response lsb.1111F101.
612 * F=0 (no poll command; unsolicited frame) */
613 msg->xid_info[0] = 0x81; /* XID format identifier */
614 msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */
615 msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */
616
Johannes Bergd0709a62008-02-25 16:27:46 +0100617 skb->dev = sta->sdata->dev;
618 skb->protocol = eth_type_trans(skb, sta->sdata->dev);
Johannes Berg4fd69312007-12-19 02:03:35 +0100619 memset(skb->cb, 0, sizeof(skb->cb));
620 netif_rx(skb);
621}
622
623static void sta_apply_parameters(struct ieee80211_local *local,
624 struct sta_info *sta,
625 struct station_parameters *params)
626{
627 u32 rates;
628 int i, j;
Johannes Berg8318d782008-01-24 19:38:38 +0100629 struct ieee80211_supported_band *sband;
Johannes Bergd0709a62008-02-25 16:27:46 +0100630 struct ieee80211_sub_if_data *sdata = sta->sdata;
Johannes Berg4fd69312007-12-19 02:03:35 +0100631
Johannes Bergae5eb022008-10-14 16:58:37 +0200632 sband = local->hw.wiphy->bands[local->oper_channel->band];
633
Johannes Berg73651ee2008-02-25 16:27:47 +0100634 /*
635 * FIXME: updating the flags is racy when this function is
636 * called from ieee80211_change_station(), this will
637 * be resolved in a future patch.
638 */
639
Johannes Berg4fd69312007-12-19 02:03:35 +0100640 if (params->station_flags & STATION_FLAG_CHANGED) {
Johannes Berg07346f812008-05-03 01:02:02 +0200641 spin_lock_bh(&sta->lock);
Johannes Berg4fd69312007-12-19 02:03:35 +0100642 sta->flags &= ~WLAN_STA_AUTHORIZED;
643 if (params->station_flags & STATION_FLAG_AUTHORIZED)
644 sta->flags |= WLAN_STA_AUTHORIZED;
645
646 sta->flags &= ~WLAN_STA_SHORT_PREAMBLE;
647 if (params->station_flags & STATION_FLAG_SHORT_PREAMBLE)
648 sta->flags |= WLAN_STA_SHORT_PREAMBLE;
649
650 sta->flags &= ~WLAN_STA_WME;
651 if (params->station_flags & STATION_FLAG_WME)
652 sta->flags |= WLAN_STA_WME;
Jouni Malinen5394af42009-01-08 13:31:59 +0200653
654 sta->flags &= ~WLAN_STA_MFP;
655 if (params->station_flags & STATION_FLAG_MFP)
656 sta->flags |= WLAN_STA_MFP;
Johannes Berg07346f812008-05-03 01:02:02 +0200657 spin_unlock_bh(&sta->lock);
Johannes Berg4fd69312007-12-19 02:03:35 +0100658 }
659
Johannes Berg73651ee2008-02-25 16:27:47 +0100660 /*
661 * FIXME: updating the following information is racy when this
662 * function is called from ieee80211_change_station().
663 * However, all this information should be static so
664 * maybe we should just reject attemps to change it.
665 */
666
Johannes Berg4fd69312007-12-19 02:03:35 +0100667 if (params->aid) {
Johannes Berg17741cd2008-09-11 00:02:02 +0200668 sta->sta.aid = params->aid;
669 if (sta->sta.aid > IEEE80211_MAX_AID)
670 sta->sta.aid = 0; /* XXX: should this be an error? */
Johannes Berg4fd69312007-12-19 02:03:35 +0100671 }
672
673 if (params->listen_interval >= 0)
674 sta->listen_interval = params->listen_interval;
675
676 if (params->supported_rates) {
677 rates = 0;
Johannes Berg8318d782008-01-24 19:38:38 +0100678
Johannes Berg4fd69312007-12-19 02:03:35 +0100679 for (i = 0; i < params->supported_rates_len; i++) {
680 int rate = (params->supported_rates[i] & 0x7f) * 5;
Johannes Berg8318d782008-01-24 19:38:38 +0100681 for (j = 0; j < sband->n_bitrates; j++) {
682 if (sband->bitrates[j].bitrate == rate)
Johannes Berg4fd69312007-12-19 02:03:35 +0100683 rates |= BIT(j);
684 }
685 }
Johannes Berg323ce792008-09-11 02:45:11 +0200686 sta->sta.supp_rates[local->oper_channel->band] = rates;
Johannes Berg4fd69312007-12-19 02:03:35 +0100687 }
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100688
Johannes Bergd9fe60d2008-10-09 12:13:49 +0200689 if (params->ht_capa)
Johannes Bergae5eb022008-10-14 16:58:37 +0200690 ieee80211_ht_cap_ie_to_sta_ht_cap(sband,
691 params->ht_capa,
Johannes Bergd9fe60d2008-10-09 12:13:49 +0200692 &sta->sta.ht_cap);
Jouni Malinen36aedc92008-08-25 11:58:58 +0300693
Johannes Berg902acc72008-02-23 15:17:19 +0100694 if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) {
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100695 switch (params->plink_action) {
696 case PLINK_ACTION_OPEN:
697 mesh_plink_open(sta);
698 break;
699 case PLINK_ACTION_BLOCK:
700 mesh_plink_block(sta);
701 break;
702 }
Johannes Berg902acc72008-02-23 15:17:19 +0100703 }
Johannes Berg4fd69312007-12-19 02:03:35 +0100704}
705
706static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
707 u8 *mac, struct station_parameters *params)
708{
Johannes Berg14db74b2008-07-29 13:22:52 +0200709 struct ieee80211_local *local = wiphy_priv(wiphy);
Johannes Berg4fd69312007-12-19 02:03:35 +0100710 struct sta_info *sta;
711 struct ieee80211_sub_if_data *sdata;
Johannes Berg73651ee2008-02-25 16:27:47 +0100712 int err;
Jouni Malinenb8d476c2008-12-12 17:08:31 +0200713 int layer2_update;
Johannes Berg4fd69312007-12-19 02:03:35 +0100714
Johannes Berg4fd69312007-12-19 02:03:35 +0100715 if (params->vlan) {
716 sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
717
Johannes Berg05c914f2008-09-11 00:01:58 +0200718 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
719 sdata->vif.type != NL80211_IFTYPE_AP)
Johannes Berg4fd69312007-12-19 02:03:35 +0100720 return -EINVAL;
721 } else
722 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
723
Johannes Berg03e44972008-02-27 09:56:40 +0100724 if (compare_ether_addr(mac, dev->dev_addr) == 0)
725 return -EINVAL;
726
727 if (is_multicast_ether_addr(mac))
728 return -EINVAL;
729
730 sta = sta_info_alloc(sdata, mac, GFP_KERNEL);
Johannes Berg73651ee2008-02-25 16:27:47 +0100731 if (!sta)
732 return -ENOMEM;
Johannes Berg4fd69312007-12-19 02:03:35 +0100733
734 sta->flags = WLAN_STA_AUTH | WLAN_STA_ASSOC;
735
736 sta_apply_parameters(local, sta, params);
737
Johannes Berg4b7679a2008-09-18 18:14:18 +0200738 rate_control_rate_init(sta);
Johannes Berg4fd69312007-12-19 02:03:35 +0100739
Jouni Malinenb8d476c2008-12-12 17:08:31 +0200740 layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
741 sdata->vif.type == NL80211_IFTYPE_AP;
742
Johannes Berg73651ee2008-02-25 16:27:47 +0100743 rcu_read_lock();
744
745 err = sta_info_insert(sta);
746 if (err) {
Johannes Berg93e5deb2008-04-01 15:21:00 +0200747 /* STA has been freed */
Jouni Malinenb8d476c2008-12-12 17:08:31 +0200748 if (err == -EEXIST && layer2_update) {
749 /* Need to update layer 2 devices on reassociation */
750 sta = sta_info_get(local, mac);
751 if (sta)
752 ieee80211_send_layer2_update(sta);
753 }
Johannes Berg73651ee2008-02-25 16:27:47 +0100754 rcu_read_unlock();
755 return err;
756 }
757
Jouni Malinenb8d476c2008-12-12 17:08:31 +0200758 if (layer2_update)
Johannes Berg73651ee2008-02-25 16:27:47 +0100759 ieee80211_send_layer2_update(sta);
760
761 rcu_read_unlock();
762
Johannes Berg4fd69312007-12-19 02:03:35 +0100763 return 0;
764}
765
766static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
767 u8 *mac)
768{
Johannes Berg14db74b2008-07-29 13:22:52 +0200769 struct ieee80211_local *local = wiphy_priv(wiphy);
770 struct ieee80211_sub_if_data *sdata;
Johannes Berg4fd69312007-12-19 02:03:35 +0100771 struct sta_info *sta;
772
Johannes Berg14db74b2008-07-29 13:22:52 +0200773 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
774
Johannes Berg4fd69312007-12-19 02:03:35 +0100775 if (mac) {
Johannes Berg98dd6a52008-04-10 15:36:09 +0200776 rcu_read_lock();
777
Johannes Berg4fd69312007-12-19 02:03:35 +0100778 /* XXX: get sta belonging to dev */
779 sta = sta_info_get(local, mac);
Johannes Berg98dd6a52008-04-10 15:36:09 +0200780 if (!sta) {
781 rcu_read_unlock();
Johannes Berg4fd69312007-12-19 02:03:35 +0100782 return -ENOENT;
Johannes Berg98dd6a52008-04-10 15:36:09 +0200783 }
Johannes Berg4fd69312007-12-19 02:03:35 +0100784
Johannes Bergd0709a62008-02-25 16:27:46 +0100785 sta_info_unlink(&sta);
Johannes Berg98dd6a52008-04-10 15:36:09 +0200786 rcu_read_unlock();
787
Johannes Berg4f6fab42008-03-31 19:23:02 +0200788 sta_info_destroy(sta);
Johannes Berg4fd69312007-12-19 02:03:35 +0100789 } else
Johannes Bergd0709a62008-02-25 16:27:46 +0100790 sta_info_flush(local, sdata);
Johannes Berg4fd69312007-12-19 02:03:35 +0100791
792 return 0;
793}
794
795static int ieee80211_change_station(struct wiphy *wiphy,
796 struct net_device *dev,
797 u8 *mac,
798 struct station_parameters *params)
799{
Johannes Berg14db74b2008-07-29 13:22:52 +0200800 struct ieee80211_local *local = wiphy_priv(wiphy);
Johannes Berg4fd69312007-12-19 02:03:35 +0100801 struct sta_info *sta;
802 struct ieee80211_sub_if_data *vlansdata;
803
Johannes Berg98dd6a52008-04-10 15:36:09 +0200804 rcu_read_lock();
805
Johannes Berg4fd69312007-12-19 02:03:35 +0100806 /* XXX: get sta belonging to dev */
807 sta = sta_info_get(local, mac);
Johannes Berg98dd6a52008-04-10 15:36:09 +0200808 if (!sta) {
809 rcu_read_unlock();
Johannes Berg4fd69312007-12-19 02:03:35 +0100810 return -ENOENT;
Johannes Berg98dd6a52008-04-10 15:36:09 +0200811 }
Johannes Berg4fd69312007-12-19 02:03:35 +0100812
Johannes Bergd0709a62008-02-25 16:27:46 +0100813 if (params->vlan && params->vlan != sta->sdata->dev) {
Johannes Berg4fd69312007-12-19 02:03:35 +0100814 vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
815
Johannes Berg05c914f2008-09-11 00:01:58 +0200816 if (vlansdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
817 vlansdata->vif.type != NL80211_IFTYPE_AP) {
Johannes Berg98dd6a52008-04-10 15:36:09 +0200818 rcu_read_unlock();
Johannes Berg4fd69312007-12-19 02:03:35 +0100819 return -EINVAL;
Johannes Berg98dd6a52008-04-10 15:36:09 +0200820 }
Johannes Berg4fd69312007-12-19 02:03:35 +0100821
Johannes Berg14db74b2008-07-29 13:22:52 +0200822 sta->sdata = vlansdata;
Johannes Berg4fd69312007-12-19 02:03:35 +0100823 ieee80211_send_layer2_update(sta);
824 }
825
826 sta_apply_parameters(local, sta, params);
827
Johannes Berg98dd6a52008-04-10 15:36:09 +0200828 rcu_read_unlock();
829
Johannes Berg4fd69312007-12-19 02:03:35 +0100830 return 0;
831}
832
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100833#ifdef CONFIG_MAC80211_MESH
834static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
835 u8 *dst, u8 *next_hop)
836{
Johannes Berg14db74b2008-07-29 13:22:52 +0200837 struct ieee80211_local *local = wiphy_priv(wiphy);
838 struct ieee80211_sub_if_data *sdata;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100839 struct mesh_path *mpath;
840 struct sta_info *sta;
841 int err;
842
Johannes Berg14db74b2008-07-29 13:22:52 +0200843 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
844
Johannes Bergd0709a62008-02-25 16:27:46 +0100845 rcu_read_lock();
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100846 sta = sta_info_get(local, next_hop);
Johannes Bergd0709a62008-02-25 16:27:46 +0100847 if (!sta) {
848 rcu_read_unlock();
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100849 return -ENOENT;
Johannes Bergd0709a62008-02-25 16:27:46 +0100850 }
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100851
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200852 err = mesh_path_add(dst, sdata);
Johannes Bergd0709a62008-02-25 16:27:46 +0100853 if (err) {
854 rcu_read_unlock();
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100855 return err;
Johannes Bergd0709a62008-02-25 16:27:46 +0100856 }
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100857
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200858 mpath = mesh_path_lookup(dst, sdata);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100859 if (!mpath) {
860 rcu_read_unlock();
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100861 return -ENXIO;
862 }
863 mesh_path_fix_nexthop(mpath, sta);
Johannes Bergd0709a62008-02-25 16:27:46 +0100864
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100865 rcu_read_unlock();
866 return 0;
867}
868
869static int ieee80211_del_mpath(struct wiphy *wiphy, struct net_device *dev,
870 u8 *dst)
871{
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200872 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100873
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200874 if (dst)
875 return mesh_path_del(dst, sdata);
876
877 mesh_path_flush(sdata);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100878 return 0;
879}
880
881static int ieee80211_change_mpath(struct wiphy *wiphy,
882 struct net_device *dev,
883 u8 *dst, u8 *next_hop)
884{
Johannes Berg14db74b2008-07-29 13:22:52 +0200885 struct ieee80211_local *local = wiphy_priv(wiphy);
886 struct ieee80211_sub_if_data *sdata;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100887 struct mesh_path *mpath;
888 struct sta_info *sta;
889
Johannes Berg14db74b2008-07-29 13:22:52 +0200890 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
891
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100892 rcu_read_lock();
Johannes Bergd0709a62008-02-25 16:27:46 +0100893
894 sta = sta_info_get(local, next_hop);
895 if (!sta) {
896 rcu_read_unlock();
897 return -ENOENT;
898 }
899
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200900 mpath = mesh_path_lookup(dst, sdata);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100901 if (!mpath) {
902 rcu_read_unlock();
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100903 return -ENOENT;
904 }
905
906 mesh_path_fix_nexthop(mpath, sta);
Johannes Bergd0709a62008-02-25 16:27:46 +0100907
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100908 rcu_read_unlock();
909 return 0;
910}
911
912static void mpath_set_pinfo(struct mesh_path *mpath, u8 *next_hop,
913 struct mpath_info *pinfo)
914{
915 if (mpath->next_hop)
Johannes Berg17741cd2008-09-11 00:02:02 +0200916 memcpy(next_hop, mpath->next_hop->sta.addr, ETH_ALEN);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100917 else
918 memset(next_hop, 0, ETH_ALEN);
919
920 pinfo->filled = MPATH_INFO_FRAME_QLEN |
921 MPATH_INFO_DSN |
922 MPATH_INFO_METRIC |
923 MPATH_INFO_EXPTIME |
924 MPATH_INFO_DISCOVERY_TIMEOUT |
925 MPATH_INFO_DISCOVERY_RETRIES |
926 MPATH_INFO_FLAGS;
927
928 pinfo->frame_qlen = mpath->frame_queue.qlen;
929 pinfo->dsn = mpath->dsn;
930 pinfo->metric = mpath->metric;
931 if (time_before(jiffies, mpath->exp_time))
932 pinfo->exptime = jiffies_to_msecs(mpath->exp_time - jiffies);
933 pinfo->discovery_timeout =
934 jiffies_to_msecs(mpath->discovery_timeout);
935 pinfo->discovery_retries = mpath->discovery_retries;
936 pinfo->flags = 0;
937 if (mpath->flags & MESH_PATH_ACTIVE)
938 pinfo->flags |= NL80211_MPATH_FLAG_ACTIVE;
939 if (mpath->flags & MESH_PATH_RESOLVING)
940 pinfo->flags |= NL80211_MPATH_FLAG_RESOLVING;
941 if (mpath->flags & MESH_PATH_DSN_VALID)
942 pinfo->flags |= NL80211_MPATH_FLAG_DSN_VALID;
943 if (mpath->flags & MESH_PATH_FIXED)
944 pinfo->flags |= NL80211_MPATH_FLAG_FIXED;
945 if (mpath->flags & MESH_PATH_RESOLVING)
946 pinfo->flags |= NL80211_MPATH_FLAG_RESOLVING;
947
948 pinfo->flags = mpath->flags;
949}
950
951static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev,
952 u8 *dst, u8 *next_hop, struct mpath_info *pinfo)
953
954{
Johannes Berg14db74b2008-07-29 13:22:52 +0200955 struct ieee80211_sub_if_data *sdata;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100956 struct mesh_path *mpath;
957
Johannes Berg14db74b2008-07-29 13:22:52 +0200958 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
959
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100960 rcu_read_lock();
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200961 mpath = mesh_path_lookup(dst, sdata);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100962 if (!mpath) {
963 rcu_read_unlock();
964 return -ENOENT;
965 }
966 memcpy(dst, mpath->dst, ETH_ALEN);
967 mpath_set_pinfo(mpath, next_hop, pinfo);
968 rcu_read_unlock();
969 return 0;
970}
971
972static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
973 int idx, u8 *dst, u8 *next_hop,
974 struct mpath_info *pinfo)
975{
Johannes Berg14db74b2008-07-29 13:22:52 +0200976 struct ieee80211_sub_if_data *sdata;
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100977 struct mesh_path *mpath;
978
Johannes Berg14db74b2008-07-29 13:22:52 +0200979 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
980
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100981 rcu_read_lock();
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200982 mpath = mesh_path_lookup_by_idx(idx, sdata);
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +0100983 if (!mpath) {
984 rcu_read_unlock();
985 return -ENOENT;
986 }
987 memcpy(dst, mpath->dst, ETH_ALEN);
988 mpath_set_pinfo(mpath, next_hop, pinfo);
989 rcu_read_unlock();
990 return 0;
991}
colin@cozybit.com93da9cc2008-10-21 12:03:48 -0700992
993static int ieee80211_get_mesh_params(struct wiphy *wiphy,
994 struct net_device *dev,
995 struct mesh_config *conf)
996{
997 struct ieee80211_sub_if_data *sdata;
998 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
999
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001000 memcpy(conf, &(sdata->u.mesh.mshcfg), sizeof(struct mesh_config));
1001 return 0;
1002}
1003
1004static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm, u32 mask)
1005{
1006 return (mask >> (parm-1)) & 0x1;
1007}
1008
1009static int ieee80211_set_mesh_params(struct wiphy *wiphy,
1010 struct net_device *dev,
1011 const struct mesh_config *nconf, u32 mask)
1012{
1013 struct mesh_config *conf;
1014 struct ieee80211_sub_if_data *sdata;
1015 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1016
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001017 /* Set the config options which we are interested in setting */
1018 conf = &(sdata->u.mesh.mshcfg);
1019 if (_chg_mesh_attr(NL80211_MESHCONF_RETRY_TIMEOUT, mask))
1020 conf->dot11MeshRetryTimeout = nconf->dot11MeshRetryTimeout;
1021 if (_chg_mesh_attr(NL80211_MESHCONF_CONFIRM_TIMEOUT, mask))
1022 conf->dot11MeshConfirmTimeout = nconf->dot11MeshConfirmTimeout;
1023 if (_chg_mesh_attr(NL80211_MESHCONF_HOLDING_TIMEOUT, mask))
1024 conf->dot11MeshHoldingTimeout = nconf->dot11MeshHoldingTimeout;
1025 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_PEER_LINKS, mask))
1026 conf->dot11MeshMaxPeerLinks = nconf->dot11MeshMaxPeerLinks;
1027 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_RETRIES, mask))
1028 conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries;
1029 if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask))
1030 conf->dot11MeshTTL = nconf->dot11MeshTTL;
1031 if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask))
1032 conf->auto_open_plinks = nconf->auto_open_plinks;
1033 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, mask))
1034 conf->dot11MeshHWMPmaxPREQretries =
1035 nconf->dot11MeshHWMPmaxPREQretries;
1036 if (_chg_mesh_attr(NL80211_MESHCONF_PATH_REFRESH_TIME, mask))
1037 conf->path_refresh_time = nconf->path_refresh_time;
1038 if (_chg_mesh_attr(NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, mask))
1039 conf->min_discovery_timeout = nconf->min_discovery_timeout;
1040 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, mask))
1041 conf->dot11MeshHWMPactivePathTimeout =
1042 nconf->dot11MeshHWMPactivePathTimeout;
1043 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, mask))
1044 conf->dot11MeshHWMPpreqMinInterval =
1045 nconf->dot11MeshHWMPpreqMinInterval;
1046 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
1047 mask))
1048 conf->dot11MeshHWMPnetDiameterTraversalTime =
1049 nconf->dot11MeshHWMPnetDiameterTraversalTime;
1050 return 0;
1051}
1052
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +01001053#endif
1054
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001055static int ieee80211_change_bss(struct wiphy *wiphy,
1056 struct net_device *dev,
1057 struct bss_parameters *params)
1058{
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001059 struct ieee80211_sub_if_data *sdata;
1060 u32 changed = 0;
1061
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001062 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1063
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001064 if (params->use_cts_prot >= 0) {
Johannes Bergbda39332008-10-11 01:51:51 +02001065 sdata->vif.bss_conf.use_cts_prot = params->use_cts_prot;
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001066 changed |= BSS_CHANGED_ERP_CTS_PROT;
1067 }
1068 if (params->use_short_preamble >= 0) {
Johannes Bergbda39332008-10-11 01:51:51 +02001069 sdata->vif.bss_conf.use_short_preamble =
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001070 params->use_short_preamble;
1071 changed |= BSS_CHANGED_ERP_PREAMBLE;
1072 }
1073 if (params->use_short_slot_time >= 0) {
Johannes Bergbda39332008-10-11 01:51:51 +02001074 sdata->vif.bss_conf.use_short_slot =
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001075 params->use_short_slot_time;
1076 changed |= BSS_CHANGED_ERP_SLOT;
1077 }
1078
Jouni Malinen90c97a02008-10-30 16:59:22 +02001079 if (params->basic_rates) {
1080 int i, j;
1081 u32 rates = 0;
1082 struct ieee80211_local *local = wiphy_priv(wiphy);
1083 struct ieee80211_supported_band *sband =
1084 wiphy->bands[local->oper_channel->band];
1085
1086 for (i = 0; i < params->basic_rates_len; i++) {
1087 int rate = (params->basic_rates[i] & 0x7f) * 5;
1088 for (j = 0; j < sband->n_bitrates; j++) {
1089 if (sband->bitrates[j].bitrate == rate)
1090 rates |= BIT(j);
1091 }
1092 }
1093 sdata->vif.bss_conf.basic_rates = rates;
1094 changed |= BSS_CHANGED_BASIC_RATES;
1095 }
1096
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001097 ieee80211_bss_info_change_notify(sdata, changed);
1098
1099 return 0;
1100}
1101
Jouni Malinen31888482008-10-30 16:59:24 +02001102static int ieee80211_set_txq_params(struct wiphy *wiphy,
1103 struct ieee80211_txq_params *params)
1104{
1105 struct ieee80211_local *local = wiphy_priv(wiphy);
1106 struct ieee80211_tx_queue_params p;
1107
1108 if (!local->ops->conf_tx)
1109 return -EOPNOTSUPP;
1110
1111 memset(&p, 0, sizeof(p));
1112 p.aifs = params->aifs;
1113 p.cw_max = params->cwmax;
1114 p.cw_min = params->cwmin;
1115 p.txop = params->txop;
1116 if (local->ops->conf_tx(local_to_hw(local), params->queue, &p)) {
1117 printk(KERN_DEBUG "%s: failed to set TX queue "
1118 "parameters for queue %d\n", local->mdev->name,
1119 params->queue);
1120 return -EINVAL;
1121 }
1122
1123 return 0;
1124}
1125
Jouni Malinen72bdcf32008-11-26 16:15:24 +02001126static int ieee80211_set_channel(struct wiphy *wiphy,
1127 struct ieee80211_channel *chan,
Sujith094d05d2008-12-12 11:57:43 +05301128 enum nl80211_channel_type channel_type)
Jouni Malinen72bdcf32008-11-26 16:15:24 +02001129{
1130 struct ieee80211_local *local = wiphy_priv(wiphy);
1131
1132 local->oper_channel = chan;
Sujith094d05d2008-12-12 11:57:43 +05301133 local->oper_channel_type = channel_type;
Jouni Malinen72bdcf32008-11-26 16:15:24 +02001134
1135 return ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
1136}
1137
Bob Copeland665af4f2009-01-19 11:20:53 -05001138#ifdef CONFIG_PM
1139static int ieee80211_suspend(struct wiphy *wiphy)
1140{
1141 return __ieee80211_suspend(wiphy_priv(wiphy));
1142}
1143
1144static int ieee80211_resume(struct wiphy *wiphy)
1145{
1146 return __ieee80211_resume(wiphy_priv(wiphy));
1147}
1148#else
1149#define ieee80211_suspend NULL
1150#define ieee80211_resume NULL
1151#endif
1152
Johannes Berg2a519312009-02-10 21:25:55 +01001153static int ieee80211_scan(struct wiphy *wiphy,
1154 struct net_device *dev,
1155 struct cfg80211_scan_request *req)
1156{
1157 struct ieee80211_sub_if_data *sdata;
1158
Johannes Berg2a519312009-02-10 21:25:55 +01001159 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1160
1161 if (sdata->vif.type != NL80211_IFTYPE_STATION &&
1162 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
Jouni Malinen357303e2009-04-16 18:44:53 +03001163 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
1164 (sdata->vif.type != NL80211_IFTYPE_AP || sdata->u.ap.beacon))
Johannes Berg2a519312009-02-10 21:25:55 +01001165 return -EOPNOTSUPP;
1166
1167 return ieee80211_request_scan(sdata, req);
1168}
1169
Jouni Malinen636a5d32009-03-19 13:39:22 +02001170static int ieee80211_auth(struct wiphy *wiphy, struct net_device *dev,
1171 struct cfg80211_auth_request *req)
1172{
1173 struct ieee80211_sub_if_data *sdata;
1174
Jouni Malinen636a5d32009-03-19 13:39:22 +02001175 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1176
Jouni Malinen636a5d32009-03-19 13:39:22 +02001177 switch (req->auth_type) {
1178 case NL80211_AUTHTYPE_OPEN_SYSTEM:
1179 sdata->u.mgd.auth_algs = IEEE80211_AUTH_ALG_OPEN;
1180 break;
1181 case NL80211_AUTHTYPE_SHARED_KEY:
1182 sdata->u.mgd.auth_algs = IEEE80211_AUTH_ALG_SHARED_KEY;
1183 break;
1184 case NL80211_AUTHTYPE_FT:
1185 sdata->u.mgd.auth_algs = IEEE80211_AUTH_ALG_FT;
1186 break;
1187 case NL80211_AUTHTYPE_NETWORK_EAP:
1188 sdata->u.mgd.auth_algs = IEEE80211_AUTH_ALG_LEAP;
1189 break;
1190 default:
1191 return -EOPNOTSUPP;
1192 }
1193
1194 memcpy(sdata->u.mgd.bssid, req->peer_addr, ETH_ALEN);
1195 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
1196 sdata->u.mgd.flags |= IEEE80211_STA_BSSID_SET;
1197
1198 /* TODO: req->chan */
1199 sdata->u.mgd.flags |= IEEE80211_STA_AUTO_CHANNEL_SEL;
1200
1201 if (req->ssid) {
1202 sdata->u.mgd.flags |= IEEE80211_STA_SSID_SET;
1203 memcpy(sdata->u.mgd.ssid, req->ssid, req->ssid_len);
1204 sdata->u.mgd.ssid_len = req->ssid_len;
1205 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
1206 }
1207
1208 kfree(sdata->u.mgd.sme_auth_ie);
1209 sdata->u.mgd.sme_auth_ie = NULL;
1210 sdata->u.mgd.sme_auth_ie_len = 0;
1211 if (req->ie) {
1212 sdata->u.mgd.sme_auth_ie = kmalloc(req->ie_len, GFP_KERNEL);
1213 if (sdata->u.mgd.sme_auth_ie == NULL)
1214 return -ENOMEM;
1215 memcpy(sdata->u.mgd.sme_auth_ie, req->ie, req->ie_len);
1216 sdata->u.mgd.sme_auth_ie_len = req->ie_len;
1217 }
1218
1219 sdata->u.mgd.flags |= IEEE80211_STA_EXT_SME;
1220 sdata->u.mgd.state = IEEE80211_STA_MLME_DIRECT_PROBE;
1221 ieee80211_sta_req_auth(sdata);
1222 return 0;
1223}
1224
1225static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev,
1226 struct cfg80211_assoc_request *req)
1227{
1228 struct ieee80211_sub_if_data *sdata;
1229 int ret;
1230
Jouni Malinen636a5d32009-03-19 13:39:22 +02001231 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1232
Jouni Malinen636a5d32009-03-19 13:39:22 +02001233 if (memcmp(sdata->u.mgd.bssid, req->peer_addr, ETH_ALEN) != 0 ||
1234 !(sdata->u.mgd.flags & IEEE80211_STA_AUTHENTICATED))
1235 return -ENOLINK; /* not authenticated */
1236
1237 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
1238 sdata->u.mgd.flags |= IEEE80211_STA_BSSID_SET;
1239
1240 /* TODO: req->chan */
1241 sdata->u.mgd.flags |= IEEE80211_STA_AUTO_CHANNEL_SEL;
1242
1243 if (req->ssid) {
1244 sdata->u.mgd.flags |= IEEE80211_STA_SSID_SET;
1245 memcpy(sdata->u.mgd.ssid, req->ssid, req->ssid_len);
1246 sdata->u.mgd.ssid_len = req->ssid_len;
1247 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
1248 } else
1249 sdata->u.mgd.flags |= IEEE80211_STA_AUTO_SSID_SEL;
1250
1251 ret = ieee80211_sta_set_extra_ie(sdata, req->ie, req->ie_len);
1252 if (ret)
1253 return ret;
1254
1255 sdata->u.mgd.flags |= IEEE80211_STA_EXT_SME;
1256 sdata->u.mgd.state = IEEE80211_STA_MLME_ASSOCIATE;
1257 ieee80211_sta_req_auth(sdata);
1258 return 0;
1259}
1260
1261static int ieee80211_deauth(struct wiphy *wiphy, struct net_device *dev,
1262 struct cfg80211_deauth_request *req)
1263{
Johannes Berg691597c2009-04-19 19:57:45 +02001264 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
Jouni Malinen636a5d32009-03-19 13:39:22 +02001265
Johannes Berg691597c2009-04-19 19:57:45 +02001266 /* TODO: req->ie, req->peer_addr */
Jouni Malinen636a5d32009-03-19 13:39:22 +02001267 return ieee80211_sta_deauthenticate(sdata, req->reason_code);
1268}
1269
1270static int ieee80211_disassoc(struct wiphy *wiphy, struct net_device *dev,
1271 struct cfg80211_disassoc_request *req)
1272{
Johannes Berg691597c2009-04-19 19:57:45 +02001273 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
Jouni Malinen636a5d32009-03-19 13:39:22 +02001274
Johannes Berg691597c2009-04-19 19:57:45 +02001275 /* TODO: req->ie, req->peer_addr */
Jouni Malinen636a5d32009-03-19 13:39:22 +02001276 return ieee80211_sta_disassociate(sdata, req->reason_code);
1277}
1278
Johannes Bergaf8cdcd2009-04-19 21:25:43 +02001279static int ieee80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
1280 struct cfg80211_ibss_params *params)
1281{
1282 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1283
1284 return ieee80211_ibss_join(sdata, params);
1285}
1286
1287static int ieee80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
1288{
1289 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1290
1291 return ieee80211_ibss_leave(sdata);
1292}
1293
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02001294static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
1295{
1296 struct ieee80211_local *local = wiphy_priv(wiphy);
1297
1298 if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
1299 int err;
1300
1301 if (local->ops->set_rts_threshold) {
1302 err = local->ops->set_rts_threshold(
1303 local_to_hw(local), wiphy->rts_threshold);
1304 if (err)
1305 return err;
1306 }
1307 }
1308
1309 if (changed & WIPHY_PARAM_RETRY_SHORT)
1310 local->hw.conf.short_frame_max_tx_count = wiphy->retry_short;
1311 if (changed & WIPHY_PARAM_RETRY_LONG)
1312 local->hw.conf.long_frame_max_tx_count = wiphy->retry_long;
1313 if (changed &
1314 (WIPHY_PARAM_RETRY_SHORT | WIPHY_PARAM_RETRY_LONG))
1315 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_RETRY_LIMITS);
1316
1317 return 0;
1318}
1319
Jiri Bencf0706e82007-05-05 11:45:53 -07001320struct cfg80211_ops mac80211_config_ops = {
1321 .add_virtual_intf = ieee80211_add_iface,
1322 .del_virtual_intf = ieee80211_del_iface,
Johannes Berg42613db2007-09-28 21:52:27 +02001323 .change_virtual_intf = ieee80211_change_iface,
Johannes Berge8cbb4c2007-12-19 02:03:30 +01001324 .add_key = ieee80211_add_key,
1325 .del_key = ieee80211_del_key,
Johannes Berg62da92f2007-12-19 02:03:31 +01001326 .get_key = ieee80211_get_key,
Johannes Berge8cbb4c2007-12-19 02:03:30 +01001327 .set_default_key = ieee80211_config_default_key,
Jouni Malinen3cfcf6a2009-01-08 13:32:02 +02001328 .set_default_mgmt_key = ieee80211_config_default_mgmt_key,
Johannes Berg5dfdaf52007-12-19 02:03:33 +01001329 .add_beacon = ieee80211_add_beacon,
1330 .set_beacon = ieee80211_set_beacon,
1331 .del_beacon = ieee80211_del_beacon,
Johannes Berg4fd69312007-12-19 02:03:35 +01001332 .add_station = ieee80211_add_station,
1333 .del_station = ieee80211_del_station,
1334 .change_station = ieee80211_change_station,
Johannes Berg7bbdd2d2007-12-19 02:03:37 +01001335 .get_station = ieee80211_get_station,
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +01001336 .dump_station = ieee80211_dump_station,
1337#ifdef CONFIG_MAC80211_MESH
1338 .add_mpath = ieee80211_add_mpath,
1339 .del_mpath = ieee80211_del_mpath,
1340 .change_mpath = ieee80211_change_mpath,
1341 .get_mpath = ieee80211_get_mpath,
1342 .dump_mpath = ieee80211_dump_mpath,
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001343 .set_mesh_params = ieee80211_set_mesh_params,
1344 .get_mesh_params = ieee80211_get_mesh_params,
Luis Carlos Coboc5dd9c22008-02-23 15:17:17 +01001345#endif
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001346 .change_bss = ieee80211_change_bss,
Jouni Malinen31888482008-10-30 16:59:24 +02001347 .set_txq_params = ieee80211_set_txq_params,
Jouni Malinen72bdcf32008-11-26 16:15:24 +02001348 .set_channel = ieee80211_set_channel,
Bob Copeland665af4f2009-01-19 11:20:53 -05001349 .suspend = ieee80211_suspend,
1350 .resume = ieee80211_resume,
Johannes Berg2a519312009-02-10 21:25:55 +01001351 .scan = ieee80211_scan,
Jouni Malinen636a5d32009-03-19 13:39:22 +02001352 .auth = ieee80211_auth,
1353 .assoc = ieee80211_assoc,
1354 .deauth = ieee80211_deauth,
1355 .disassoc = ieee80211_disassoc,
Johannes Bergaf8cdcd2009-04-19 21:25:43 +02001356 .join_ibss = ieee80211_join_ibss,
1357 .leave_ibss = ieee80211_leave_ibss,
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02001358 .set_wiphy_params = ieee80211_set_wiphy_params,
Jiri Bencf0706e82007-05-05 11:45:53 -07001359};