ibss.c 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149
  1. /*
  2. * IBSS mode implementation
  3. * Copyright 2003-2008, Jouni Malinen <j@w1.fi>
  4. * Copyright 2004, Instant802 Networks, Inc.
  5. * Copyright 2005, Devicescape Software, Inc.
  6. * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
  7. * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  8. * Copyright 2009, Johannes Berg <johannes@sipsolutions.net>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/delay.h>
  15. #include <linux/slab.h>
  16. #include <linux/if_ether.h>
  17. #include <linux/skbuff.h>
  18. #include <linux/if_arp.h>
  19. #include <linux/etherdevice.h>
  20. #include <linux/rtnetlink.h>
  21. #include <net/mac80211.h>
  22. #include "ieee80211_i.h"
  23. #include "driver-ops.h"
  24. #include "rate.h"
  25. #define IEEE80211_SCAN_INTERVAL (2 * HZ)
  26. #define IEEE80211_IBSS_JOIN_TIMEOUT (7 * HZ)
  27. #define IEEE80211_IBSS_MERGE_INTERVAL (30 * HZ)
  28. #define IEEE80211_IBSS_INACTIVITY_LIMIT (60 * HZ)
  29. #define IEEE80211_IBSS_MAX_STA_ENTRIES 128
  30. static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
  31. const u8 *bssid, const int beacon_int,
  32. struct ieee80211_channel *chan,
  33. const u32 basic_rates,
  34. const u16 capability, u64 tsf,
  35. bool creator)
  36. {
  37. struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
  38. struct ieee80211_local *local = sdata->local;
  39. int rates, i;
  40. struct ieee80211_mgmt *mgmt;
  41. u8 *pos;
  42. struct ieee80211_supported_band *sband;
  43. struct cfg80211_bss *bss;
  44. u32 bss_change;
  45. u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
  46. struct cfg80211_chan_def chandef;
  47. struct beacon_data *presp;
  48. int frame_len;
  49. sdata_assert_lock(sdata);
  50. /* Reset own TSF to allow time synchronization work. */
  51. drv_reset_tsf(local, sdata);
  52. if (!ether_addr_equal(ifibss->bssid, bssid))
  53. sta_info_flush(sdata);
  54. /* if merging, indicate to driver that we leave the old IBSS */
  55. if (sdata->vif.bss_conf.ibss_joined) {
  56. sdata->vif.bss_conf.ibss_joined = false;
  57. sdata->vif.bss_conf.ibss_creator = false;
  58. sdata->vif.bss_conf.enable_beacon = false;
  59. netif_carrier_off(sdata->dev);
  60. ieee80211_bss_info_change_notify(sdata,
  61. BSS_CHANGED_IBSS |
  62. BSS_CHANGED_BEACON_ENABLED);
  63. }
  64. presp = rcu_dereference_protected(ifibss->presp,
  65. lockdep_is_held(&sdata->wdev.mtx));
  66. rcu_assign_pointer(ifibss->presp, NULL);
  67. if (presp)
  68. kfree_rcu(presp, rcu_head);
  69. sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
  70. chandef = ifibss->chandef;
  71. if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef)) {
  72. chandef.width = NL80211_CHAN_WIDTH_20;
  73. chandef.center_freq1 = chan->center_freq;
  74. }
  75. ieee80211_vif_release_channel(sdata);
  76. if (ieee80211_vif_use_channel(sdata, &chandef,
  77. ifibss->fixed_channel ?
  78. IEEE80211_CHANCTX_SHARED :
  79. IEEE80211_CHANCTX_EXCLUSIVE)) {
  80. sdata_info(sdata, "Failed to join IBSS, no channel context\n");
  81. return;
  82. }
  83. memcpy(ifibss->bssid, bssid, ETH_ALEN);
  84. sband = local->hw.wiphy->bands[chan->band];
  85. /* Build IBSS probe response */
  86. frame_len = sizeof(struct ieee80211_hdr_3addr) +
  87. 12 /* struct ieee80211_mgmt.u.beacon */ +
  88. 2 + IEEE80211_MAX_SSID_LEN /* max SSID */ +
  89. 2 + 8 /* max Supported Rates */ +
  90. 3 /* max DS params */ +
  91. 4 /* IBSS params */ +
  92. 2 + (IEEE80211_MAX_SUPP_RATES - 8) +
  93. 2 + sizeof(struct ieee80211_ht_cap) +
  94. 2 + sizeof(struct ieee80211_ht_operation) +
  95. ifibss->ie_len;
  96. presp = kzalloc(sizeof(*presp) + frame_len, GFP_KERNEL);
  97. if (!presp)
  98. return;
  99. presp->head = (void *)(presp + 1);
  100. mgmt = (void *) presp->head;
  101. mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
  102. IEEE80211_STYPE_PROBE_RESP);
  103. eth_broadcast_addr(mgmt->da);
  104. memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
  105. memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN);
  106. mgmt->u.beacon.beacon_int = cpu_to_le16(beacon_int);
  107. mgmt->u.beacon.timestamp = cpu_to_le64(tsf);
  108. mgmt->u.beacon.capab_info = cpu_to_le16(capability);
  109. pos = (u8 *)mgmt + offsetof(struct ieee80211_mgmt, u.beacon.variable);
  110. *pos++ = WLAN_EID_SSID;
  111. *pos++ = ifibss->ssid_len;
  112. memcpy(pos, ifibss->ssid, ifibss->ssid_len);
  113. pos += ifibss->ssid_len;
  114. rates = min_t(int, 8, sband->n_bitrates);
  115. *pos++ = WLAN_EID_SUPP_RATES;
  116. *pos++ = rates;
  117. for (i = 0; i < rates; i++) {
  118. int rate = sband->bitrates[i].bitrate;
  119. u8 basic = 0;
  120. if (basic_rates & BIT(i))
  121. basic = 0x80;
  122. *pos++ = basic | (u8) (rate / 5);
  123. }
  124. if (sband->band == IEEE80211_BAND_2GHZ) {
  125. *pos++ = WLAN_EID_DS_PARAMS;
  126. *pos++ = 1;
  127. *pos++ = ieee80211_frequency_to_channel(chan->center_freq);
  128. }
  129. *pos++ = WLAN_EID_IBSS_PARAMS;
  130. *pos++ = 2;
  131. /* FIX: set ATIM window based on scan results */
  132. *pos++ = 0;
  133. *pos++ = 0;
  134. if (sband->n_bitrates > 8) {
  135. *pos++ = WLAN_EID_EXT_SUPP_RATES;
  136. *pos++ = sband->n_bitrates - 8;
  137. for (i = 8; i < sband->n_bitrates; i++) {
  138. int rate = sband->bitrates[i].bitrate;
  139. u8 basic = 0;
  140. if (basic_rates & BIT(i))
  141. basic = 0x80;
  142. *pos++ = basic | (u8) (rate / 5);
  143. }
  144. }
  145. if (ifibss->ie_len) {
  146. memcpy(pos, ifibss->ie, ifibss->ie_len);
  147. pos += ifibss->ie_len;
  148. }
  149. /* add HT capability and information IEs */
  150. if (chandef.width != NL80211_CHAN_WIDTH_20_NOHT &&
  151. chandef.width != NL80211_CHAN_WIDTH_5 &&
  152. chandef.width != NL80211_CHAN_WIDTH_10 &&
  153. sband->ht_cap.ht_supported) {
  154. pos = ieee80211_ie_build_ht_cap(pos, &sband->ht_cap,
  155. sband->ht_cap.cap);
  156. /*
  157. * Note: According to 802.11n-2009 9.13.3.1, HT Protection
  158. * field and RIFS Mode are reserved in IBSS mode, therefore
  159. * keep them at 0
  160. */
  161. pos = ieee80211_ie_build_ht_oper(pos, &sband->ht_cap,
  162. &chandef, 0);
  163. }
  164. if (local->hw.queues >= IEEE80211_NUM_ACS) {
  165. *pos++ = WLAN_EID_VENDOR_SPECIFIC;
  166. *pos++ = 7; /* len */
  167. *pos++ = 0x00; /* Microsoft OUI 00:50:F2 */
  168. *pos++ = 0x50;
  169. *pos++ = 0xf2;
  170. *pos++ = 2; /* WME */
  171. *pos++ = 0; /* WME info */
  172. *pos++ = 1; /* WME ver */
  173. *pos++ = 0; /* U-APSD no in use */
  174. }
  175. presp->head_len = pos - presp->head;
  176. if (WARN_ON(presp->head_len > frame_len))
  177. return;
  178. rcu_assign_pointer(ifibss->presp, presp);
  179. sdata->vif.bss_conf.enable_beacon = true;
  180. sdata->vif.bss_conf.beacon_int = beacon_int;
  181. sdata->vif.bss_conf.basic_rates = basic_rates;
  182. sdata->vif.bss_conf.ssid_len = ifibss->ssid_len;
  183. memcpy(sdata->vif.bss_conf.ssid, ifibss->ssid, ifibss->ssid_len);
  184. bss_change = BSS_CHANGED_BEACON_INT;
  185. bss_change |= ieee80211_reset_erp_info(sdata);
  186. bss_change |= BSS_CHANGED_BSSID;
  187. bss_change |= BSS_CHANGED_BEACON;
  188. bss_change |= BSS_CHANGED_BEACON_ENABLED;
  189. bss_change |= BSS_CHANGED_BASIC_RATES;
  190. bss_change |= BSS_CHANGED_HT;
  191. bss_change |= BSS_CHANGED_IBSS;
  192. bss_change |= BSS_CHANGED_SSID;
  193. /*
  194. * In 5 GHz/802.11a, we can always use short slot time.
  195. * (IEEE 802.11-2012 18.3.8.7)
  196. *
  197. * In 2.4GHz, we must always use long slots in IBSS for compatibility
  198. * reasons.
  199. * (IEEE 802.11-2012 19.4.5)
  200. *
  201. * HT follows these specifications (IEEE 802.11-2012 20.3.18)
  202. */
  203. sdata->vif.bss_conf.use_short_slot = chan->band == IEEE80211_BAND_5GHZ;
  204. bss_change |= BSS_CHANGED_ERP_SLOT;
  205. sdata->vif.bss_conf.ibss_joined = true;
  206. sdata->vif.bss_conf.ibss_creator = creator;
  207. ieee80211_bss_info_change_notify(sdata, bss_change);
  208. ieee80211_sta_def_wmm_params(sdata, sband->n_bitrates, supp_rates);
  209. ifibss->state = IEEE80211_IBSS_MLME_JOINED;
  210. mod_timer(&ifibss->timer,
  211. round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL));
  212. bss = cfg80211_inform_bss_frame(local->hw.wiphy, chan,
  213. mgmt, presp->head_len, 0, GFP_KERNEL);
  214. cfg80211_put_bss(local->hw.wiphy, bss);
  215. netif_carrier_on(sdata->dev);
  216. cfg80211_ibss_joined(sdata->dev, ifibss->bssid, GFP_KERNEL);
  217. }
  218. static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
  219. struct ieee80211_bss *bss)
  220. {
  221. struct cfg80211_bss *cbss =
  222. container_of((void *)bss, struct cfg80211_bss, priv);
  223. struct ieee80211_supported_band *sband;
  224. u32 basic_rates;
  225. int i, j;
  226. u16 beacon_int = cbss->beacon_interval;
  227. const struct cfg80211_bss_ies *ies;
  228. u64 tsf;
  229. sdata_assert_lock(sdata);
  230. if (beacon_int < 10)
  231. beacon_int = 10;
  232. sband = sdata->local->hw.wiphy->bands[cbss->channel->band];
  233. basic_rates = 0;
  234. for (i = 0; i < bss->supp_rates_len; i++) {
  235. int rate = (bss->supp_rates[i] & 0x7f) * 5;
  236. bool is_basic = !!(bss->supp_rates[i] & 0x80);
  237. for (j = 0; j < sband->n_bitrates; j++) {
  238. if (sband->bitrates[j].bitrate == rate) {
  239. if (is_basic)
  240. basic_rates |= BIT(j);
  241. break;
  242. }
  243. }
  244. }
  245. rcu_read_lock();
  246. ies = rcu_dereference(cbss->ies);
  247. tsf = ies->tsf;
  248. rcu_read_unlock();
  249. __ieee80211_sta_join_ibss(sdata, cbss->bssid,
  250. beacon_int,
  251. cbss->channel,
  252. basic_rates,
  253. cbss->capability,
  254. tsf, false);
  255. }
  256. static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta)
  257. __acquires(RCU)
  258. {
  259. struct ieee80211_sub_if_data *sdata = sta->sdata;
  260. u8 addr[ETH_ALEN];
  261. memcpy(addr, sta->sta.addr, ETH_ALEN);
  262. ibss_dbg(sdata, "Adding new IBSS station %pM\n", addr);
  263. sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
  264. sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
  265. /* authorize the station only if the network is not RSN protected. If
  266. * not wait for the userspace to authorize it */
  267. if (!sta->sdata->u.ibss.control_port)
  268. sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
  269. rate_control_rate_init(sta);
  270. /* If it fails, maybe we raced another insertion? */
  271. if (sta_info_insert_rcu(sta))
  272. return sta_info_get(sdata, addr);
  273. return sta;
  274. }
  275. static struct sta_info *
  276. ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, const u8 *bssid,
  277. const u8 *addr, u32 supp_rates)
  278. __acquires(RCU)
  279. {
  280. struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
  281. struct ieee80211_local *local = sdata->local;
  282. struct sta_info *sta;
  283. struct ieee80211_chanctx_conf *chanctx_conf;
  284. struct ieee80211_supported_band *sband;
  285. int band;
  286. /*
  287. * XXX: Consider removing the least recently used entry and
  288. * allow new one to be added.
  289. */
  290. if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) {
  291. net_info_ratelimited("%s: No room for a new IBSS STA entry %pM\n",
  292. sdata->name, addr);
  293. rcu_read_lock();
  294. return NULL;
  295. }
  296. if (ifibss->state == IEEE80211_IBSS_MLME_SEARCH) {
  297. rcu_read_lock();
  298. return NULL;
  299. }
  300. if (!ether_addr_equal(bssid, sdata->u.ibss.bssid)) {
  301. rcu_read_lock();
  302. return NULL;
  303. }
  304. rcu_read_lock();
  305. chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
  306. if (WARN_ON_ONCE(!chanctx_conf))
  307. return NULL;
  308. band = chanctx_conf->def.chan->band;
  309. rcu_read_unlock();
  310. sta = sta_info_alloc(sdata, addr, GFP_KERNEL);
  311. if (!sta) {
  312. rcu_read_lock();
  313. return NULL;
  314. }
  315. sta->last_rx = jiffies;
  316. /* make sure mandatory rates are always added */
  317. sband = local->hw.wiphy->bands[band];
  318. sta->sta.supp_rates[band] = supp_rates |
  319. ieee80211_mandatory_rates(sband);
  320. return ieee80211_ibss_finish_sta(sta);
  321. }
  322. static void ieee80211_rx_mgmt_deauth_ibss(struct ieee80211_sub_if_data *sdata,
  323. struct ieee80211_mgmt *mgmt,
  324. size_t len)
  325. {
  326. u16 reason = le16_to_cpu(mgmt->u.deauth.reason_code);
  327. if (len < IEEE80211_DEAUTH_FRAME_LEN)
  328. return;
  329. ibss_dbg(sdata, "RX DeAuth SA=%pM DA=%pM BSSID=%pM (reason: %d)\n",
  330. mgmt->sa, mgmt->da, mgmt->bssid, reason);
  331. sta_info_destroy_addr(sdata, mgmt->sa);
  332. }
  333. static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata,
  334. struct ieee80211_mgmt *mgmt,
  335. size_t len)
  336. {
  337. u16 auth_alg, auth_transaction;
  338. sdata_assert_lock(sdata);
  339. if (len < 24 + 6)
  340. return;
  341. auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
  342. auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction);
  343. ibss_dbg(sdata,
  344. "RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n",
  345. mgmt->sa, mgmt->da, mgmt->bssid, auth_transaction);
  346. if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1)
  347. return;
  348. /*
  349. * IEEE 802.11 standard does not require authentication in IBSS
  350. * networks and most implementations do not seem to use it.
  351. * However, try to reply to authentication attempts if someone
  352. * has actually implemented this.
  353. */
  354. ieee80211_send_auth(sdata, 2, WLAN_AUTH_OPEN, 0, NULL, 0,
  355. mgmt->sa, sdata->u.ibss.bssid, NULL, 0, 0, 0);
  356. }
  357. static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
  358. struct ieee80211_mgmt *mgmt, size_t len,
  359. struct ieee80211_rx_status *rx_status,
  360. struct ieee802_11_elems *elems)
  361. {
  362. struct ieee80211_local *local = sdata->local;
  363. int freq;
  364. struct cfg80211_bss *cbss;
  365. struct ieee80211_bss *bss;
  366. struct sta_info *sta;
  367. struct ieee80211_channel *channel;
  368. u64 beacon_timestamp, rx_timestamp;
  369. u32 supp_rates = 0;
  370. enum ieee80211_band band = rx_status->band;
  371. struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
  372. bool rates_updated = false;
  373. if (elems->ds_params)
  374. freq = ieee80211_channel_to_frequency(elems->ds_params[0],
  375. band);
  376. else
  377. freq = rx_status->freq;
  378. channel = ieee80211_get_channel(local->hw.wiphy, freq);
  379. if (!channel || channel->flags & IEEE80211_CHAN_DISABLED)
  380. return;
  381. if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
  382. ether_addr_equal(mgmt->bssid, sdata->u.ibss.bssid)) {
  383. rcu_read_lock();
  384. sta = sta_info_get(sdata, mgmt->sa);
  385. if (elems->supp_rates) {
  386. supp_rates = ieee80211_sta_get_rates(local, elems,
  387. band, NULL);
  388. if (sta) {
  389. u32 prev_rates;
  390. prev_rates = sta->sta.supp_rates[band];
  391. /* make sure mandatory rates are always added */
  392. sta->sta.supp_rates[band] = supp_rates |
  393. ieee80211_mandatory_rates(sband);
  394. if (sta->sta.supp_rates[band] != prev_rates) {
  395. ibss_dbg(sdata,
  396. "updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n",
  397. sta->sta.addr, prev_rates,
  398. sta->sta.supp_rates[band]);
  399. rates_updated = true;
  400. }
  401. } else {
  402. rcu_read_unlock();
  403. sta = ieee80211_ibss_add_sta(sdata, mgmt->bssid,
  404. mgmt->sa, supp_rates);
  405. }
  406. }
  407. if (sta && elems->wmm_info)
  408. set_sta_flag(sta, WLAN_STA_WME);
  409. if (sta && elems->ht_operation && elems->ht_cap_elem &&
  410. sdata->u.ibss.chandef.width != NL80211_CHAN_WIDTH_20_NOHT &&
  411. sdata->u.ibss.chandef.width != NL80211_CHAN_WIDTH_5 &&
  412. sdata->u.ibss.chandef.width != NL80211_CHAN_WIDTH_10) {
  413. /* we both use HT */
  414. struct ieee80211_ht_cap htcap_ie;
  415. struct cfg80211_chan_def chandef;
  416. ieee80211_ht_oper_to_chandef(channel,
  417. elems->ht_operation,
  418. &chandef);
  419. memcpy(&htcap_ie, elems->ht_cap_elem, sizeof(htcap_ie));
  420. /*
  421. * fall back to HT20 if we don't use or use
  422. * the other extension channel
  423. */
  424. if (chandef.center_freq1 !=
  425. sdata->u.ibss.chandef.center_freq1)
  426. htcap_ie.cap_info &=
  427. cpu_to_le16(~IEEE80211_HT_CAP_SUP_WIDTH_20_40);
  428. rates_updated |= ieee80211_ht_cap_ie_to_sta_ht_cap(
  429. sdata, sband, &htcap_ie, sta);
  430. }
  431. if (sta && rates_updated) {
  432. drv_sta_rc_update(local, sdata, &sta->sta,
  433. IEEE80211_RC_SUPP_RATES_CHANGED);
  434. rate_control_rate_init(sta);
  435. }
  436. rcu_read_unlock();
  437. }
  438. bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems,
  439. channel);
  440. if (!bss)
  441. return;
  442. cbss = container_of((void *)bss, struct cfg80211_bss, priv);
  443. /* same for beacon and probe response */
  444. beacon_timestamp = le64_to_cpu(mgmt->u.beacon.timestamp);
  445. /* check if we need to merge IBSS */
  446. /* we use a fixed BSSID */
  447. if (sdata->u.ibss.fixed_bssid)
  448. goto put_bss;
  449. /* not an IBSS */
  450. if (!(cbss->capability & WLAN_CAPABILITY_IBSS))
  451. goto put_bss;
  452. /* different channel */
  453. if (sdata->u.ibss.fixed_channel &&
  454. sdata->u.ibss.chandef.chan != cbss->channel)
  455. goto put_bss;
  456. /* different SSID */
  457. if (elems->ssid_len != sdata->u.ibss.ssid_len ||
  458. memcmp(elems->ssid, sdata->u.ibss.ssid,
  459. sdata->u.ibss.ssid_len))
  460. goto put_bss;
  461. /* same BSSID */
  462. if (ether_addr_equal(cbss->bssid, sdata->u.ibss.bssid))
  463. goto put_bss;
  464. if (ieee80211_have_rx_timestamp(rx_status)) {
  465. /* time when timestamp field was received */
  466. rx_timestamp =
  467. ieee80211_calculate_rx_timestamp(local, rx_status,
  468. len + FCS_LEN, 24);
  469. } else {
  470. /*
  471. * second best option: get current TSF
  472. * (will return -1 if not supported)
  473. */
  474. rx_timestamp = drv_get_tsf(local, sdata);
  475. }
  476. ibss_dbg(sdata,
  477. "RX beacon SA=%pM BSSID=%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n",
  478. mgmt->sa, mgmt->bssid,
  479. (unsigned long long)rx_timestamp,
  480. (unsigned long long)beacon_timestamp,
  481. (unsigned long long)(rx_timestamp - beacon_timestamp),
  482. jiffies);
  483. if (beacon_timestamp > rx_timestamp) {
  484. ibss_dbg(sdata,
  485. "beacon TSF higher than local TSF - IBSS merge with BSSID %pM\n",
  486. mgmt->bssid);
  487. ieee80211_sta_join_ibss(sdata, bss);
  488. supp_rates = ieee80211_sta_get_rates(local, elems, band, NULL);
  489. ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
  490. supp_rates);
  491. rcu_read_unlock();
  492. }
  493. put_bss:
  494. ieee80211_rx_bss_put(local, bss);
  495. }
  496. void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
  497. const u8 *bssid, const u8 *addr,
  498. u32 supp_rates)
  499. {
  500. struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
  501. struct ieee80211_local *local = sdata->local;
  502. struct sta_info *sta;
  503. struct ieee80211_chanctx_conf *chanctx_conf;
  504. struct ieee80211_supported_band *sband;
  505. int band;
  506. /*
  507. * XXX: Consider removing the least recently used entry and
  508. * allow new one to be added.
  509. */
  510. if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) {
  511. net_info_ratelimited("%s: No room for a new IBSS STA entry %pM\n",
  512. sdata->name, addr);
  513. return;
  514. }
  515. if (ifibss->state == IEEE80211_IBSS_MLME_SEARCH)
  516. return;
  517. if (!ether_addr_equal(bssid, sdata->u.ibss.bssid))
  518. return;
  519. rcu_read_lock();
  520. chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
  521. if (WARN_ON_ONCE(!chanctx_conf)) {
  522. rcu_read_unlock();
  523. return;
  524. }
  525. band = chanctx_conf->def.chan->band;
  526. rcu_read_unlock();
  527. sta = sta_info_alloc(sdata, addr, GFP_ATOMIC);
  528. if (!sta)
  529. return;
  530. sta->last_rx = jiffies;
  531. /* make sure mandatory rates are always added */
  532. sband = local->hw.wiphy->bands[band];
  533. sta->sta.supp_rates[band] = supp_rates |
  534. ieee80211_mandatory_rates(sband);
  535. spin_lock(&ifibss->incomplete_lock);
  536. list_add(&sta->list, &ifibss->incomplete_stations);
  537. spin_unlock(&ifibss->incomplete_lock);
  538. ieee80211_queue_work(&local->hw, &sdata->work);
  539. }
  540. static int ieee80211_sta_active_ibss(struct ieee80211_sub_if_data *sdata)
  541. {
  542. struct ieee80211_local *local = sdata->local;
  543. int active = 0;
  544. struct sta_info *sta;
  545. sdata_assert_lock(sdata);
  546. rcu_read_lock();
  547. list_for_each_entry_rcu(sta, &local->sta_list, list) {
  548. if (sta->sdata == sdata &&
  549. time_after(sta->last_rx + IEEE80211_IBSS_MERGE_INTERVAL,
  550. jiffies)) {
  551. active++;
  552. break;
  553. }
  554. }
  555. rcu_read_unlock();
  556. return active;
  557. }
  558. /*
  559. * This function is called with state == IEEE80211_IBSS_MLME_JOINED
  560. */
  561. static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata)
  562. {
  563. struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
  564. sdata_assert_lock(sdata);
  565. mod_timer(&ifibss->timer,
  566. round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL));
  567. ieee80211_sta_expire(sdata, IEEE80211_IBSS_INACTIVITY_LIMIT);
  568. if (time_before(jiffies, ifibss->last_scan_completed +
  569. IEEE80211_IBSS_MERGE_INTERVAL))
  570. return;
  571. if (ieee80211_sta_active_ibss(sdata))
  572. return;
  573. if (ifibss->fixed_channel)
  574. return;
  575. sdata_info(sdata,
  576. "No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)\n");
  577. ieee80211_request_ibss_scan(sdata, ifibss->ssid, ifibss->ssid_len,
  578. NULL);
  579. }
  580. static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
  581. {
  582. struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
  583. u8 bssid[ETH_ALEN];
  584. u16 capability;
  585. int i;
  586. sdata_assert_lock(sdata);
  587. if (ifibss->fixed_bssid) {
  588. memcpy(bssid, ifibss->bssid, ETH_ALEN);
  589. } else {
  590. /* Generate random, not broadcast, locally administered BSSID. Mix in
  591. * own MAC address to make sure that devices that do not have proper
  592. * random number generator get different BSSID. */
  593. get_random_bytes(bssid, ETH_ALEN);
  594. for (i = 0; i < ETH_ALEN; i++)
  595. bssid[i] ^= sdata->vif.addr[i];
  596. bssid[0] &= ~0x01;
  597. bssid[0] |= 0x02;
  598. }
  599. sdata_info(sdata, "Creating new IBSS network, BSSID %pM\n", bssid);
  600. capability = WLAN_CAPABILITY_IBSS;
  601. if (ifibss->privacy)
  602. capability |= WLAN_CAPABILITY_PRIVACY;
  603. else
  604. sdata->drop_unencrypted = 0;
  605. __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
  606. ifibss->chandef.chan, ifibss->basic_rates,
  607. capability, 0, true);
  608. }
  609. /*
  610. * This function is called with state == IEEE80211_IBSS_MLME_SEARCH
  611. */
  612. static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
  613. {
  614. struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
  615. struct ieee80211_local *local = sdata->local;
  616. struct cfg80211_bss *cbss;
  617. struct ieee80211_channel *chan = NULL;
  618. const u8 *bssid = NULL;
  619. int active_ibss;
  620. u16 capability;
  621. sdata_assert_lock(sdata);
  622. active_ibss = ieee80211_sta_active_ibss(sdata);
  623. ibss_dbg(sdata, "sta_find_ibss (active_ibss=%d)\n", active_ibss);
  624. if (active_ibss)
  625. return;
  626. capability = WLAN_CAPABILITY_IBSS;
  627. if (ifibss->privacy)
  628. capability |= WLAN_CAPABILITY_PRIVACY;
  629. if (ifibss->fixed_bssid)
  630. bssid = ifibss->bssid;
  631. if (ifibss->fixed_channel)
  632. chan = ifibss->chandef.chan;
  633. if (!is_zero_ether_addr(ifibss->bssid))
  634. bssid = ifibss->bssid;
  635. cbss = cfg80211_get_bss(local->hw.wiphy, chan, bssid,
  636. ifibss->ssid, ifibss->ssid_len,
  637. WLAN_CAPABILITY_IBSS | WLAN_CAPABILITY_PRIVACY,
  638. capability);
  639. if (cbss) {
  640. struct ieee80211_bss *bss;
  641. bss = (void *)cbss->priv;
  642. ibss_dbg(sdata,
  643. "sta_find_ibss: selected %pM current %pM\n",
  644. cbss->bssid, ifibss->bssid);
  645. sdata_info(sdata,
  646. "Selected IBSS BSSID %pM based on configured SSID\n",
  647. cbss->bssid);
  648. ieee80211_sta_join_ibss(sdata, bss);
  649. ieee80211_rx_bss_put(local, bss);
  650. return;
  651. }
  652. ibss_dbg(sdata, "sta_find_ibss: did not try to join ibss\n");
  653. /* Selected IBSS not found in current scan results - try to scan */
  654. if (time_after(jiffies, ifibss->last_scan_completed +
  655. IEEE80211_SCAN_INTERVAL)) {
  656. sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
  657. ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  658. ifibss->ssid_len, chan);
  659. } else {
  660. int interval = IEEE80211_SCAN_INTERVAL;
  661. if (time_after(jiffies, ifibss->ibss_join_req +
  662. IEEE80211_IBSS_JOIN_TIMEOUT))
  663. ieee80211_sta_create_ibss(sdata);
  664. mod_timer(&ifibss->timer,
  665. round_jiffies(jiffies + interval));
  666. }
  667. }
  668. static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
  669. struct sk_buff *req)
  670. {
  671. struct ieee80211_mgmt *mgmt = (void *)req->data;
  672. struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
  673. struct ieee80211_local *local = sdata->local;
  674. int tx_last_beacon, len = req->len;
  675. struct sk_buff *skb;
  676. struct beacon_data *presp;
  677. u8 *pos, *end;
  678. sdata_assert_lock(sdata);
  679. presp = rcu_dereference_protected(ifibss->presp,
  680. lockdep_is_held(&sdata->wdev.mtx));
  681. if (ifibss->state != IEEE80211_IBSS_MLME_JOINED ||
  682. len < 24 + 2 || !presp)
  683. return;
  684. tx_last_beacon = drv_tx_last_beacon(local);
  685. ibss_dbg(sdata,
  686. "RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n",
  687. mgmt->sa, mgmt->da, mgmt->bssid, tx_last_beacon);
  688. if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da))
  689. return;
  690. if (!ether_addr_equal(mgmt->bssid, ifibss->bssid) &&
  691. !is_broadcast_ether_addr(mgmt->bssid))
  692. return;
  693. end = ((u8 *) mgmt) + len;
  694. pos = mgmt->u.probe_req.variable;
  695. if (pos[0] != WLAN_EID_SSID ||
  696. pos + 2 + pos[1] > end) {
  697. ibss_dbg(sdata, "Invalid SSID IE in ProbeReq from %pM\n",
  698. mgmt->sa);
  699. return;
  700. }
  701. if (pos[1] != 0 &&
  702. (pos[1] != ifibss->ssid_len ||
  703. memcmp(pos + 2, ifibss->ssid, ifibss->ssid_len))) {
  704. /* Ignore ProbeReq for foreign SSID */
  705. return;
  706. }
  707. /* Reply with ProbeResp */
  708. skb = dev_alloc_skb(local->tx_headroom + presp->head_len);
  709. if (!skb)
  710. return;
  711. skb_reserve(skb, local->tx_headroom);
  712. memcpy(skb_put(skb, presp->head_len), presp->head, presp->head_len);
  713. memcpy(((struct ieee80211_mgmt *) skb->data)->da, mgmt->sa, ETH_ALEN);
  714. ibss_dbg(sdata, "Sending ProbeResp to %pM\n", mgmt->sa);
  715. IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
  716. ieee80211_tx_skb(sdata, skb);
  717. }
  718. static
  719. void ieee80211_rx_mgmt_probe_beacon(struct ieee80211_sub_if_data *sdata,
  720. struct ieee80211_mgmt *mgmt, size_t len,
  721. struct ieee80211_rx_status *rx_status)
  722. {
  723. size_t baselen;
  724. struct ieee802_11_elems elems;
  725. BUILD_BUG_ON(offsetof(typeof(mgmt->u.probe_resp), variable) !=
  726. offsetof(typeof(mgmt->u.beacon), variable));
  727. /*
  728. * either beacon or probe_resp but the variable field is at the
  729. * same offset
  730. */
  731. baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
  732. if (baselen > len)
  733. return;
  734. ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen,
  735. false, &elems);
  736. ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems);
  737. }
  738. void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
  739. struct sk_buff *skb)
  740. {
  741. struct ieee80211_rx_status *rx_status;
  742. struct ieee80211_mgmt *mgmt;
  743. u16 fc;
  744. rx_status = IEEE80211_SKB_RXCB(skb);
  745. mgmt = (struct ieee80211_mgmt *) skb->data;
  746. fc = le16_to_cpu(mgmt->frame_control);
  747. sdata_lock(sdata);
  748. if (!sdata->u.ibss.ssid_len)
  749. goto mgmt_out; /* not ready to merge yet */
  750. switch (fc & IEEE80211_FCTL_STYPE) {
  751. case IEEE80211_STYPE_PROBE_REQ:
  752. ieee80211_rx_mgmt_probe_req(sdata, skb);
  753. break;
  754. case IEEE80211_STYPE_PROBE_RESP:
  755. case IEEE80211_STYPE_BEACON:
  756. ieee80211_rx_mgmt_probe_beacon(sdata, mgmt, skb->len,
  757. rx_status);
  758. break;
  759. case IEEE80211_STYPE_AUTH:
  760. ieee80211_rx_mgmt_auth_ibss(sdata, mgmt, skb->len);
  761. break;
  762. case IEEE80211_STYPE_DEAUTH:
  763. ieee80211_rx_mgmt_deauth_ibss(sdata, mgmt, skb->len);
  764. break;
  765. }
  766. mgmt_out:
  767. sdata_unlock(sdata);
  768. }
  769. void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata)
  770. {
  771. struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
  772. struct sta_info *sta;
  773. sdata_lock(sdata);
  774. /*
  775. * Work could be scheduled after scan or similar
  776. * when we aren't even joined (or trying) with a
  777. * network.
  778. */
  779. if (!ifibss->ssid_len)
  780. goto out;
  781. spin_lock_bh(&ifibss->incomplete_lock);
  782. while (!list_empty(&ifibss->incomplete_stations)) {
  783. sta = list_first_entry(&ifibss->incomplete_stations,
  784. struct sta_info, list);
  785. list_del(&sta->list);
  786. spin_unlock_bh(&ifibss->incomplete_lock);
  787. ieee80211_ibss_finish_sta(sta);
  788. rcu_read_unlock();
  789. spin_lock_bh(&ifibss->incomplete_lock);
  790. }
  791. spin_unlock_bh(&ifibss->incomplete_lock);
  792. switch (ifibss->state) {
  793. case IEEE80211_IBSS_MLME_SEARCH:
  794. ieee80211_sta_find_ibss(sdata);
  795. break;
  796. case IEEE80211_IBSS_MLME_JOINED:
  797. ieee80211_sta_merge_ibss(sdata);
  798. break;
  799. default:
  800. WARN_ON(1);
  801. break;
  802. }
  803. out:
  804. sdata_unlock(sdata);
  805. }
  806. static void ieee80211_ibss_timer(unsigned long data)
  807. {
  808. struct ieee80211_sub_if_data *sdata =
  809. (struct ieee80211_sub_if_data *) data;
  810. ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  811. }
  812. void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata)
  813. {
  814. struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
  815. setup_timer(&ifibss->timer, ieee80211_ibss_timer,
  816. (unsigned long) sdata);
  817. INIT_LIST_HEAD(&ifibss->incomplete_stations);
  818. spin_lock_init(&ifibss->incomplete_lock);
  819. }
  820. /* scan finished notification */
  821. void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local)
  822. {
  823. struct ieee80211_sub_if_data *sdata;
  824. mutex_lock(&local->iflist_mtx);
  825. list_for_each_entry(sdata, &local->interfaces, list) {
  826. if (!ieee80211_sdata_running(sdata))
  827. continue;
  828. if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
  829. continue;
  830. sdata->u.ibss.last_scan_completed = jiffies;
  831. ieee80211_queue_work(&local->hw, &sdata->work);
  832. }
  833. mutex_unlock(&local->iflist_mtx);
  834. }
  835. int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
  836. struct cfg80211_ibss_params *params)
  837. {
  838. u32 changed = 0;
  839. if (params->bssid) {
  840. memcpy(sdata->u.ibss.bssid, params->bssid, ETH_ALEN);
  841. sdata->u.ibss.fixed_bssid = true;
  842. } else
  843. sdata->u.ibss.fixed_bssid = false;
  844. sdata->u.ibss.privacy = params->privacy;
  845. sdata->u.ibss.control_port = params->control_port;
  846. sdata->u.ibss.basic_rates = params->basic_rates;
  847. memcpy(sdata->vif.bss_conf.mcast_rate, params->mcast_rate,
  848. sizeof(params->mcast_rate));
  849. sdata->vif.bss_conf.beacon_int = params->beacon_interval;
  850. sdata->u.ibss.chandef = params->chandef;
  851. sdata->u.ibss.fixed_channel = params->channel_fixed;
  852. if (params->ie) {
  853. sdata->u.ibss.ie = kmemdup(params->ie, params->ie_len,
  854. GFP_KERNEL);
  855. if (sdata->u.ibss.ie)
  856. sdata->u.ibss.ie_len = params->ie_len;
  857. }
  858. sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH;
  859. sdata->u.ibss.ibss_join_req = jiffies;
  860. memcpy(sdata->u.ibss.ssid, params->ssid, params->ssid_len);
  861. sdata->u.ibss.ssid_len = params->ssid_len;
  862. /*
  863. * 802.11n-2009 9.13.3.1: In an IBSS, the HT Protection field is
  864. * reserved, but an HT STA shall protect HT transmissions as though
  865. * the HT Protection field were set to non-HT mixed mode.
  866. *
  867. * In an IBSS, the RIFS Mode field of the HT Operation element is
  868. * also reserved, but an HT STA shall operate as though this field
  869. * were set to 1.
  870. */
  871. sdata->vif.bss_conf.ht_operation_mode |=
  872. IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED
  873. | IEEE80211_HT_PARAM_RIFS_MODE;
  874. changed |= BSS_CHANGED_HT;
  875. ieee80211_bss_info_change_notify(sdata, changed);
  876. sdata->smps_mode = IEEE80211_SMPS_OFF;
  877. sdata->needed_rx_chains = sdata->local->rx_chains;
  878. ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  879. return 0;
  880. }
  881. int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
  882. {
  883. struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
  884. struct ieee80211_local *local = sdata->local;
  885. struct cfg80211_bss *cbss;
  886. u16 capability;
  887. int active_ibss;
  888. struct sta_info *sta;
  889. struct beacon_data *presp;
  890. active_ibss = ieee80211_sta_active_ibss(sdata);
  891. if (!active_ibss && !is_zero_ether_addr(ifibss->bssid)) {
  892. capability = WLAN_CAPABILITY_IBSS;
  893. if (ifibss->privacy)
  894. capability |= WLAN_CAPABILITY_PRIVACY;
  895. cbss = cfg80211_get_bss(local->hw.wiphy, ifibss->chandef.chan,
  896. ifibss->bssid, ifibss->ssid,
  897. ifibss->ssid_len, WLAN_CAPABILITY_IBSS |
  898. WLAN_CAPABILITY_PRIVACY,
  899. capability);
  900. if (cbss) {
  901. cfg80211_unlink_bss(local->hw.wiphy, cbss);
  902. cfg80211_put_bss(local->hw.wiphy, cbss);
  903. }
  904. }
  905. ifibss->state = IEEE80211_IBSS_MLME_SEARCH;
  906. memset(ifibss->bssid, 0, ETH_ALEN);
  907. ifibss->ssid_len = 0;
  908. sta_info_flush(sdata);
  909. spin_lock_bh(&ifibss->incomplete_lock);
  910. while (!list_empty(&ifibss->incomplete_stations)) {
  911. sta = list_first_entry(&ifibss->incomplete_stations,
  912. struct sta_info, list);
  913. list_del(&sta->list);
  914. spin_unlock_bh(&ifibss->incomplete_lock);
  915. sta_info_free(local, sta);
  916. spin_lock_bh(&ifibss->incomplete_lock);
  917. }
  918. spin_unlock_bh(&ifibss->incomplete_lock);
  919. netif_carrier_off(sdata->dev);
  920. /* remove beacon */
  921. kfree(sdata->u.ibss.ie);
  922. presp = rcu_dereference_protected(ifibss->presp,
  923. lockdep_is_held(&sdata->wdev.mtx));
  924. RCU_INIT_POINTER(sdata->u.ibss.presp, NULL);
  925. sdata->vif.bss_conf.ibss_joined = false;
  926. sdata->vif.bss_conf.ibss_creator = false;
  927. sdata->vif.bss_conf.enable_beacon = false;
  928. sdata->vif.bss_conf.ssid_len = 0;
  929. clear_bit(SDATA_STATE_OFFCHANNEL_BEACON_STOPPED, &sdata->state);
  930. ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED |
  931. BSS_CHANGED_IBSS);
  932. synchronize_rcu();
  933. kfree(presp);
  934. skb_queue_purge(&sdata->skb_queue);
  935. del_timer_sync(&sdata->u.ibss.timer);
  936. return 0;
  937. }