mesh.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096
  1. /*
  2. * Copyright (c) 2008, 2009 open80211s Ltd.
  3. * Authors: Luis Carlos Cobo <luisca@cozybit.com>
  4. * Javier Cardona <javier@cozybit.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/slab.h>
  11. #include <asm/unaligned.h>
  12. #include "ieee80211_i.h"
  13. #include "mesh.h"
  14. #define TMR_RUNNING_HK 0
  15. #define TMR_RUNNING_MP 1
  16. #define TMR_RUNNING_MPR 2
  17. int mesh_allocated;
  18. static struct kmem_cache *rm_cache;
  19. bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt)
  20. {
  21. return (mgmt->u.action.u.mesh_action.action_code ==
  22. WLAN_MESH_ACTION_HWMP_PATH_SELECTION);
  23. }
  24. void ieee80211s_init(void)
  25. {
  26. mesh_pathtbl_init();
  27. mesh_allocated = 1;
  28. rm_cache = kmem_cache_create("mesh_rmc", sizeof(struct rmc_entry),
  29. 0, 0, NULL);
  30. }
  31. void ieee80211s_stop(void)
  32. {
  33. mesh_pathtbl_unregister();
  34. kmem_cache_destroy(rm_cache);
  35. }
  36. static void ieee80211_mesh_housekeeping_timer(unsigned long data)
  37. {
  38. struct ieee80211_sub_if_data *sdata = (void *) data;
  39. struct ieee80211_local *local = sdata->local;
  40. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  41. set_bit(MESH_WORK_HOUSEKEEPING, &ifmsh->wrkq_flags);
  42. if (local->quiescing) {
  43. set_bit(TMR_RUNNING_HK, &ifmsh->timers_running);
  44. return;
  45. }
  46. ieee80211_queue_work(&local->hw, &sdata->work);
  47. }
  48. /**
  49. * mesh_matches_local - check if the config of a mesh point matches ours
  50. *
  51. * @sdata: local mesh subif
  52. * @ie: information elements of a management frame from the mesh peer
  53. *
  54. * This function checks if the mesh configuration of a mesh point matches the
  55. * local mesh configuration, i.e. if both nodes belong to the same mesh network.
  56. */
  57. bool mesh_matches_local(struct ieee80211_sub_if_data *sdata,
  58. struct ieee802_11_elems *ie)
  59. {
  60. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  61. struct ieee80211_local *local = sdata->local;
  62. u32 basic_rates = 0;
  63. struct cfg80211_chan_def sta_chan_def;
  64. /*
  65. * As support for each feature is added, check for matching
  66. * - On mesh config capabilities
  67. * - Power Save Support En
  68. * - Sync support enabled
  69. * - Sync support active
  70. * - Sync support required from peer
  71. * - MDA enabled
  72. * - Power management control on fc
  73. */
  74. if (!(ifmsh->mesh_id_len == ie->mesh_id_len &&
  75. memcmp(ifmsh->mesh_id, ie->mesh_id, ie->mesh_id_len) == 0 &&
  76. (ifmsh->mesh_pp_id == ie->mesh_config->meshconf_psel) &&
  77. (ifmsh->mesh_pm_id == ie->mesh_config->meshconf_pmetric) &&
  78. (ifmsh->mesh_cc_id == ie->mesh_config->meshconf_congest) &&
  79. (ifmsh->mesh_sp_id == ie->mesh_config->meshconf_synch) &&
  80. (ifmsh->mesh_auth_id == ie->mesh_config->meshconf_auth)))
  81. goto mismatch;
  82. ieee80211_sta_get_rates(local, ie, ieee80211_get_sdata_band(sdata),
  83. &basic_rates);
  84. if (sdata->vif.bss_conf.basic_rates != basic_rates)
  85. goto mismatch;
  86. ieee80211_ht_oper_to_chandef(sdata->vif.bss_conf.chandef.chan,
  87. ie->ht_operation, &sta_chan_def);
  88. if (!cfg80211_chandef_compatible(&sdata->vif.bss_conf.chandef,
  89. &sta_chan_def))
  90. goto mismatch;
  91. return true;
  92. mismatch:
  93. return false;
  94. }
  95. /**
  96. * mesh_peer_accepts_plinks - check if an mp is willing to establish peer links
  97. *
  98. * @ie: information elements of a management frame from the mesh peer
  99. */
  100. bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie)
  101. {
  102. return (ie->mesh_config->meshconf_cap &
  103. IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS) != 0;
  104. }
  105. /**
  106. * mesh_accept_plinks_update - update accepting_plink in local mesh beacons
  107. *
  108. * @sdata: mesh interface in which mesh beacons are going to be updated
  109. *
  110. * Returns: beacon changed flag if the beacon content changed.
  111. */
  112. u32 mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata)
  113. {
  114. bool free_plinks;
  115. u32 changed = 0;
  116. /* In case mesh_plink_free_count > 0 and mesh_plinktbl_capacity == 0,
  117. * the mesh interface might be able to establish plinks with peers that
  118. * are already on the table but are not on PLINK_ESTAB state. However,
  119. * in general the mesh interface is not accepting peer link requests
  120. * from new peers, and that must be reflected in the beacon
  121. */
  122. free_plinks = mesh_plink_availables(sdata);
  123. if (free_plinks != sdata->u.mesh.accepting_plinks) {
  124. sdata->u.mesh.accepting_plinks = free_plinks;
  125. changed = BSS_CHANGED_BEACON;
  126. }
  127. return changed;
  128. }
  129. /*
  130. * mesh_sta_cleanup - clean up any mesh sta state
  131. *
  132. * @sta: mesh sta to clean up.
  133. */
  134. void mesh_sta_cleanup(struct sta_info *sta)
  135. {
  136. struct ieee80211_sub_if_data *sdata = sta->sdata;
  137. u32 changed;
  138. /*
  139. * maybe userspace handles peer allocation and peering, but in either
  140. * case the beacon is still generated by the kernel and we might need
  141. * an update.
  142. */
  143. changed = mesh_accept_plinks_update(sdata);
  144. if (sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) {
  145. changed |= mesh_plink_deactivate(sta);
  146. del_timer_sync(&sta->plink_timer);
  147. }
  148. if (changed)
  149. ieee80211_mbss_info_change_notify(sdata, changed);
  150. }
  151. int mesh_rmc_init(struct ieee80211_sub_if_data *sdata)
  152. {
  153. int i;
  154. sdata->u.mesh.rmc = kmalloc(sizeof(struct mesh_rmc), GFP_KERNEL);
  155. if (!sdata->u.mesh.rmc)
  156. return -ENOMEM;
  157. sdata->u.mesh.rmc->idx_mask = RMC_BUCKETS - 1;
  158. for (i = 0; i < RMC_BUCKETS; i++)
  159. INIT_LIST_HEAD(&sdata->u.mesh.rmc->bucket[i]);
  160. return 0;
  161. }
  162. void mesh_rmc_free(struct ieee80211_sub_if_data *sdata)
  163. {
  164. struct mesh_rmc *rmc = sdata->u.mesh.rmc;
  165. struct rmc_entry *p, *n;
  166. int i;
  167. if (!sdata->u.mesh.rmc)
  168. return;
  169. for (i = 0; i < RMC_BUCKETS; i++)
  170. list_for_each_entry_safe(p, n, &rmc->bucket[i], list) {
  171. list_del(&p->list);
  172. kmem_cache_free(rm_cache, p);
  173. }
  174. kfree(rmc);
  175. sdata->u.mesh.rmc = NULL;
  176. }
  177. /**
  178. * mesh_rmc_check - Check frame in recent multicast cache and add if absent.
  179. *
  180. * @sa: source address
  181. * @mesh_hdr: mesh_header
  182. *
  183. * Returns: 0 if the frame is not in the cache, nonzero otherwise.
  184. *
  185. * Checks using the source address and the mesh sequence number if we have
  186. * received this frame lately. If the frame is not in the cache, it is added to
  187. * it.
  188. */
  189. int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr,
  190. struct ieee80211_sub_if_data *sdata)
  191. {
  192. struct mesh_rmc *rmc = sdata->u.mesh.rmc;
  193. u32 seqnum = 0;
  194. int entries = 0;
  195. u8 idx;
  196. struct rmc_entry *p, *n;
  197. /* Don't care about endianness since only match matters */
  198. memcpy(&seqnum, &mesh_hdr->seqnum, sizeof(mesh_hdr->seqnum));
  199. idx = le32_to_cpu(mesh_hdr->seqnum) & rmc->idx_mask;
  200. list_for_each_entry_safe(p, n, &rmc->bucket[idx], list) {
  201. ++entries;
  202. if (time_after(jiffies, p->exp_time) ||
  203. (entries == RMC_QUEUE_MAX_LEN)) {
  204. list_del(&p->list);
  205. kmem_cache_free(rm_cache, p);
  206. --entries;
  207. } else if ((seqnum == p->seqnum) &&
  208. (ether_addr_equal(sa, p->sa)))
  209. return -1;
  210. }
  211. p = kmem_cache_alloc(rm_cache, GFP_ATOMIC);
  212. if (!p)
  213. return 0;
  214. p->seqnum = seqnum;
  215. p->exp_time = jiffies + RMC_TIMEOUT;
  216. memcpy(p->sa, sa, ETH_ALEN);
  217. list_add(&p->list, &rmc->bucket[idx]);
  218. return 0;
  219. }
  220. int
  221. mesh_add_meshconf_ie(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
  222. {
  223. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  224. u8 *pos, neighbors;
  225. u8 meshconf_len = sizeof(struct ieee80211_meshconf_ie);
  226. if (skb_tailroom(skb) < 2 + meshconf_len)
  227. return -ENOMEM;
  228. pos = skb_put(skb, 2 + meshconf_len);
  229. *pos++ = WLAN_EID_MESH_CONFIG;
  230. *pos++ = meshconf_len;
  231. /* Active path selection protocol ID */
  232. *pos++ = ifmsh->mesh_pp_id;
  233. /* Active path selection metric ID */
  234. *pos++ = ifmsh->mesh_pm_id;
  235. /* Congestion control mode identifier */
  236. *pos++ = ifmsh->mesh_cc_id;
  237. /* Synchronization protocol identifier */
  238. *pos++ = ifmsh->mesh_sp_id;
  239. /* Authentication Protocol identifier */
  240. *pos++ = ifmsh->mesh_auth_id;
  241. /* Mesh Formation Info - number of neighbors */
  242. neighbors = atomic_read(&ifmsh->estab_plinks);
  243. /* Number of neighbor mesh STAs or 15 whichever is smaller */
  244. neighbors = (neighbors > 15) ? 15 : neighbors;
  245. *pos++ = neighbors << 1;
  246. /* Mesh capability */
  247. *pos = IEEE80211_MESHCONF_CAPAB_FORWARDING;
  248. *pos |= ifmsh->accepting_plinks ?
  249. IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS : 0x00;
  250. /* Mesh PS mode. See IEEE802.11-2012 8.4.2.100.8 */
  251. *pos |= ifmsh->ps_peers_deep_sleep ?
  252. IEEE80211_MESHCONF_CAPAB_POWER_SAVE_LEVEL : 0x00;
  253. *pos++ |= ifmsh->adjusting_tbtt ?
  254. IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING : 0x00;
  255. *pos++ = 0x00;
  256. return 0;
  257. }
  258. int
  259. mesh_add_meshid_ie(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
  260. {
  261. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  262. u8 *pos;
  263. if (skb_tailroom(skb) < 2 + ifmsh->mesh_id_len)
  264. return -ENOMEM;
  265. pos = skb_put(skb, 2 + ifmsh->mesh_id_len);
  266. *pos++ = WLAN_EID_MESH_ID;
  267. *pos++ = ifmsh->mesh_id_len;
  268. if (ifmsh->mesh_id_len)
  269. memcpy(pos, ifmsh->mesh_id, ifmsh->mesh_id_len);
  270. return 0;
  271. }
  272. int mesh_add_awake_window_ie(struct sk_buff *skb,
  273. struct ieee80211_sub_if_data *sdata)
  274. {
  275. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  276. u8 *pos;
  277. /* see IEEE802.11-2012 13.14.6 */
  278. if (ifmsh->ps_peers_light_sleep == 0 &&
  279. ifmsh->ps_peers_deep_sleep == 0 &&
  280. ifmsh->nonpeer_pm == NL80211_MESH_POWER_ACTIVE)
  281. return 0;
  282. if (skb_tailroom(skb) < 4)
  283. return -ENOMEM;
  284. pos = skb_put(skb, 2 + 2);
  285. *pos++ = WLAN_EID_MESH_AWAKE_WINDOW;
  286. *pos++ = 2;
  287. put_unaligned_le16(ifmsh->mshcfg.dot11MeshAwakeWindowDuration, pos);
  288. return 0;
  289. }
  290. int
  291. mesh_add_vendor_ies(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
  292. {
  293. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  294. u8 offset, len;
  295. const u8 *data;
  296. if (!ifmsh->ie || !ifmsh->ie_len)
  297. return 0;
  298. /* fast-forward to vendor IEs */
  299. offset = ieee80211_ie_split_vendor(ifmsh->ie, ifmsh->ie_len, 0);
  300. if (offset) {
  301. len = ifmsh->ie_len - offset;
  302. data = ifmsh->ie + offset;
  303. if (skb_tailroom(skb) < len)
  304. return -ENOMEM;
  305. memcpy(skb_put(skb, len), data, len);
  306. }
  307. return 0;
  308. }
  309. int
  310. mesh_add_rsn_ie(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
  311. {
  312. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  313. u8 len = 0;
  314. const u8 *data;
  315. if (!ifmsh->ie || !ifmsh->ie_len)
  316. return 0;
  317. /* find RSN IE */
  318. data = ifmsh->ie;
  319. while (data < ifmsh->ie + ifmsh->ie_len) {
  320. if (*data == WLAN_EID_RSN) {
  321. len = data[1] + 2;
  322. break;
  323. }
  324. data++;
  325. }
  326. if (len) {
  327. if (skb_tailroom(skb) < len)
  328. return -ENOMEM;
  329. memcpy(skb_put(skb, len), data, len);
  330. }
  331. return 0;
  332. }
  333. int mesh_add_ds_params_ie(struct sk_buff *skb,
  334. struct ieee80211_sub_if_data *sdata)
  335. {
  336. struct ieee80211_chanctx_conf *chanctx_conf;
  337. struct ieee80211_channel *chan;
  338. u8 *pos;
  339. if (skb_tailroom(skb) < 3)
  340. return -ENOMEM;
  341. rcu_read_lock();
  342. chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
  343. if (WARN_ON(!chanctx_conf)) {
  344. rcu_read_unlock();
  345. return -EINVAL;
  346. }
  347. chan = chanctx_conf->def.chan;
  348. rcu_read_unlock();
  349. pos = skb_put(skb, 2 + 1);
  350. *pos++ = WLAN_EID_DS_PARAMS;
  351. *pos++ = 1;
  352. *pos++ = ieee80211_frequency_to_channel(chan->center_freq);
  353. return 0;
  354. }
  355. int mesh_add_ht_cap_ie(struct sk_buff *skb,
  356. struct ieee80211_sub_if_data *sdata)
  357. {
  358. struct ieee80211_local *local = sdata->local;
  359. enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
  360. struct ieee80211_supported_band *sband;
  361. u8 *pos;
  362. sband = local->hw.wiphy->bands[band];
  363. if (!sband->ht_cap.ht_supported ||
  364. sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT)
  365. return 0;
  366. if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_cap))
  367. return -ENOMEM;
  368. pos = skb_put(skb, 2 + sizeof(struct ieee80211_ht_cap));
  369. ieee80211_ie_build_ht_cap(pos, &sband->ht_cap, sband->ht_cap.cap);
  370. return 0;
  371. }
  372. int mesh_add_ht_oper_ie(struct sk_buff *skb,
  373. struct ieee80211_sub_if_data *sdata)
  374. {
  375. struct ieee80211_local *local = sdata->local;
  376. struct ieee80211_chanctx_conf *chanctx_conf;
  377. struct ieee80211_channel *channel;
  378. enum nl80211_channel_type channel_type =
  379. cfg80211_get_chandef_type(&sdata->vif.bss_conf.chandef);
  380. struct ieee80211_supported_band *sband;
  381. struct ieee80211_sta_ht_cap *ht_cap;
  382. u8 *pos;
  383. rcu_read_lock();
  384. chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
  385. if (WARN_ON(!chanctx_conf)) {
  386. rcu_read_unlock();
  387. return -EINVAL;
  388. }
  389. channel = chanctx_conf->def.chan;
  390. rcu_read_unlock();
  391. sband = local->hw.wiphy->bands[channel->band];
  392. ht_cap = &sband->ht_cap;
  393. if (!ht_cap->ht_supported || channel_type == NL80211_CHAN_NO_HT)
  394. return 0;
  395. if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_operation))
  396. return -ENOMEM;
  397. pos = skb_put(skb, 2 + sizeof(struct ieee80211_ht_operation));
  398. ieee80211_ie_build_ht_oper(pos, ht_cap, &sdata->vif.bss_conf.chandef,
  399. sdata->vif.bss_conf.ht_operation_mode);
  400. return 0;
  401. }
  402. static void ieee80211_mesh_path_timer(unsigned long data)
  403. {
  404. struct ieee80211_sub_if_data *sdata =
  405. (struct ieee80211_sub_if_data *) data;
  406. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  407. struct ieee80211_local *local = sdata->local;
  408. if (local->quiescing) {
  409. set_bit(TMR_RUNNING_MP, &ifmsh->timers_running);
  410. return;
  411. }
  412. ieee80211_queue_work(&local->hw, &sdata->work);
  413. }
  414. static void ieee80211_mesh_path_root_timer(unsigned long data)
  415. {
  416. struct ieee80211_sub_if_data *sdata =
  417. (struct ieee80211_sub_if_data *) data;
  418. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  419. struct ieee80211_local *local = sdata->local;
  420. set_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags);
  421. if (local->quiescing) {
  422. set_bit(TMR_RUNNING_MPR, &ifmsh->timers_running);
  423. return;
  424. }
  425. ieee80211_queue_work(&local->hw, &sdata->work);
  426. }
  427. void ieee80211_mesh_root_setup(struct ieee80211_if_mesh *ifmsh)
  428. {
  429. if (ifmsh->mshcfg.dot11MeshHWMPRootMode > IEEE80211_ROOTMODE_ROOT)
  430. set_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags);
  431. else {
  432. clear_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags);
  433. /* stop running timer */
  434. del_timer_sync(&ifmsh->mesh_path_root_timer);
  435. }
  436. }
  437. /**
  438. * ieee80211_fill_mesh_addresses - fill addresses of a locally originated mesh frame
  439. * @hdr: 802.11 frame header
  440. * @fc: frame control field
  441. * @meshda: destination address in the mesh
  442. * @meshsa: source address address in the mesh. Same as TA, as frame is
  443. * locally originated.
  444. *
  445. * Return the length of the 802.11 (does not include a mesh control header)
  446. */
  447. int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc,
  448. const u8 *meshda, const u8 *meshsa)
  449. {
  450. if (is_multicast_ether_addr(meshda)) {
  451. *fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS);
  452. /* DA TA SA */
  453. memcpy(hdr->addr1, meshda, ETH_ALEN);
  454. memcpy(hdr->addr2, meshsa, ETH_ALEN);
  455. memcpy(hdr->addr3, meshsa, ETH_ALEN);
  456. return 24;
  457. } else {
  458. *fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS);
  459. /* RA TA DA SA */
  460. memset(hdr->addr1, 0, ETH_ALEN); /* RA is resolved later */
  461. memcpy(hdr->addr2, meshsa, ETH_ALEN);
  462. memcpy(hdr->addr3, meshda, ETH_ALEN);
  463. memcpy(hdr->addr4, meshsa, ETH_ALEN);
  464. return 30;
  465. }
  466. }
  467. /**
  468. * ieee80211_new_mesh_header - create a new mesh header
  469. * @meshhdr: uninitialized mesh header
  470. * @sdata: mesh interface to be used
  471. * @addr4or5: 1st address in the ae header, which may correspond to address 4
  472. * (if addr6 is NULL) or address 5 (if addr6 is present). It may
  473. * be NULL.
  474. * @addr6: 2nd address in the ae header, which corresponds to addr6 of the
  475. * mesh frame
  476. *
  477. * Return the header length.
  478. */
  479. int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr,
  480. struct ieee80211_sub_if_data *sdata, char *addr4or5,
  481. char *addr6)
  482. {
  483. int aelen = 0;
  484. BUG_ON(!addr4or5 && addr6);
  485. memset(meshhdr, 0, sizeof(*meshhdr));
  486. meshhdr->ttl = sdata->u.mesh.mshcfg.dot11MeshTTL;
  487. put_unaligned(cpu_to_le32(sdata->u.mesh.mesh_seqnum), &meshhdr->seqnum);
  488. sdata->u.mesh.mesh_seqnum++;
  489. if (addr4or5 && !addr6) {
  490. meshhdr->flags |= MESH_FLAGS_AE_A4;
  491. aelen += ETH_ALEN;
  492. memcpy(meshhdr->eaddr1, addr4or5, ETH_ALEN);
  493. } else if (addr4or5 && addr6) {
  494. meshhdr->flags |= MESH_FLAGS_AE_A5_A6;
  495. aelen += 2 * ETH_ALEN;
  496. memcpy(meshhdr->eaddr1, addr4or5, ETH_ALEN);
  497. memcpy(meshhdr->eaddr2, addr6, ETH_ALEN);
  498. }
  499. return 6 + aelen;
  500. }
  501. static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata,
  502. struct ieee80211_if_mesh *ifmsh)
  503. {
  504. u32 changed;
  505. ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT);
  506. mesh_path_expire(sdata);
  507. changed = mesh_accept_plinks_update(sdata);
  508. ieee80211_mbss_info_change_notify(sdata, changed);
  509. mod_timer(&ifmsh->housekeeping_timer,
  510. round_jiffies(jiffies + IEEE80211_MESH_HOUSEKEEPING_INTERVAL));
  511. }
  512. static void ieee80211_mesh_rootpath(struct ieee80211_sub_if_data *sdata)
  513. {
  514. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  515. u32 interval;
  516. mesh_path_tx_root_frame(sdata);
  517. if (ifmsh->mshcfg.dot11MeshHWMPRootMode == IEEE80211_PROACTIVE_RANN)
  518. interval = ifmsh->mshcfg.dot11MeshHWMPRannInterval;
  519. else
  520. interval = ifmsh->mshcfg.dot11MeshHWMProotInterval;
  521. mod_timer(&ifmsh->mesh_path_root_timer,
  522. round_jiffies(TU_TO_EXP_TIME(interval)));
  523. }
  524. #ifdef CONFIG_PM
  525. void ieee80211_mesh_quiesce(struct ieee80211_sub_if_data *sdata)
  526. {
  527. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  528. /* use atomic bitops in case all timers fire at the same time */
  529. if (del_timer_sync(&ifmsh->housekeeping_timer))
  530. set_bit(TMR_RUNNING_HK, &ifmsh->timers_running);
  531. if (del_timer_sync(&ifmsh->mesh_path_timer))
  532. set_bit(TMR_RUNNING_MP, &ifmsh->timers_running);
  533. if (del_timer_sync(&ifmsh->mesh_path_root_timer))
  534. set_bit(TMR_RUNNING_MPR, &ifmsh->timers_running);
  535. }
  536. void ieee80211_mesh_restart(struct ieee80211_sub_if_data *sdata)
  537. {
  538. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  539. if (test_and_clear_bit(TMR_RUNNING_HK, &ifmsh->timers_running))
  540. add_timer(&ifmsh->housekeeping_timer);
  541. if (test_and_clear_bit(TMR_RUNNING_MP, &ifmsh->timers_running))
  542. add_timer(&ifmsh->mesh_path_timer);
  543. if (test_and_clear_bit(TMR_RUNNING_MPR, &ifmsh->timers_running))
  544. add_timer(&ifmsh->mesh_path_root_timer);
  545. ieee80211_mesh_root_setup(ifmsh);
  546. }
  547. #endif
  548. static int
  549. ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh)
  550. {
  551. struct beacon_data *bcn;
  552. int head_len, tail_len;
  553. struct sk_buff *skb;
  554. struct ieee80211_mgmt *mgmt;
  555. struct ieee80211_chanctx_conf *chanctx_conf;
  556. enum ieee80211_band band;
  557. u8 *pos;
  558. struct ieee80211_sub_if_data *sdata;
  559. int hdr_len = offsetof(struct ieee80211_mgmt, u.beacon) +
  560. sizeof(mgmt->u.beacon);
  561. sdata = container_of(ifmsh, struct ieee80211_sub_if_data, u.mesh);
  562. rcu_read_lock();
  563. chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
  564. band = chanctx_conf->def.chan->band;
  565. rcu_read_unlock();
  566. head_len = hdr_len +
  567. 2 + /* NULL SSID */
  568. 2 + 8 + /* supported rates */
  569. 2 + 3; /* DS params */
  570. tail_len = 2 + (IEEE80211_MAX_SUPP_RATES - 8) +
  571. 2 + sizeof(struct ieee80211_ht_cap) +
  572. 2 + sizeof(struct ieee80211_ht_operation) +
  573. 2 + ifmsh->mesh_id_len +
  574. 2 + sizeof(struct ieee80211_meshconf_ie) +
  575. 2 + sizeof(__le16) + /* awake window */
  576. ifmsh->ie_len;
  577. bcn = kzalloc(sizeof(*bcn) + head_len + tail_len, GFP_KERNEL);
  578. /* need an skb for IE builders to operate on */
  579. skb = dev_alloc_skb(max(head_len, tail_len));
  580. if (!bcn || !skb)
  581. goto out_free;
  582. /*
  583. * pointers go into the block we allocated,
  584. * memory is | beacon_data | head | tail |
  585. */
  586. bcn->head = ((u8 *) bcn) + sizeof(*bcn);
  587. /* fill in the head */
  588. mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len);
  589. memset(mgmt, 0, hdr_len);
  590. mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
  591. IEEE80211_STYPE_BEACON);
  592. eth_broadcast_addr(mgmt->da);
  593. memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
  594. memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
  595. ieee80211_mps_set_frame_flags(sdata, NULL, (void *) mgmt);
  596. mgmt->u.beacon.beacon_int =
  597. cpu_to_le16(sdata->vif.bss_conf.beacon_int);
  598. mgmt->u.beacon.capab_info |= cpu_to_le16(
  599. sdata->u.mesh.security ? WLAN_CAPABILITY_PRIVACY : 0);
  600. pos = skb_put(skb, 2);
  601. *pos++ = WLAN_EID_SSID;
  602. *pos++ = 0x0;
  603. if (ieee80211_add_srates_ie(sdata, skb, true, band) ||
  604. mesh_add_ds_params_ie(skb, sdata))
  605. goto out_free;
  606. bcn->head_len = skb->len;
  607. memcpy(bcn->head, skb->data, bcn->head_len);
  608. /* now the tail */
  609. skb_trim(skb, 0);
  610. bcn->tail = bcn->head + bcn->head_len;
  611. if (ieee80211_add_ext_srates_ie(sdata, skb, true, band) ||
  612. mesh_add_rsn_ie(skb, sdata) ||
  613. mesh_add_ht_cap_ie(skb, sdata) ||
  614. mesh_add_ht_oper_ie(skb, sdata) ||
  615. mesh_add_meshid_ie(skb, sdata) ||
  616. mesh_add_meshconf_ie(skb, sdata) ||
  617. mesh_add_awake_window_ie(skb, sdata) ||
  618. mesh_add_vendor_ies(skb, sdata))
  619. goto out_free;
  620. bcn->tail_len = skb->len;
  621. memcpy(bcn->tail, skb->data, bcn->tail_len);
  622. dev_kfree_skb(skb);
  623. rcu_assign_pointer(ifmsh->beacon, bcn);
  624. return 0;
  625. out_free:
  626. kfree(bcn);
  627. dev_kfree_skb(skb);
  628. return -ENOMEM;
  629. }
  630. static int
  631. ieee80211_mesh_rebuild_beacon(struct ieee80211_if_mesh *ifmsh)
  632. {
  633. struct ieee80211_sub_if_data *sdata;
  634. struct beacon_data *old_bcn;
  635. int ret;
  636. sdata = container_of(ifmsh, struct ieee80211_sub_if_data, u.mesh);
  637. mutex_lock(&ifmsh->mtx);
  638. old_bcn = rcu_dereference_protected(ifmsh->beacon,
  639. lockdep_is_held(&ifmsh->mtx));
  640. ret = ieee80211_mesh_build_beacon(ifmsh);
  641. if (ret)
  642. /* just reuse old beacon */
  643. goto out;
  644. if (old_bcn)
  645. kfree_rcu(old_bcn, rcu_head);
  646. out:
  647. mutex_unlock(&ifmsh->mtx);
  648. return ret;
  649. }
  650. void ieee80211_mbss_info_change_notify(struct ieee80211_sub_if_data *sdata,
  651. u32 changed)
  652. {
  653. if (sdata->vif.bss_conf.enable_beacon &&
  654. (changed & (BSS_CHANGED_BEACON |
  655. BSS_CHANGED_HT |
  656. BSS_CHANGED_BASIC_RATES |
  657. BSS_CHANGED_BEACON_INT)))
  658. if (ieee80211_mesh_rebuild_beacon(&sdata->u.mesh))
  659. return;
  660. ieee80211_bss_info_change_notify(sdata, changed);
  661. }
  662. int ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
  663. {
  664. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  665. struct ieee80211_local *local = sdata->local;
  666. u32 changed = BSS_CHANGED_BEACON |
  667. BSS_CHANGED_BEACON_ENABLED |
  668. BSS_CHANGED_HT |
  669. BSS_CHANGED_BASIC_RATES |
  670. BSS_CHANGED_BEACON_INT;
  671. enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
  672. local->fif_other_bss++;
  673. /* mesh ifaces must set allmulti to forward mcast traffic */
  674. atomic_inc(&local->iff_allmultis);
  675. ieee80211_configure_filter(local);
  676. ifmsh->mesh_cc_id = 0; /* Disabled */
  677. ifmsh->mesh_auth_id = 0; /* Disabled */
  678. /* register sync ops from extensible synchronization framework */
  679. ifmsh->sync_ops = ieee80211_mesh_sync_ops_get(ifmsh->mesh_sp_id);
  680. ifmsh->adjusting_tbtt = false;
  681. ifmsh->sync_offset_clockdrift_max = 0;
  682. set_bit(MESH_WORK_HOUSEKEEPING, &ifmsh->wrkq_flags);
  683. ieee80211_mesh_root_setup(ifmsh);
  684. ieee80211_queue_work(&local->hw, &sdata->work);
  685. sdata->vif.bss_conf.ht_operation_mode =
  686. ifmsh->mshcfg.ht_opmode;
  687. sdata->vif.bss_conf.enable_beacon = true;
  688. sdata->vif.bss_conf.basic_rates =
  689. ieee80211_mandatory_rates(local, band);
  690. changed |= ieee80211_mps_local_status_update(sdata);
  691. if (ieee80211_mesh_build_beacon(ifmsh)) {
  692. ieee80211_stop_mesh(sdata);
  693. return -ENOMEM;
  694. }
  695. ieee80211_bss_info_change_notify(sdata, changed);
  696. netif_carrier_on(sdata->dev);
  697. return 0;
  698. }
  699. void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
  700. {
  701. struct ieee80211_local *local = sdata->local;
  702. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  703. struct beacon_data *bcn;
  704. netif_carrier_off(sdata->dev);
  705. /* stop the beacon */
  706. ifmsh->mesh_id_len = 0;
  707. sdata->vif.bss_conf.enable_beacon = false;
  708. clear_bit(SDATA_STATE_OFFCHANNEL_BEACON_STOPPED, &sdata->state);
  709. ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED);
  710. mutex_lock(&ifmsh->mtx);
  711. bcn = rcu_dereference_protected(ifmsh->beacon,
  712. lockdep_is_held(&ifmsh->mtx));
  713. rcu_assign_pointer(ifmsh->beacon, NULL);
  714. kfree_rcu(bcn, rcu_head);
  715. mutex_unlock(&ifmsh->mtx);
  716. /* flush STAs and mpaths on this iface */
  717. sta_info_flush(sdata);
  718. mesh_path_flush_by_iface(sdata);
  719. /* free all potentially still buffered group-addressed frames */
  720. local->total_ps_buffered -= skb_queue_len(&ifmsh->ps.bc_buf);
  721. skb_queue_purge(&ifmsh->ps.bc_buf);
  722. del_timer_sync(&sdata->u.mesh.housekeeping_timer);
  723. del_timer_sync(&sdata->u.mesh.mesh_path_root_timer);
  724. del_timer_sync(&sdata->u.mesh.mesh_path_timer);
  725. /*
  726. * If the timer fired while we waited for it, it will have
  727. * requeued the work. Now the work will be running again
  728. * but will not rearm the timer again because it checks
  729. * whether the interface is running, which, at this point,
  730. * it no longer is.
  731. */
  732. cancel_work_sync(&sdata->work);
  733. local->fif_other_bss--;
  734. atomic_dec(&local->iff_allmultis);
  735. ieee80211_configure_filter(local);
  736. sdata->u.mesh.timers_running = 0;
  737. }
  738. static void
  739. ieee80211_mesh_rx_probe_req(struct ieee80211_sub_if_data *sdata,
  740. struct ieee80211_mgmt *mgmt, size_t len)
  741. {
  742. struct ieee80211_local *local = sdata->local;
  743. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  744. struct sk_buff *presp;
  745. struct beacon_data *bcn;
  746. struct ieee80211_mgmt *hdr;
  747. struct ieee802_11_elems elems;
  748. size_t baselen;
  749. u8 *pos, *end;
  750. end = ((u8 *) mgmt) + len;
  751. pos = mgmt->u.probe_req.variable;
  752. baselen = (u8 *) pos - (u8 *) mgmt;
  753. if (baselen > len)
  754. return;
  755. ieee802_11_parse_elems(pos, len - baselen, &elems);
  756. /* 802.11-2012 10.1.4.3.2 */
  757. if ((!ether_addr_equal(mgmt->da, sdata->vif.addr) &&
  758. !is_broadcast_ether_addr(mgmt->da)) ||
  759. elems.ssid_len != 0)
  760. return;
  761. if (elems.mesh_id_len != 0 &&
  762. (elems.mesh_id_len != ifmsh->mesh_id_len ||
  763. memcmp(elems.mesh_id, ifmsh->mesh_id, ifmsh->mesh_id_len)))
  764. return;
  765. rcu_read_lock();
  766. bcn = rcu_dereference(ifmsh->beacon);
  767. if (!bcn)
  768. goto out;
  769. presp = dev_alloc_skb(local->tx_headroom +
  770. bcn->head_len + bcn->tail_len);
  771. if (!presp)
  772. goto out;
  773. skb_reserve(presp, local->tx_headroom);
  774. memcpy(skb_put(presp, bcn->head_len), bcn->head, bcn->head_len);
  775. memcpy(skb_put(presp, bcn->tail_len), bcn->tail, bcn->tail_len);
  776. hdr = (struct ieee80211_mgmt *) presp->data;
  777. hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
  778. IEEE80211_STYPE_PROBE_RESP);
  779. memcpy(hdr->da, mgmt->sa, ETH_ALEN);
  780. mpl_dbg(sdata, "sending probe resp. to %pM\n", hdr->da);
  781. IEEE80211_SKB_CB(presp)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
  782. ieee80211_tx_skb(sdata, presp);
  783. out:
  784. rcu_read_unlock();
  785. }
  786. static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
  787. u16 stype,
  788. struct ieee80211_mgmt *mgmt,
  789. size_t len,
  790. struct ieee80211_rx_status *rx_status)
  791. {
  792. struct ieee80211_local *local = sdata->local;
  793. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  794. struct ieee802_11_elems elems;
  795. struct ieee80211_channel *channel;
  796. size_t baselen;
  797. int freq;
  798. enum ieee80211_band band = rx_status->band;
  799. /* ignore ProbeResp to foreign address */
  800. if (stype == IEEE80211_STYPE_PROBE_RESP &&
  801. !ether_addr_equal(mgmt->da, sdata->vif.addr))
  802. return;
  803. baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
  804. if (baselen > len)
  805. return;
  806. ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen,
  807. &elems);
  808. /* ignore non-mesh or secure / unsecure mismatch */
  809. if ((!elems.mesh_id || !elems.mesh_config) ||
  810. (elems.rsn && sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) ||
  811. (!elems.rsn && sdata->u.mesh.security != IEEE80211_MESH_SEC_NONE))
  812. return;
  813. if (elems.ds_params && elems.ds_params_len == 1)
  814. freq = ieee80211_channel_to_frequency(elems.ds_params[0], band);
  815. else
  816. freq = rx_status->freq;
  817. channel = ieee80211_get_channel(local->hw.wiphy, freq);
  818. if (!channel || channel->flags & IEEE80211_CHAN_DISABLED)
  819. return;
  820. if (mesh_matches_local(sdata, &elems))
  821. mesh_neighbour_update(sdata, mgmt->sa, &elems);
  822. if (ifmsh->sync_ops)
  823. ifmsh->sync_ops->rx_bcn_presp(sdata,
  824. stype, mgmt, &elems, rx_status);
  825. }
  826. static void ieee80211_mesh_rx_mgmt_action(struct ieee80211_sub_if_data *sdata,
  827. struct ieee80211_mgmt *mgmt,
  828. size_t len,
  829. struct ieee80211_rx_status *rx_status)
  830. {
  831. switch (mgmt->u.action.category) {
  832. case WLAN_CATEGORY_SELF_PROTECTED:
  833. switch (mgmt->u.action.u.self_prot.action_code) {
  834. case WLAN_SP_MESH_PEERING_OPEN:
  835. case WLAN_SP_MESH_PEERING_CLOSE:
  836. case WLAN_SP_MESH_PEERING_CONFIRM:
  837. mesh_rx_plink_frame(sdata, mgmt, len, rx_status);
  838. break;
  839. }
  840. break;
  841. case WLAN_CATEGORY_MESH_ACTION:
  842. if (mesh_action_is_path_sel(mgmt))
  843. mesh_rx_path_sel_frame(sdata, mgmt, len);
  844. break;
  845. }
  846. }
  847. void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
  848. struct sk_buff *skb)
  849. {
  850. struct ieee80211_rx_status *rx_status;
  851. struct ieee80211_mgmt *mgmt;
  852. u16 stype;
  853. rx_status = IEEE80211_SKB_RXCB(skb);
  854. mgmt = (struct ieee80211_mgmt *) skb->data;
  855. stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE;
  856. switch (stype) {
  857. case IEEE80211_STYPE_PROBE_RESP:
  858. case IEEE80211_STYPE_BEACON:
  859. ieee80211_mesh_rx_bcn_presp(sdata, stype, mgmt, skb->len,
  860. rx_status);
  861. break;
  862. case IEEE80211_STYPE_PROBE_REQ:
  863. ieee80211_mesh_rx_probe_req(sdata, mgmt, skb->len);
  864. break;
  865. case IEEE80211_STYPE_ACTION:
  866. ieee80211_mesh_rx_mgmt_action(sdata, mgmt, skb->len, rx_status);
  867. break;
  868. }
  869. }
  870. void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata)
  871. {
  872. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  873. if (ifmsh->preq_queue_len &&
  874. time_after(jiffies,
  875. ifmsh->last_preq + msecs_to_jiffies(ifmsh->mshcfg.dot11MeshHWMPpreqMinInterval)))
  876. mesh_path_start_discovery(sdata);
  877. if (test_and_clear_bit(MESH_WORK_GROW_MPATH_TABLE, &ifmsh->wrkq_flags))
  878. mesh_mpath_table_grow();
  879. if (test_and_clear_bit(MESH_WORK_GROW_MPP_TABLE, &ifmsh->wrkq_flags))
  880. mesh_mpp_table_grow();
  881. if (test_and_clear_bit(MESH_WORK_HOUSEKEEPING, &ifmsh->wrkq_flags))
  882. ieee80211_mesh_housekeeping(sdata, ifmsh);
  883. if (test_and_clear_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags))
  884. ieee80211_mesh_rootpath(sdata);
  885. if (test_and_clear_bit(MESH_WORK_DRIFT_ADJUST, &ifmsh->wrkq_flags))
  886. mesh_sync_adjust_tbtt(sdata);
  887. }
  888. void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local)
  889. {
  890. struct ieee80211_sub_if_data *sdata;
  891. rcu_read_lock();
  892. list_for_each_entry_rcu(sdata, &local->interfaces, list)
  893. if (ieee80211_vif_is_mesh(&sdata->vif))
  894. ieee80211_queue_work(&local->hw, &sdata->work);
  895. rcu_read_unlock();
  896. }
  897. void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
  898. {
  899. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  900. static u8 zero_addr[ETH_ALEN] = {};
  901. setup_timer(&ifmsh->housekeeping_timer,
  902. ieee80211_mesh_housekeeping_timer,
  903. (unsigned long) sdata);
  904. ifmsh->accepting_plinks = true;
  905. ifmsh->preq_id = 0;
  906. ifmsh->sn = 0;
  907. ifmsh->num_gates = 0;
  908. atomic_set(&ifmsh->mpaths, 0);
  909. mesh_rmc_init(sdata);
  910. ifmsh->last_preq = jiffies;
  911. ifmsh->next_perr = jiffies;
  912. /* Allocate all mesh structures when creating the first mesh interface. */
  913. if (!mesh_allocated)
  914. ieee80211s_init();
  915. setup_timer(&ifmsh->mesh_path_timer,
  916. ieee80211_mesh_path_timer,
  917. (unsigned long) sdata);
  918. setup_timer(&ifmsh->mesh_path_root_timer,
  919. ieee80211_mesh_path_root_timer,
  920. (unsigned long) sdata);
  921. INIT_LIST_HEAD(&ifmsh->preq_queue.list);
  922. skb_queue_head_init(&ifmsh->ps.bc_buf);
  923. spin_lock_init(&ifmsh->mesh_preq_queue_lock);
  924. spin_lock_init(&ifmsh->sync_offset_lock);
  925. RCU_INIT_POINTER(ifmsh->beacon, NULL);
  926. mutex_init(&ifmsh->mtx);
  927. sdata->vif.bss_conf.bssid = zero_addr;
  928. }