Example #1
0
static int cfg80211_wext_siwap(struct net_device *dev,
			       struct iw_request_info *info,
			       struct sockaddr *ap_addr, char *extra)
{
	struct wireless_dev *wdev = dev->ieee80211_ptr;

	switch (wdev->iftype) {
	case NL80211_IFTYPE_ADHOC:
		return cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra);
	case NL80211_IFTYPE_STATION:
		return cfg80211_mgd_wext_siwap(dev, info, ap_addr, extra);
	case NL80211_IFTYPE_WDS:
		return cfg80211_wds_wext_siwap(dev, info, ap_addr, extra);
	default:
		return -EOPNOTSUPP;
	}
}
Example #2
0
static int iwm_wext_siwap(struct net_device *dev, struct iw_request_info *info,
                          struct sockaddr *ap_addr, char *extra)
{
    struct iwm_priv *iwm = ndev_to_iwm(dev);

    if (iwm->conf.mode == UMAC_MODE_IBSS)
        return cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra);

    if (!test_bit(IWM_STATUS_READY, &iwm->status))
        return -EIO;

    if (is_zero_ether_addr(ap_addr->sa_data) ||
            is_broadcast_ether_addr(ap_addr->sa_data)) {
        IWM_DBG_WEXT(iwm, DBG, "clear mandatory bssid %pM\n",
                     iwm->umac_profile->bssid[0]);
        memset(&iwm->umac_profile->bssid[0], 0, ETH_ALEN);
        iwm->umac_profile->bss_num = 0;
    } else {
        IWM_DBG_WEXT(iwm, DBG, "add mandatory bssid %pM\n",
                     ap_addr->sa_data);
        memcpy(&iwm->umac_profile->bssid[0], ap_addr->sa_data,
               ETH_ALEN);
        iwm->umac_profile->bss_num = 1;
    }

    if (iwm->umac_profile_active) {
        if (!memcmp(&iwm->umac_profile->bssid[0], iwm->bssid, ETH_ALEN))
            return 0;

        iwm_invalidate_mlme_profile(iwm);
    }

    if (iwm->umac_profile->ssid.ssid_len)
        return iwm_send_mlme_profile(iwm);

    return 0;
}