diff options
Diffstat (limited to 'net/mac80211/ibss.c')
-rw-r--r-- | net/mac80211/ibss.c | 139 |
1 files changed, 79 insertions, 60 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index f1362f32c17d..e2976da4e0d9 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -13,6 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/slab.h> | ||
16 | #include <linux/if_ether.h> | 17 | #include <linux/if_ether.h> |
17 | #include <linux/skbuff.h> | 18 | #include <linux/skbuff.h> |
18 | #include <linux/if_arp.h> | 19 | #include <linux/if_arp.h> |
@@ -117,7 +118,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
117 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 118 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
118 | IEEE80211_STYPE_PROBE_RESP); | 119 | IEEE80211_STYPE_PROBE_RESP); |
119 | memset(mgmt->da, 0xff, ETH_ALEN); | 120 | memset(mgmt->da, 0xff, ETH_ALEN); |
120 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 121 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
121 | memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); | 122 | memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); |
122 | mgmt->u.beacon.beacon_int = cpu_to_le16(beacon_int); | 123 | mgmt->u.beacon.beacon_int = cpu_to_le16(beacon_int); |
123 | mgmt->u.beacon.timestamp = cpu_to_le64(tsf); | 124 | mgmt->u.beacon.timestamp = cpu_to_le64(tsf); |
@@ -187,15 +188,17 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
187 | static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | 188 | static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, |
188 | struct ieee80211_bss *bss) | 189 | struct ieee80211_bss *bss) |
189 | { | 190 | { |
191 | struct cfg80211_bss *cbss = | ||
192 | container_of((void *)bss, struct cfg80211_bss, priv); | ||
190 | struct ieee80211_supported_band *sband; | 193 | struct ieee80211_supported_band *sband; |
191 | u32 basic_rates; | 194 | u32 basic_rates; |
192 | int i, j; | 195 | int i, j; |
193 | u16 beacon_int = bss->cbss.beacon_interval; | 196 | u16 beacon_int = cbss->beacon_interval; |
194 | 197 | ||
195 | if (beacon_int < 10) | 198 | if (beacon_int < 10) |
196 | beacon_int = 10; | 199 | beacon_int = 10; |
197 | 200 | ||
198 | sband = sdata->local->hw.wiphy->bands[bss->cbss.channel->band]; | 201 | sband = sdata->local->hw.wiphy->bands[cbss->channel->band]; |
199 | 202 | ||
200 | basic_rates = 0; | 203 | basic_rates = 0; |
201 | 204 | ||
@@ -212,12 +215,12 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
212 | } | 215 | } |
213 | } | 216 | } |
214 | 217 | ||
215 | __ieee80211_sta_join_ibss(sdata, bss->cbss.bssid, | 218 | __ieee80211_sta_join_ibss(sdata, cbss->bssid, |
216 | beacon_int, | 219 | beacon_int, |
217 | bss->cbss.channel, | 220 | cbss->channel, |
218 | basic_rates, | 221 | basic_rates, |
219 | bss->cbss.capability, | 222 | cbss->capability, |
220 | bss->cbss.tsf); | 223 | cbss->tsf); |
221 | } | 224 | } |
222 | 225 | ||
223 | static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | 226 | static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, |
@@ -229,6 +232,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
229 | { | 232 | { |
230 | struct ieee80211_local *local = sdata->local; | 233 | struct ieee80211_local *local = sdata->local; |
231 | int freq; | 234 | int freq; |
235 | struct cfg80211_bss *cbss; | ||
232 | struct ieee80211_bss *bss; | 236 | struct ieee80211_bss *bss; |
233 | struct sta_info *sta; | 237 | struct sta_info *sta; |
234 | struct ieee80211_channel *channel; | 238 | struct ieee80211_channel *channel; |
@@ -252,7 +256,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
252 | 256 | ||
253 | rcu_read_lock(); | 257 | rcu_read_lock(); |
254 | 258 | ||
255 | sta = sta_info_get(local, mgmt->sa); | 259 | sta = sta_info_get(sdata, mgmt->sa); |
256 | if (sta) { | 260 | if (sta) { |
257 | u32 prev_rates; | 261 | u32 prev_rates; |
258 | 262 | ||
@@ -266,16 +270,18 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
266 | printk(KERN_DEBUG "%s: updated supp_rates set " | 270 | printk(KERN_DEBUG "%s: updated supp_rates set " |
267 | "for %pM based on beacon info (0x%llx | " | 271 | "for %pM based on beacon info (0x%llx | " |
268 | "0x%llx -> 0x%llx)\n", | 272 | "0x%llx -> 0x%llx)\n", |
269 | sdata->dev->name, | 273 | sdata->name, |
270 | sta->sta.addr, | 274 | sta->sta.addr, |
271 | (unsigned long long) prev_rates, | 275 | (unsigned long long) prev_rates, |
272 | (unsigned long long) supp_rates, | 276 | (unsigned long long) supp_rates, |
273 | (unsigned long long) sta->sta.supp_rates[band]); | 277 | (unsigned long long) sta->sta.supp_rates[band]); |
274 | #endif | 278 | #endif |
275 | } else | 279 | rcu_read_unlock(); |
276 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, supp_rates); | 280 | } else { |
277 | 281 | rcu_read_unlock(); | |
278 | rcu_read_unlock(); | 282 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, |
283 | supp_rates, GFP_KERNEL); | ||
284 | } | ||
279 | } | 285 | } |
280 | 286 | ||
281 | bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems, | 287 | bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems, |
@@ -283,25 +289,23 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
283 | if (!bss) | 289 | if (!bss) |
284 | return; | 290 | return; |
285 | 291 | ||
292 | cbss = container_of((void *)bss, struct cfg80211_bss, priv); | ||
293 | |||
286 | /* was just updated in ieee80211_bss_info_update */ | 294 | /* was just updated in ieee80211_bss_info_update */ |
287 | beacon_timestamp = bss->cbss.tsf; | 295 | beacon_timestamp = cbss->tsf; |
288 | 296 | ||
289 | /* check if we need to merge IBSS */ | 297 | /* check if we need to merge IBSS */ |
290 | 298 | ||
291 | /* merge only on beacons (???) */ | ||
292 | if (!beacon) | ||
293 | goto put_bss; | ||
294 | |||
295 | /* we use a fixed BSSID */ | 299 | /* we use a fixed BSSID */ |
296 | if (sdata->u.ibss.bssid) | 300 | if (sdata->u.ibss.fixed_bssid) |
297 | goto put_bss; | 301 | goto put_bss; |
298 | 302 | ||
299 | /* not an IBSS */ | 303 | /* not an IBSS */ |
300 | if (!(bss->cbss.capability & WLAN_CAPABILITY_IBSS)) | 304 | if (!(cbss->capability & WLAN_CAPABILITY_IBSS)) |
301 | goto put_bss; | 305 | goto put_bss; |
302 | 306 | ||
303 | /* different channel */ | 307 | /* different channel */ |
304 | if (bss->cbss.channel != local->oper_channel) | 308 | if (cbss->channel != local->oper_channel) |
305 | goto put_bss; | 309 | goto put_bss; |
306 | 310 | ||
307 | /* different SSID */ | 311 | /* different SSID */ |
@@ -311,7 +315,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
311 | goto put_bss; | 315 | goto put_bss; |
312 | 316 | ||
313 | /* same BSSID */ | 317 | /* same BSSID */ |
314 | if (memcmp(bss->cbss.bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0) | 318 | if (memcmp(cbss->bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0) |
315 | goto put_bss; | 319 | goto put_bss; |
316 | 320 | ||
317 | if (rx_status->flag & RX_FLAG_TSFT) { | 321 | if (rx_status->flag & RX_FLAG_TSFT) { |
@@ -364,10 +368,11 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
364 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 368 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
365 | printk(KERN_DEBUG "%s: beacon TSF higher than " | 369 | printk(KERN_DEBUG "%s: beacon TSF higher than " |
366 | "local TSF - IBSS merge with BSSID %pM\n", | 370 | "local TSF - IBSS merge with BSSID %pM\n", |
367 | sdata->dev->name, mgmt->bssid); | 371 | sdata->name, mgmt->bssid); |
368 | #endif | 372 | #endif |
369 | ieee80211_sta_join_ibss(sdata, bss); | 373 | ieee80211_sta_join_ibss(sdata, bss); |
370 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, supp_rates); | 374 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, |
375 | supp_rates, GFP_KERNEL); | ||
371 | } | 376 | } |
372 | 377 | ||
373 | put_bss: | 378 | put_bss: |
@@ -380,8 +385,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
380 | * must be callable in atomic context. | 385 | * must be callable in atomic context. |
381 | */ | 386 | */ |
382 | struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | 387 | struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, |
383 | u8 *bssid,u8 *addr, u32 supp_rates) | 388 | u8 *bssid,u8 *addr, u32 supp_rates, |
389 | gfp_t gfp) | ||
384 | { | 390 | { |
391 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; | ||
385 | struct ieee80211_local *local = sdata->local; | 392 | struct ieee80211_local *local = sdata->local; |
386 | struct sta_info *sta; | 393 | struct sta_info *sta; |
387 | int band = local->hw.conf.channel->band; | 394 | int band = local->hw.conf.channel->band; |
@@ -393,19 +400,22 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
393 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { | 400 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { |
394 | if (net_ratelimit()) | 401 | if (net_ratelimit()) |
395 | printk(KERN_DEBUG "%s: No room for a new IBSS STA entry %pM\n", | 402 | printk(KERN_DEBUG "%s: No room for a new IBSS STA entry %pM\n", |
396 | sdata->dev->name, addr); | 403 | sdata->name, addr); |
397 | return NULL; | 404 | return NULL; |
398 | } | 405 | } |
399 | 406 | ||
407 | if (ifibss->state == IEEE80211_IBSS_MLME_SEARCH) | ||
408 | return NULL; | ||
409 | |||
400 | if (compare_ether_addr(bssid, sdata->u.ibss.bssid)) | 410 | if (compare_ether_addr(bssid, sdata->u.ibss.bssid)) |
401 | return NULL; | 411 | return NULL; |
402 | 412 | ||
403 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 413 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
404 | printk(KERN_DEBUG "%s: Adding new IBSS station %pM (dev=%s)\n", | 414 | printk(KERN_DEBUG "%s: Adding new IBSS station %pM (dev=%s)\n", |
405 | wiphy_name(local->hw.wiphy), addr, sdata->dev->name); | 415 | wiphy_name(local->hw.wiphy), addr, sdata->name); |
406 | #endif | 416 | #endif |
407 | 417 | ||
408 | sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); | 418 | sta = sta_info_alloc(sdata, addr, gfp); |
409 | if (!sta) | 419 | if (!sta) |
410 | return NULL; | 420 | return NULL; |
411 | 421 | ||
@@ -417,9 +427,9 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
417 | 427 | ||
418 | rate_control_rate_init(sta); | 428 | rate_control_rate_init(sta); |
419 | 429 | ||
430 | /* If it fails, maybe we raced another insertion? */ | ||
420 | if (sta_info_insert(sta)) | 431 | if (sta_info_insert(sta)) |
421 | return NULL; | 432 | return sta_info_get(sdata, addr); |
422 | |||
423 | return sta; | 433 | return sta; |
424 | } | 434 | } |
425 | 435 | ||
@@ -445,6 +455,9 @@ static int ieee80211_sta_active_ibss(struct ieee80211_sub_if_data *sdata) | |||
445 | return active; | 455 | return active; |
446 | } | 456 | } |
447 | 457 | ||
458 | /* | ||
459 | * This function is called with state == IEEE80211_IBSS_MLME_JOINED | ||
460 | */ | ||
448 | 461 | ||
449 | static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata) | 462 | static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata) |
450 | { | 463 | { |
@@ -455,6 +468,10 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata) | |||
455 | 468 | ||
456 | ieee80211_sta_expire(sdata, IEEE80211_IBSS_INACTIVITY_LIMIT); | 469 | ieee80211_sta_expire(sdata, IEEE80211_IBSS_INACTIVITY_LIMIT); |
457 | 470 | ||
471 | if (time_before(jiffies, ifibss->last_scan_completed + | ||
472 | IEEE80211_IBSS_MERGE_INTERVAL)) | ||
473 | return; | ||
474 | |||
458 | if (ieee80211_sta_active_ibss(sdata)) | 475 | if (ieee80211_sta_active_ibss(sdata)) |
459 | return; | 476 | return; |
460 | 477 | ||
@@ -462,7 +479,7 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata) | |||
462 | return; | 479 | return; |
463 | 480 | ||
464 | printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " | 481 | printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " |
465 | "IBSS networks with same SSID (merge)\n", sdata->dev->name); | 482 | "IBSS networks with same SSID (merge)\n", sdata->name); |
466 | 483 | ||
467 | ieee80211_request_internal_scan(sdata, ifibss->ssid, ifibss->ssid_len); | 484 | ieee80211_request_internal_scan(sdata, ifibss->ssid, ifibss->ssid_len); |
468 | } | 485 | } |
@@ -484,13 +501,13 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) | |||
484 | * random number generator get different BSSID. */ | 501 | * random number generator get different BSSID. */ |
485 | get_random_bytes(bssid, ETH_ALEN); | 502 | get_random_bytes(bssid, ETH_ALEN); |
486 | for (i = 0; i < ETH_ALEN; i++) | 503 | for (i = 0; i < ETH_ALEN; i++) |
487 | bssid[i] ^= sdata->dev->dev_addr[i]; | 504 | bssid[i] ^= sdata->vif.addr[i]; |
488 | bssid[0] &= ~0x01; | 505 | bssid[0] &= ~0x01; |
489 | bssid[0] |= 0x02; | 506 | bssid[0] |= 0x02; |
490 | } | 507 | } |
491 | 508 | ||
492 | printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %pM\n", | 509 | printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %pM\n", |
493 | sdata->dev->name, bssid); | 510 | sdata->name, bssid); |
494 | 511 | ||
495 | sband = local->hw.wiphy->bands[ifibss->channel->band]; | 512 | sband = local->hw.wiphy->bands[ifibss->channel->band]; |
496 | 513 | ||
@@ -506,11 +523,15 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) | |||
506 | capability, 0); | 523 | capability, 0); |
507 | } | 524 | } |
508 | 525 | ||
526 | /* | ||
527 | * This function is called with state == IEEE80211_IBSS_MLME_SEARCH | ||
528 | */ | ||
529 | |||
509 | static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | 530 | static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) |
510 | { | 531 | { |
511 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; | 532 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; |
512 | struct ieee80211_local *local = sdata->local; | 533 | struct ieee80211_local *local = sdata->local; |
513 | struct ieee80211_bss *bss; | 534 | struct cfg80211_bss *cbss; |
514 | struct ieee80211_channel *chan = NULL; | 535 | struct ieee80211_channel *chan = NULL; |
515 | const u8 *bssid = NULL; | 536 | const u8 *bssid = NULL; |
516 | int active_ibss; | 537 | int active_ibss; |
@@ -519,7 +540,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
519 | active_ibss = ieee80211_sta_active_ibss(sdata); | 540 | active_ibss = ieee80211_sta_active_ibss(sdata); |
520 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 541 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
521 | printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n", | 542 | printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n", |
522 | sdata->dev->name, active_ibss); | 543 | sdata->name, active_ibss); |
523 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 544 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
524 | 545 | ||
525 | if (active_ibss) | 546 | if (active_ibss) |
@@ -534,21 +555,23 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
534 | chan = ifibss->channel; | 555 | chan = ifibss->channel; |
535 | if (!is_zero_ether_addr(ifibss->bssid)) | 556 | if (!is_zero_ether_addr(ifibss->bssid)) |
536 | bssid = ifibss->bssid; | 557 | bssid = ifibss->bssid; |
537 | bss = (void *)cfg80211_get_bss(local->hw.wiphy, chan, bssid, | 558 | cbss = cfg80211_get_bss(local->hw.wiphy, chan, bssid, |
538 | ifibss->ssid, ifibss->ssid_len, | 559 | ifibss->ssid, ifibss->ssid_len, |
539 | WLAN_CAPABILITY_IBSS | | 560 | WLAN_CAPABILITY_IBSS | WLAN_CAPABILITY_PRIVACY, |
540 | WLAN_CAPABILITY_PRIVACY, | 561 | capability); |
541 | capability); | 562 | |
563 | if (cbss) { | ||
564 | struct ieee80211_bss *bss; | ||
542 | 565 | ||
543 | if (bss) { | 566 | bss = (void *)cbss->priv; |
544 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 567 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
545 | printk(KERN_DEBUG " sta_find_ibss: selected %pM current " | 568 | printk(KERN_DEBUG " sta_find_ibss: selected %pM current " |
546 | "%pM\n", bss->cbss.bssid, ifibss->bssid); | 569 | "%pM\n", cbss->bssid, ifibss->bssid); |
547 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 570 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
548 | 571 | ||
549 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM" | 572 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM" |
550 | " based on configured SSID\n", | 573 | " based on configured SSID\n", |
551 | sdata->dev->name, bss->cbss.bssid); | 574 | sdata->name, cbss->bssid); |
552 | 575 | ||
553 | ieee80211_sta_join_ibss(sdata, bss); | 576 | ieee80211_sta_join_ibss(sdata, bss); |
554 | ieee80211_rx_bss_put(local, bss); | 577 | ieee80211_rx_bss_put(local, bss); |
@@ -560,18 +583,14 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
560 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 583 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
561 | 584 | ||
562 | /* Selected IBSS not found in current scan results - try to scan */ | 585 | /* Selected IBSS not found in current scan results - try to scan */ |
563 | if (ifibss->state == IEEE80211_IBSS_MLME_JOINED && | 586 | if (time_after(jiffies, ifibss->last_scan_completed + |
564 | !ieee80211_sta_active_ibss(sdata)) { | ||
565 | mod_timer(&ifibss->timer, | ||
566 | round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL)); | ||
567 | } else if (time_after(jiffies, ifibss->last_scan_completed + | ||
568 | IEEE80211_SCAN_INTERVAL)) { | 587 | IEEE80211_SCAN_INTERVAL)) { |
569 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " | 588 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " |
570 | "join\n", sdata->dev->name); | 589 | "join\n", sdata->name); |
571 | 590 | ||
572 | ieee80211_request_internal_scan(sdata, ifibss->ssid, | 591 | ieee80211_request_internal_scan(sdata, ifibss->ssid, |
573 | ifibss->ssid_len); | 592 | ifibss->ssid_len); |
574 | } else if (ifibss->state != IEEE80211_IBSS_MLME_JOINED) { | 593 | } else { |
575 | int interval = IEEE80211_SCAN_INTERVAL; | 594 | int interval = IEEE80211_SCAN_INTERVAL; |
576 | 595 | ||
577 | if (time_after(jiffies, ifibss->ibss_join_req + | 596 | if (time_after(jiffies, ifibss->ibss_join_req + |
@@ -581,7 +600,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
581 | return; | 600 | return; |
582 | } | 601 | } |
583 | printk(KERN_DEBUG "%s: IBSS not allowed on" | 602 | printk(KERN_DEBUG "%s: IBSS not allowed on" |
584 | " %d MHz\n", sdata->dev->name, | 603 | " %d MHz\n", sdata->name, |
585 | local->hw.conf.channel->center_freq); | 604 | local->hw.conf.channel->center_freq); |
586 | 605 | ||
587 | /* No IBSS found - decrease scan interval and continue | 606 | /* No IBSS found - decrease scan interval and continue |
@@ -589,7 +608,6 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
589 | interval = IEEE80211_SCAN_INTERVAL_SLOW; | 608 | interval = IEEE80211_SCAN_INTERVAL_SLOW; |
590 | } | 609 | } |
591 | 610 | ||
592 | ifibss->state = IEEE80211_IBSS_MLME_SEARCH; | ||
593 | mod_timer(&ifibss->timer, | 611 | mod_timer(&ifibss->timer, |
594 | round_jiffies(jiffies + interval)); | 612 | round_jiffies(jiffies + interval)); |
595 | } | 613 | } |
@@ -615,7 +633,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
615 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 633 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
616 | printk(KERN_DEBUG "%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM" | 634 | printk(KERN_DEBUG "%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM" |
617 | " (tx_last_beacon=%d)\n", | 635 | " (tx_last_beacon=%d)\n", |
618 | sdata->dev->name, mgmt->sa, mgmt->da, | 636 | sdata->name, mgmt->sa, mgmt->da, |
619 | mgmt->bssid, tx_last_beacon); | 637 | mgmt->bssid, tx_last_beacon); |
620 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 638 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
621 | 639 | ||
@@ -633,13 +651,13 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
633 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 651 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
634 | printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " | 652 | printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " |
635 | "from %pM\n", | 653 | "from %pM\n", |
636 | sdata->dev->name, mgmt->sa); | 654 | sdata->name, mgmt->sa); |
637 | #endif | 655 | #endif |
638 | return; | 656 | return; |
639 | } | 657 | } |
640 | if (pos[1] != 0 && | 658 | if (pos[1] != 0 && |
641 | (pos[1] != ifibss->ssid_len || | 659 | (pos[1] != ifibss->ssid_len || |
642 | !memcmp(pos + 2, ifibss->ssid, ifibss->ssid_len))) { | 660 | memcmp(pos + 2, ifibss->ssid, ifibss->ssid_len))) { |
643 | /* Ignore ProbeReq for foreign SSID */ | 661 | /* Ignore ProbeReq for foreign SSID */ |
644 | return; | 662 | return; |
645 | } | 663 | } |
@@ -653,9 +671,10 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
653 | memcpy(resp->da, mgmt->sa, ETH_ALEN); | 671 | memcpy(resp->da, mgmt->sa, ETH_ALEN); |
654 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 672 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
655 | printk(KERN_DEBUG "%s: Sending ProbeResp to %pM\n", | 673 | printk(KERN_DEBUG "%s: Sending ProbeResp to %pM\n", |
656 | sdata->dev->name, resp->da); | 674 | sdata->name, resp->da); |
657 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 675 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
658 | ieee80211_tx_skb(sdata, skb, 0); | 676 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; |
677 | ieee80211_tx_skb(sdata, skb); | ||
659 | } | 678 | } |
660 | 679 | ||
661 | static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, | 680 | static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, |
@@ -666,7 +685,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, | |||
666 | size_t baselen; | 685 | size_t baselen; |
667 | struct ieee802_11_elems elems; | 686 | struct ieee802_11_elems elems; |
668 | 687 | ||
669 | if (memcmp(mgmt->da, sdata->dev->dev_addr, ETH_ALEN)) | 688 | if (memcmp(mgmt->da, sdata->vif.addr, ETH_ALEN)) |
670 | return; /* ignore ProbeResp to foreign address */ | 689 | return; /* ignore ProbeResp to foreign address */ |
671 | 690 | ||
672 | baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; | 691 | baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; |
@@ -739,7 +758,7 @@ static void ieee80211_ibss_work(struct work_struct *work) | |||
739 | if (WARN_ON(local->suspended)) | 758 | if (WARN_ON(local->suspended)) |
740 | return; | 759 | return; |
741 | 760 | ||
742 | if (!netif_running(sdata->dev)) | 761 | if (!ieee80211_sdata_running(sdata)) |
743 | return; | 762 | return; |
744 | 763 | ||
745 | if (local->scanning) | 764 | if (local->scanning) |
@@ -822,7 +841,7 @@ void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local) | |||
822 | 841 | ||
823 | mutex_lock(&local->iflist_mtx); | 842 | mutex_lock(&local->iflist_mtx); |
824 | list_for_each_entry(sdata, &local->interfaces, list) { | 843 | list_for_each_entry(sdata, &local->interfaces, list) { |
825 | if (!netif_running(sdata->dev)) | 844 | if (!ieee80211_sdata_running(sdata)) |
826 | continue; | 845 | continue; |
827 | if (sdata->vif.type != NL80211_IFTYPE_ADHOC) | 846 | if (sdata->vif.type != NL80211_IFTYPE_ADHOC) |
828 | continue; | 847 | continue; |