diff options
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/scan.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 2ae65b39b529..1396248dc5cc 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -414,6 +414,55 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
414 | return found; | 414 | return found; |
415 | } | 415 | } |
416 | 416 | ||
417 | struct cfg80211_bss* | ||
418 | cfg80211_inform_bss(struct wiphy *wiphy, | ||
419 | struct ieee80211_channel *channel, | ||
420 | const u8 *bssid, | ||
421 | u64 timestamp, u16 capability, u16 beacon_interval, | ||
422 | const u8 *ie, size_t ielen, | ||
423 | s32 signal, gfp_t gfp) | ||
424 | { | ||
425 | struct cfg80211_internal_bss *res; | ||
426 | size_t privsz; | ||
427 | |||
428 | if (WARN_ON(!wiphy)) | ||
429 | return NULL; | ||
430 | |||
431 | privsz = wiphy->bss_priv_size; | ||
432 | |||
433 | if (WARN_ON(wiphy->signal_type == NL80211_BSS_SIGNAL_UNSPEC && | ||
434 | (signal < 0 || signal > 100))) | ||
435 | return NULL; | ||
436 | |||
437 | res = kzalloc(sizeof(*res) + privsz + ielen, gfp); | ||
438 | if (!res) | ||
439 | return NULL; | ||
440 | |||
441 | memcpy(res->pub.bssid, bssid, ETH_ALEN); | ||
442 | res->pub.channel = channel; | ||
443 | res->pub.signal = signal; | ||
444 | res->pub.tsf = timestamp; | ||
445 | res->pub.beacon_interval = beacon_interval; | ||
446 | res->pub.capability = capability; | ||
447 | /* point to after the private area */ | ||
448 | res->pub.information_elements = (u8 *)res + sizeof(*res) + privsz; | ||
449 | memcpy(res->pub.information_elements, ie, ielen); | ||
450 | res->pub.len_information_elements = ielen; | ||
451 | |||
452 | kref_init(&res->ref); | ||
453 | |||
454 | res = cfg80211_bss_update(wiphy_to_dev(wiphy), res, 0); | ||
455 | if (!res) | ||
456 | return NULL; | ||
457 | |||
458 | if (res->pub.capability & WLAN_CAPABILITY_ESS) | ||
459 | regulatory_hint_found_beacon(wiphy, channel, gfp); | ||
460 | |||
461 | /* cfg80211_bss_update gives us a referenced result */ | ||
462 | return &res->pub; | ||
463 | } | ||
464 | EXPORT_SYMBOL(cfg80211_inform_bss); | ||
465 | |||
417 | struct cfg80211_bss * | 466 | struct cfg80211_bss * |
418 | cfg80211_inform_bss_frame(struct wiphy *wiphy, | 467 | cfg80211_inform_bss_frame(struct wiphy *wiphy, |
419 | struct ieee80211_channel *channel, | 468 | struct ieee80211_channel *channel, |