示例#1
0
文件: ibss.c 项目: asmalldev/linux
void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
			    struct ieee80211_channel *channel)
{
	struct wireless_dev *wdev = dev->ieee80211_ptr;
	struct cfg80211_bss *bss;
#ifdef CONFIG_CFG80211_WEXT
	union iwreq_data wrqu;
#endif

	if (WARN_ON(wdev->iftype != NL80211_IFTYPE_ADHOC))
		return;

	if (!wdev->ssid_len)
		return;

	bss = cfg80211_get_bss(wdev->wiphy, channel, bssid, NULL, 0,
			       IEEE80211_BSS_TYPE_IBSS, IEEE80211_PRIVACY_ANY);

	if (WARN_ON(!bss))
		return;

	if (wdev->current_bss) {
		cfg80211_unhold_bss(wdev->current_bss);
		cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub);
	}

	cfg80211_hold_bss(bss_from_pub(bss));
	wdev->current_bss = bss_from_pub(bss);

	if (!(wdev->wiphy->flags & WIPHY_FLAG_HAS_STATIC_WEP))
		cfg80211_upload_connect_keys(wdev);

	nl80211_send_ibss_bssid(wiphy_to_rdev(wdev->wiphy), dev, bssid,
				GFP_KERNEL);
#ifdef CONFIG_CFG80211_WEXT
	memset(&wrqu, 0, sizeof(wrqu));
	memcpy(wrqu.ap_addr.sa_data, bssid, ETH_ALEN);
	wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
#endif
}
示例#2
0
void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid)
{
    struct wireless_dev *wdev = dev->ieee80211_ptr;
    struct cfg80211_bss *bss;
#ifdef CONFIG_CFG80211_WEXT
    union iwreq_data wrqu;
#endif

    if (WARN_ON(wdev->iftype != NL80211_IFTYPE_ADHOC))
        return;

    if (!wdev->ssid_len)
        return;

    bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid,
                           wdev->ssid, wdev->ssid_len,
                           WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);

    if (WARN_ON(!bss))
        return;

    if (wdev->current_bss) {
        cfg80211_unhold_bss(wdev->current_bss);
        cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub);
    }

    cfg80211_hold_bss(bss_from_pub(bss));
    wdev->current_bss = bss_from_pub(bss);

    wdev->sme_state = CFG80211_SME_CONNECTED;
    cfg80211_upload_connect_keys(wdev);

    nl80211_send_ibss_bssid(wiphy_to_dev(wdev->wiphy), dev, bssid,
                            GFP_KERNEL);
#ifdef CONFIG_CFG80211_WEXT
    memset(&wrqu, 0, sizeof(wrqu));
    memcpy(wrqu.ap_addr.sa_data, bssid, ETH_ALEN);
    wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
#endif
}