ieee80211softmac_module.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. /*
  2. * Contains some basic softmac functions along with module registration code etc.
  3. *
  4. * Copyright (c) 2005, 2006 Johannes Berg <johannes@sipsolutions.net>
  5. * Joseph Jezak <josejx@gentoo.org>
  6. * Larry Finger <Larry.Finger@lwfinger.net>
  7. * Danny van Dyk <kugelfang@gentoo.org>
  8. * Michael Buesch <mbuesch@freenet.de>
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of version 2 of the GNU General Public License as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but WITHOUT
  15. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  16. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  17. * more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * The full GNU General Public License is included in this distribution in the
  24. * file called COPYING.
  25. */
  26. #include "ieee80211softmac_priv.h"
  27. #include <linux/sort.h>
  28. #include <linux/etherdevice.h>
  29. struct net_device *alloc_ieee80211softmac(int sizeof_priv)
  30. {
  31. struct ieee80211softmac_device *softmac;
  32. struct net_device *dev;
  33. dev = alloc_ieee80211(sizeof(*softmac) + sizeof_priv);
  34. if (!dev)
  35. return NULL;
  36. softmac = ieee80211_priv(dev);
  37. softmac->dev = dev;
  38. softmac->ieee = netdev_priv(dev);
  39. spin_lock_init(&softmac->lock);
  40. softmac->ieee->handle_auth = ieee80211softmac_auth_resp;
  41. softmac->ieee->handle_deauth = ieee80211softmac_deauth_resp;
  42. softmac->ieee->handle_assoc_response = ieee80211softmac_handle_assoc_response;
  43. softmac->ieee->handle_reassoc_request = ieee80211softmac_handle_reassoc_req;
  44. softmac->ieee->handle_disassoc = ieee80211softmac_handle_disassoc;
  45. softmac->ieee->handle_beacon = ieee80211softmac_handle_beacon;
  46. softmac->scaninfo = NULL;
  47. softmac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT;
  48. /* TODO: initialise all the other callbacks in the ieee struct
  49. * (once they're written)
  50. */
  51. INIT_LIST_HEAD(&softmac->auth_queue);
  52. INIT_LIST_HEAD(&softmac->network_list);
  53. INIT_LIST_HEAD(&softmac->events);
  54. mutex_init(&softmac->associnfo.mutex);
  55. INIT_DELAYED_WORK(&softmac->associnfo.work, ieee80211softmac_assoc_work);
  56. INIT_DELAYED_WORK(&softmac->associnfo.timeout, ieee80211softmac_assoc_timeout);
  57. softmac->start_scan = ieee80211softmac_start_scan_implementation;
  58. softmac->wait_for_scan = ieee80211softmac_wait_for_scan_implementation;
  59. softmac->stop_scan = ieee80211softmac_stop_scan_implementation;
  60. /* to start with, we can't send anything ... */
  61. netif_carrier_off(dev);
  62. return dev;
  63. }
  64. EXPORT_SYMBOL_GPL(alloc_ieee80211softmac);
  65. /* Clears the pending work queue items, stops all scans, etc. */
  66. void
  67. ieee80211softmac_clear_pending_work(struct ieee80211softmac_device *sm)
  68. {
  69. unsigned long flags;
  70. struct ieee80211softmac_event *eventptr, *eventtmp;
  71. struct ieee80211softmac_auth_queue_item *authptr, *authtmp;
  72. struct ieee80211softmac_network *netptr, *nettmp;
  73. ieee80211softmac_stop_scan(sm);
  74. ieee80211softmac_wait_for_scan(sm);
  75. spin_lock_irqsave(&sm->lock, flags);
  76. sm->running = 0;
  77. /* Free all pending assoc work items */
  78. cancel_delayed_work(&sm->associnfo.work);
  79. /* Free all pending scan work items */
  80. if(sm->scaninfo != NULL)
  81. cancel_delayed_work(&sm->scaninfo->softmac_scan);
  82. /* Free all pending auth work items */
  83. list_for_each_entry(authptr, &sm->auth_queue, list)
  84. cancel_delayed_work(&authptr->work);
  85. /* delete all pending event calls and work items */
  86. list_for_each_entry_safe(eventptr, eventtmp, &sm->events, list)
  87. cancel_delayed_work(&eventptr->work);
  88. spin_unlock_irqrestore(&sm->lock, flags);
  89. flush_scheduled_work();
  90. /* now we should be save and no longer need locking... */
  91. spin_lock_irqsave(&sm->lock, flags);
  92. /* Free all pending auth work items */
  93. list_for_each_entry_safe(authptr, authtmp, &sm->auth_queue, list) {
  94. list_del(&authptr->list);
  95. kfree(authptr);
  96. }
  97. /* delete all pending event calls and work items */
  98. list_for_each_entry_safe(eventptr, eventtmp, &sm->events, list) {
  99. list_del(&eventptr->list);
  100. kfree(eventptr);
  101. }
  102. /* Free all networks */
  103. list_for_each_entry_safe(netptr, nettmp, &sm->network_list, list) {
  104. ieee80211softmac_del_network_locked(sm, netptr);
  105. if(netptr->challenge != NULL)
  106. kfree(netptr->challenge);
  107. kfree(netptr);
  108. }
  109. spin_unlock_irqrestore(&sm->lock, flags);
  110. }
  111. EXPORT_SYMBOL_GPL(ieee80211softmac_clear_pending_work);
  112. void free_ieee80211softmac(struct net_device *dev)
  113. {
  114. struct ieee80211softmac_device *sm = ieee80211_priv(dev);
  115. ieee80211softmac_clear_pending_work(sm);
  116. kfree(sm->scaninfo);
  117. kfree(sm->wpa.IE);
  118. free_ieee80211(dev);
  119. }
  120. EXPORT_SYMBOL_GPL(free_ieee80211softmac);
  121. static void ieee80211softmac_start_check_rates(struct ieee80211softmac_device *mac)
  122. {
  123. struct ieee80211softmac_ratesinfo *ri = &mac->ratesinfo;
  124. /* I took out the sorting check, we're seperating by modulation now. */
  125. if (ri->count)
  126. return;
  127. /* otherwise assume we hav'em all! */
  128. if (mac->ieee->modulation & IEEE80211_CCK_MODULATION) {
  129. ri->rates[ri->count++] = IEEE80211_CCK_RATE_1MB;
  130. ri->rates[ri->count++] = IEEE80211_CCK_RATE_2MB;
  131. ri->rates[ri->count++] = IEEE80211_CCK_RATE_5MB;
  132. ri->rates[ri->count++] = IEEE80211_CCK_RATE_11MB;
  133. }
  134. if (mac->ieee->modulation & IEEE80211_OFDM_MODULATION) {
  135. ri->rates[ri->count++] = IEEE80211_OFDM_RATE_6MB;
  136. ri->rates[ri->count++] = IEEE80211_OFDM_RATE_9MB;
  137. ri->rates[ri->count++] = IEEE80211_OFDM_RATE_12MB;
  138. ri->rates[ri->count++] = IEEE80211_OFDM_RATE_18MB;
  139. ri->rates[ri->count++] = IEEE80211_OFDM_RATE_24MB;
  140. ri->rates[ri->count++] = IEEE80211_OFDM_RATE_36MB;
  141. ri->rates[ri->count++] = IEEE80211_OFDM_RATE_48MB;
  142. ri->rates[ri->count++] = IEEE80211_OFDM_RATE_54MB;
  143. }
  144. }
  145. int ieee80211softmac_ratesinfo_rate_supported(struct ieee80211softmac_ratesinfo *ri, u8 rate)
  146. {
  147. int search;
  148. u8 search_rate;
  149. for (search = 0; search < ri->count; search++) {
  150. search_rate = ri->rates[search];
  151. search_rate &= ~IEEE80211_BASIC_RATE_MASK;
  152. if (rate == search_rate)
  153. return 1;
  154. }
  155. return 0;
  156. }
  157. u8 ieee80211softmac_highest_supported_rate(struct ieee80211softmac_device *mac,
  158. struct ieee80211softmac_ratesinfo *ri, int basic_only)
  159. {
  160. u8 user_rate = mac->txrates.user_rate;
  161. int i;
  162. if (ri->count == 0)
  163. return IEEE80211_CCK_RATE_1MB;
  164. for (i = ri->count - 1; i >= 0; i--) {
  165. u8 rate = ri->rates[i];
  166. if (basic_only && !(rate & IEEE80211_BASIC_RATE_MASK))
  167. continue;
  168. rate &= ~IEEE80211_BASIC_RATE_MASK;
  169. if (rate > user_rate)
  170. continue;
  171. if (ieee80211softmac_ratesinfo_rate_supported(&mac->ratesinfo, rate))
  172. return rate;
  173. }
  174. /* If we haven't found a suitable rate by now, just trust the user */
  175. return user_rate;
  176. }
  177. EXPORT_SYMBOL_GPL(ieee80211softmac_highest_supported_rate);
  178. void ieee80211softmac_process_erp(struct ieee80211softmac_device *mac,
  179. u8 erp_value)
  180. {
  181. int use_protection;
  182. int short_preamble;
  183. u32 changes = 0;
  184. /* Barker preamble mode */
  185. short_preamble = ((erp_value & WLAN_ERP_BARKER_PREAMBLE) == 0
  186. && mac->associnfo.short_preamble_available) ? 1 : 0;
  187. /* Protection needed? */
  188. use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0;
  189. if (mac->bssinfo.short_preamble != short_preamble) {
  190. changes |= IEEE80211SOFTMAC_BSSINFOCHG_SHORT_PREAMBLE;
  191. mac->bssinfo.short_preamble = short_preamble;
  192. }
  193. if (mac->bssinfo.use_protection != use_protection) {
  194. changes |= IEEE80211SOFTMAC_BSSINFOCHG_PROTECTION;
  195. mac->bssinfo.use_protection = use_protection;
  196. }
  197. if (mac->bssinfo_change && changes)
  198. mac->bssinfo_change(mac->dev, changes);
  199. }
  200. void ieee80211softmac_recalc_txrates(struct ieee80211softmac_device *mac)
  201. {
  202. struct ieee80211softmac_txrates *txrates = &mac->txrates;
  203. u32 change = 0;
  204. change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT;
  205. txrates->default_rate = ieee80211softmac_highest_supported_rate(mac, &mac->bssinfo.supported_rates, 0);
  206. change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK;
  207. txrates->default_fallback = lower_rate(mac, txrates->default_rate);
  208. change |= IEEE80211SOFTMAC_TXRATECHG_MCAST;
  209. txrates->mcast_rate = ieee80211softmac_highest_supported_rate(mac, &mac->bssinfo.supported_rates, 1);
  210. if (mac->txrates_change)
  211. mac->txrates_change(mac->dev, change);
  212. }
  213. void ieee80211softmac_init_bss(struct ieee80211softmac_device *mac)
  214. {
  215. struct ieee80211_device *ieee = mac->ieee;
  216. u32 change = 0;
  217. struct ieee80211softmac_txrates *txrates = &mac->txrates;
  218. struct ieee80211softmac_bss_info *bssinfo = &mac->bssinfo;
  219. /* TODO: We need some kind of state machine to lower the default rates
  220. * if we loose too many packets.
  221. */
  222. /* Change the default txrate to the highest possible value.
  223. * The txrate machine will lower it, if it is too high.
  224. */
  225. if (ieee->modulation & IEEE80211_OFDM_MODULATION)
  226. txrates->user_rate = IEEE80211_OFDM_RATE_24MB;
  227. else
  228. txrates->user_rate = IEEE80211_CCK_RATE_11MB;
  229. txrates->default_rate = IEEE80211_CCK_RATE_1MB;
  230. change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT;
  231. txrates->default_fallback = IEEE80211_CCK_RATE_1MB;
  232. change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK;
  233. txrates->mcast_rate = IEEE80211_CCK_RATE_1MB;
  234. change |= IEEE80211SOFTMAC_TXRATECHG_MCAST;
  235. txrates->mgt_mcast_rate = IEEE80211_CCK_RATE_1MB;
  236. change |= IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST;
  237. if (mac->txrates_change)
  238. mac->txrates_change(mac->dev, change);
  239. change = 0;
  240. bssinfo->supported_rates.count = 0;
  241. memset(bssinfo->supported_rates.rates, 0,
  242. sizeof(bssinfo->supported_rates.rates));
  243. change |= IEEE80211SOFTMAC_BSSINFOCHG_RATES;
  244. bssinfo->short_preamble = 0;
  245. change |= IEEE80211SOFTMAC_BSSINFOCHG_SHORT_PREAMBLE;
  246. bssinfo->use_protection = 0;
  247. change |= IEEE80211SOFTMAC_BSSINFOCHG_PROTECTION;
  248. if (mac->bssinfo_change)
  249. mac->bssinfo_change(mac->dev, change);
  250. mac->running = 1;
  251. }
  252. void ieee80211softmac_start(struct net_device *dev)
  253. {
  254. struct ieee80211softmac_device *mac = ieee80211_priv(dev);
  255. ieee80211softmac_start_check_rates(mac);
  256. ieee80211softmac_init_bss(mac);
  257. }
  258. EXPORT_SYMBOL_GPL(ieee80211softmac_start);
  259. void ieee80211softmac_stop(struct net_device *dev)
  260. {
  261. struct ieee80211softmac_device *mac = ieee80211_priv(dev);
  262. ieee80211softmac_clear_pending_work(mac);
  263. }
  264. EXPORT_SYMBOL_GPL(ieee80211softmac_stop);
  265. void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates)
  266. {
  267. struct ieee80211softmac_device *mac = ieee80211_priv(dev);
  268. unsigned long flags;
  269. spin_lock_irqsave(&mac->lock, flags);
  270. memcpy(mac->ratesinfo.rates, rates, count);
  271. mac->ratesinfo.count = count;
  272. spin_unlock_irqrestore(&mac->lock, flags);
  273. }
  274. EXPORT_SYMBOL_GPL(ieee80211softmac_set_rates);
  275. static u8 raise_rate(struct ieee80211softmac_device *mac, u8 rate)
  276. {
  277. int i;
  278. struct ieee80211softmac_ratesinfo *ri = &mac->ratesinfo;
  279. for (i=0; i<ri->count-1; i++) {
  280. if (ri->rates[i] == rate)
  281. return ri->rates[i+1];
  282. }
  283. /* I guess we can't go any higher... */
  284. return ri->rates[ri->count];
  285. }
  286. u8 ieee80211softmac_lower_rate_delta(struct ieee80211softmac_device *mac, u8 rate, int delta)
  287. {
  288. int i;
  289. struct ieee80211softmac_ratesinfo *ri = &mac->ratesinfo;
  290. for (i=delta; i<ri->count; i++) {
  291. if (ri->rates[i] == rate)
  292. return ri->rates[i-delta];
  293. }
  294. /* I guess we can't go any lower... */
  295. return ri->rates[0];
  296. }
  297. static void ieee80211softmac_add_txrates_badness(struct ieee80211softmac_device *mac,
  298. int amount)
  299. {
  300. u8 default_rate = mac->txrates.default_rate;
  301. u8 default_fallback = mac->txrates.default_fallback;
  302. u32 changes = 0;
  303. //TODO: This is highly experimental code.
  304. // Maybe the dynamic rate selection does not work
  305. // and it has to be removed again.
  306. printk("badness %d\n", mac->txrate_badness);
  307. mac->txrate_badness += amount;
  308. if (mac->txrate_badness <= -1000) {
  309. /* Very small badness. Try a faster bitrate. */
  310. default_rate = raise_rate(mac, default_rate);
  311. changes |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT;
  312. default_fallback = get_fallback_rate(mac, default_rate);
  313. changes |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK;
  314. mac->txrate_badness = 0;
  315. printk("Bitrate raised to %u\n", default_rate);
  316. } else if (mac->txrate_badness >= 10000) {
  317. /* Very high badness. Try a slower bitrate. */
  318. default_rate = lower_rate(mac, default_rate);
  319. changes |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT;
  320. default_fallback = get_fallback_rate(mac, default_rate);
  321. changes |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK;
  322. mac->txrate_badness = 0;
  323. printk("Bitrate lowered to %u\n", default_rate);
  324. }
  325. mac->txrates.default_rate = default_rate;
  326. mac->txrates.default_fallback = default_fallback;
  327. if (changes && mac->txrates_change)
  328. mac->txrates_change(mac->dev, changes);
  329. }
  330. void ieee80211softmac_fragment_lost(struct net_device *dev,
  331. u16 wl_seq)
  332. {
  333. struct ieee80211softmac_device *mac = ieee80211_priv(dev);
  334. unsigned long flags;
  335. spin_lock_irqsave(&mac->lock, flags);
  336. ieee80211softmac_add_txrates_badness(mac, 1000);
  337. //TODO
  338. spin_unlock_irqrestore(&mac->lock, flags);
  339. }
  340. EXPORT_SYMBOL_GPL(ieee80211softmac_fragment_lost);
  341. static int rate_cmp(const void *a_, const void *b_) {
  342. u8 *a, *b;
  343. a = (u8*)a_;
  344. b = (u8*)b_;
  345. return ((*a & ~IEEE80211_BASIC_RATE_MASK) - (*b & ~IEEE80211_BASIC_RATE_MASK));
  346. }
  347. /* Allocate a softmac network struct and fill it from a network */
  348. struct ieee80211softmac_network *
  349. ieee80211softmac_create_network(struct ieee80211softmac_device *mac,
  350. struct ieee80211_network *net)
  351. {
  352. struct ieee80211softmac_network *softnet;
  353. softnet = kzalloc(sizeof(struct ieee80211softmac_network), GFP_ATOMIC);
  354. if(softnet == NULL)
  355. return NULL;
  356. memcpy(softnet->bssid, net->bssid, ETH_ALEN);
  357. softnet->channel = net->channel;
  358. softnet->essid.len = net->ssid_len;
  359. memcpy(softnet->essid.data, net->ssid, softnet->essid.len);
  360. /* copy rates over */
  361. softnet->supported_rates.count = net->rates_len;
  362. memcpy(&softnet->supported_rates.rates[0], net->rates, net->rates_len);
  363. memcpy(&softnet->supported_rates.rates[softnet->supported_rates.count], net->rates_ex, net->rates_ex_len);
  364. softnet->supported_rates.count += net->rates_ex_len;
  365. sort(softnet->supported_rates.rates, softnet->supported_rates.count, sizeof(softnet->supported_rates.rates[0]), rate_cmp, NULL);
  366. /* we save the ERP value because it is needed at association time, and
  367. * many AP's do not include an ERP IE in the association response. */
  368. softnet->erp_value = net->erp_value;
  369. softnet->capabilities = net->capability;
  370. return softnet;
  371. }
  372. /* Add a network to the list, while locked */
  373. void
  374. ieee80211softmac_add_network_locked(struct ieee80211softmac_device *mac,
  375. struct ieee80211softmac_network *add_net)
  376. {
  377. struct ieee80211softmac_network *softmac_net;
  378. list_for_each_entry(softmac_net, &mac->network_list, list) {
  379. if(!memcmp(softmac_net->bssid, add_net->bssid, ETH_ALEN))
  380. return;
  381. }
  382. list_add(&(add_net->list), &mac->network_list);
  383. }
  384. /* Add a network to the list, with locking */
  385. void
  386. ieee80211softmac_add_network(struct ieee80211softmac_device *mac,
  387. struct ieee80211softmac_network *add_net)
  388. {
  389. unsigned long flags;
  390. spin_lock_irqsave(&mac->lock, flags);
  391. ieee80211softmac_add_network_locked(mac, add_net);
  392. spin_unlock_irqrestore(&mac->lock, flags);
  393. }
  394. /* Delete a network from the list, while locked*/
  395. void
  396. ieee80211softmac_del_network_locked(struct ieee80211softmac_device *mac,
  397. struct ieee80211softmac_network *del_net)
  398. {
  399. list_del(&(del_net->list));
  400. }
  401. /* Delete a network from the list with locking */
  402. void
  403. ieee80211softmac_del_network(struct ieee80211softmac_device *mac,
  404. struct ieee80211softmac_network *del_net)
  405. {
  406. unsigned long flags;
  407. spin_lock_irqsave(&mac->lock, flags);
  408. ieee80211softmac_del_network_locked(mac, del_net);
  409. spin_unlock_irqrestore(&mac->lock, flags);
  410. }
  411. /* Get a network from the list by MAC while locked */
  412. struct ieee80211softmac_network *
  413. ieee80211softmac_get_network_by_bssid_locked(struct ieee80211softmac_device *mac,
  414. u8 *bssid)
  415. {
  416. struct ieee80211softmac_network *softmac_net;
  417. list_for_each_entry(softmac_net, &mac->network_list, list) {
  418. if(!memcmp(softmac_net->bssid, bssid, ETH_ALEN))
  419. return softmac_net;
  420. }
  421. return NULL;
  422. }
  423. /* Get a network from the list by BSSID with locking */
  424. struct ieee80211softmac_network *
  425. ieee80211softmac_get_network_by_bssid(struct ieee80211softmac_device *mac,
  426. u8 *bssid)
  427. {
  428. unsigned long flags;
  429. struct ieee80211softmac_network *softmac_net;
  430. spin_lock_irqsave(&mac->lock, flags);
  431. softmac_net = ieee80211softmac_get_network_by_bssid_locked(mac, bssid);
  432. spin_unlock_irqrestore(&mac->lock, flags);
  433. return softmac_net;
  434. }
  435. /* Get a network from the list by ESSID while locked */
  436. struct ieee80211softmac_network *
  437. ieee80211softmac_get_network_by_essid_locked(struct ieee80211softmac_device *mac,
  438. struct ieee80211softmac_essid *essid)
  439. {
  440. struct ieee80211softmac_network *softmac_net;
  441. list_for_each_entry(softmac_net, &mac->network_list, list) {
  442. if (softmac_net->essid.len == essid->len &&
  443. !memcmp(softmac_net->essid.data, essid->data, essid->len))
  444. return softmac_net;
  445. }
  446. return NULL;
  447. }
  448. /* Get a network from the list by ESSID with locking */
  449. struct ieee80211softmac_network *
  450. ieee80211softmac_get_network_by_essid(struct ieee80211softmac_device *mac,
  451. struct ieee80211softmac_essid *essid)
  452. {
  453. unsigned long flags;
  454. struct ieee80211softmac_network *softmac_net = NULL;
  455. spin_lock_irqsave(&mac->lock, flags);
  456. softmac_net = ieee80211softmac_get_network_by_essid_locked(mac, essid);
  457. spin_unlock_irqrestore(&mac->lock, flags);
  458. return softmac_net;
  459. }
  460. MODULE_LICENSE("GPL");
  461. MODULE_AUTHOR("Johannes Berg");
  462. MODULE_AUTHOR("Joseph Jezak");
  463. MODULE_AUTHOR("Larry Finger");
  464. MODULE_AUTHOR("Danny van Dyk");
  465. MODULE_AUTHOR("Michael Buesch");
  466. MODULE_DESCRIPTION("802.11 software MAC");