Example #1
0
static int ieee80211_ioctl_giwessid(struct net_device *dev,
                                    struct iw_request_info *info,
                                    struct iw_point *data, char *ssid)
{
    size_t len;

    struct ieee80211_sub_if_data *sdata;
    sdata = IEEE80211_DEV_TO_SUB_IF(dev);
    if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
            sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
        int res = ieee80211_sta_get_ssid(dev, ssid, &len);
        if (res == 0) {
            data->length = len;
            data->flags = 1;
        } else
            data->flags = 0;
        return res;
    }

    if (sdata->vif.type == IEEE80211_IF_TYPE_AP) {
        len = sdata->u.ap.ssid_len;
        if (len > IW_ESSID_MAX_SIZE)
            len = IW_ESSID_MAX_SIZE;
        memcpy(ssid, sdata->u.ap.ssid, len);
        data->length = len;
        data->flags = 1;
        return 0;
    }
    return -EOPNOTSUPP;
}
Example #2
0
static int ieee80211_ioctl_giwessid(struct net_device *dev,
				    struct iw_request_info *info,
				    struct iw_point *data, char *ssid)
{
	size_t len;

	struct ieee80211_sub_if_data *sdata;
	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
	if (sdata->vif.type == NL80211_IFTYPE_STATION ||
	    sdata->vif.type == NL80211_IFTYPE_ADHOC) {
		int res = ieee80211_sta_get_ssid(sdata, ssid, &len);
		if (res == 0) {
			data->length = len;
			data->flags = 1;
		} else
			data->flags = 0;
		return res;
	}

	return -EOPNOTSUPP;
}