/**
 * @brief reset AP or GO parameters
 *
 * @param wiphy           A pointer to wiphy structure
 * @param dev             A pointer to net_device structure
 *
 * @return                0 -- success, otherwise fail
 */
int
woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
{
    moal_private *priv = (moal_private *) woal_get_netdev_priv(dev);
    int ret = 0;

    ENTER();

    PRINTM(MIOCTL, "del beacon\n");
    /* if the bss is still running, then stop it */
    if (priv->bss_started == MTRUE) {
        if (MLAN_STATUS_SUCCESS !=
            woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_STOP)) {
            ret = -EFAULT;
            goto done;
        }
        if (MLAN_STATUS_SUCCESS !=
            woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_RESET)) {
            ret = -EFAULT;
            goto done;
        }
    }
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0) && !defined(COMPAT_WIRELESS)
    /* clear BEACON WPS/P2P IE */
    if (MLAN_STATUS_SUCCESS !=
        woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, 0, NULL, 0, NULL, 0,
                                    MGMT_MASK_BEACON_WPS_P2P)) {
        ret = -EFAULT;
        goto done;
    }
#endif
    /* clear mgmt frame ies */
    if (MLAN_STATUS_SUCCESS !=
        woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, 0, NULL, 0, NULL, 0,
                                    MGMT_MASK_BEACON | MGMT_MASK_PROBE_RESP |
                                    MGMT_MASK_ASSOC_RESP)) {
        ret = -EFAULT;
        goto done;
    }

    priv->cipher = 0;
    priv->key_len = 0;
  done:
    LEAVE();
    return ret;
}
/**
 * @brief set AP or GO parameter
 *
 * @param wiphy           A pointer to wiphy structure
 * @param dev             A pointer to net_device structure
 * @param params          A pointer to beacon_parameters structure 
 * @return                0 -- success, otherwise fail
 */
int
woal_cfg80211_set_beacon(struct wiphy *wiphy,
                         struct net_device *dev,
                         struct beacon_parameters *params)
#endif
{
    moal_private *priv = (moal_private *) woal_get_netdev_priv(dev);
    int ret = 0;

    ENTER();

    PRINTM(MIOCTL, "set beacon\n");
    if (params != NULL) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0) && !defined(COMPAT_WIRELESS)
        if (params->tail && params->tail_len) {
            if (MLAN_STATUS_SUCCESS !=
                woal_cfg80211_mgmt_frame_ie(priv,
                                            params->tail, params->tail_len,
                                            NULL, 0, NULL, 0, NULL, 0,
                                            MGMT_MASK_BEACON)) {
                ret = -EFAULT;
                goto done;
            }
        }
#else
        if (params->beacon_ies && params->beacon_ies_len) {
            if (MLAN_STATUS_SUCCESS !=
                woal_cfg80211_mgmt_frame_ie(priv, params->tail,
                                            params->tail_len, NULL, 0, NULL, 0,
                                            NULL, 0, MGMT_MASK_BEACON)) {
                ret = -EFAULT;
                goto done;
            }
        }

        if (params->proberesp_ies && params->proberesp_ies_len) {
            if (MLAN_STATUS_SUCCESS !=
                woal_cfg80211_mgmt_frame_ie(priv, NULL, 0,
                                            params->proberesp_ies,
                                            params->proberesp_ies_len, NULL, 0,
                                            NULL, 0, MGMT_MASK_PROBE_RESP)) {
                ret = -EFAULT;
                goto done;
            }
        }

        if (params->assocresp_ies && params->assocresp_ies_len) {
            if (MLAN_STATUS_SUCCESS !=
                woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL, 0,
                                            params->assocresp_ies,
                                            params->assocresp_ies_len, NULL, 0,
                                            MGMT_MASK_ASSOC_RESP)) {
                ret = -EFAULT;
                goto done;
            }
        }
#endif
    }

  done:
    LEAVE();
    return ret;
}
Exemplo n.º 3
0
/**
 * @brief set AP or GO parameter
 *
 * @param wiphy           A pointer to wiphy structure
 * @param dev             A pointer to net_device structure
 * @param params          A pointer to beacon_parameters structure
 * @return                0 -- success, otherwise fail
 */
int
woal_cfg80211_set_beacon(struct wiphy *wiphy,
			 struct net_device *dev,
			 struct beacon_parameters *params)
#endif
{
	moal_private *priv = (moal_private *)woal_get_netdev_priv(dev);
	int ret = 0;

	ENTER();

	PRINTM(MIOCTL, "set beacon\n");
	if (params != NULL) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) && !defined(COMPAT_WIRELESS)
		if (params->tail && params->tail_len) {
			ret = woal_cfg80211_mgmt_frame_ie(priv,
							  params->tail,
							  params->tail_len,
							  NULL, 0, NULL, 0,
							  NULL, 0,
							  MGMT_MASK_BEACON);
			if (ret)
				goto done;
		}
#else
		if (params->tail && params->tail_len) {
			ret = woal_cfg80211_mgmt_frame_ie(priv, params->tail,
							  params->tail_len,
							  NULL, 0, NULL, 0,
							  NULL, 0,
							  MGMT_MASK_BEACON,
							  MOAL_IOCTL_WAIT);
			if (ret)
				goto done;
		}
		if (params->beacon_ies && params->beacon_ies_len) {
			ret = woal_cfg80211_mgmt_frame_ie(priv,
							  params->beacon_ies,
							  params->
							  beacon_ies_len, NULL,
							  0, NULL, 0, NULL, 0,
							  MGMT_MASK_BEACON_WPS_P2P,
							  MOAL_IOCTL_WAIT);
			if (ret) {
				PRINTM(MERROR,
				       "Failed to set beacon wps/p2p ie\n");
				goto done;
			}
		}
		if (params->proberesp_ies && params->proberesp_ies_len) {
			ret = woal_cfg80211_mgmt_frame_ie(priv, NULL, 0,
							  params->proberesp_ies,
							  params->
							  proberesp_ies_len,
							  NULL, 0, NULL, 0,
							  MGMT_MASK_PROBE_RESP,
							  MOAL_IOCTL_WAIT);
			if (ret)
				goto done;
		}
		if (params->assocresp_ies && params->assocresp_ies_len) {
			ret = woal_cfg80211_mgmt_frame_ie(priv, NULL, 0, NULL,
							  0,
							  params->assocresp_ies,
							  params->
							  assocresp_ies_len,
							  NULL, 0,
							  MGMT_MASK_ASSOC_RESP,
							  MOAL_IOCTL_WAIT);
			if (ret)
				goto done;
		}
#endif
	}

done:
	LEAVE();
	return ret;
}
/**
 * @brief initialize AP or GO parameters

 *
 * @param wiphy           A pointer to wiphy structure
 * @param dev             A pointer to net_device structure
 * @param params          A pointer to beacon_parameters structure 
 * @return                0 -- success, otherwise fail
 */
int
woal_cfg80211_add_beacon(struct wiphy *wiphy,
                         struct net_device *dev,
                         struct beacon_parameters *params)
#endif
{
    moal_private *priv = (moal_private *) woal_get_netdev_priv(dev);
    int ret = 0;

    ENTER();

    PRINTM(MIOCTL, "add beacon\n");
#ifdef STA_CFG80211
        /*** cancel pending scan */
    woal_cancel_scan(priv, MOAL_IOCTL_WAIT);
#endif
    if (params != NULL) {
        /* bss config */
        if (MLAN_STATUS_SUCCESS != woal_cfg80211_beacon_config(priv, params)) {
            ret = -EFAULT;
            goto done;
        }

        /* set mgmt frame ies */
        if (MLAN_STATUS_SUCCESS != woal_cfg80211_mgmt_frame_ie(priv,
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0) && !defined(COMPAT_WIRELESS)
                                                               params->tail,
                                                               params->tail_len,
                                                               NULL, 0, NULL, 0,
                                                               NULL, 0,
                                                               MGMT_MASK_BEACON
#else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
                                                               params->beacon.
                                                               tail,
                                                               params->beacon.
                                                               tail_len,
                                                               params->beacon.
                                                               proberesp_ies,
                                                               params->beacon.
                                                               proberesp_ies_len,
                                                               params->beacon.
                                                               assocresp_ies,
                                                               params->beacon.
                                                               assocresp_ies_len,
#else
                                                               params->tail,
                                                               params->tail_len,
                                                               params->
                                                               proberesp_ies,
                                                               params->
                                                               proberesp_ies_len,
                                                               params->
                                                               assocresp_ies,
                                                               params->
                                                               assocresp_ies_len,
#endif
                                                               NULL, 0,
                                                               MGMT_MASK_BEACON
                                                               |
                                                               MGMT_MASK_PROBE_RESP
                                                               |
                                                               MGMT_MASK_ASSOC_RESP
#endif
            )) {
            ret = -EFAULT;
            goto done;
        }
    }

    /* if the bss is stopped, then start it */
    if (priv->bss_started == MFALSE) {
        if (MLAN_STATUS_SUCCESS !=
            woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_START)) {
            ret = -EFAULT;
            goto done;
        }
    }

  done:
    LEAVE();
    return ret;
}
Exemplo n.º 5
0
/**
 * @brief initialize AP or GO parameters

 *
 * @param wiphy           A pointer to wiphy structure
 * @param dev             A pointer to net_device structure
 * @param params          A pointer to beacon_parameters structure
 * @return                0 -- success, otherwise fail
 */
int
woal_cfg80211_add_beacon(struct wiphy *wiphy,
			 struct net_device *dev,
			 struct beacon_parameters *params)
#endif
{
	moal_private *priv = (moal_private *)woal_get_netdev_priv(dev);
	int ret = 0;

	ENTER();

	PRINTM(MMSG, "wlan: Starting AP\n");
#ifdef STA_CFG80211
	/*** cancel pending scan */
	woal_cancel_scan(priv, MOAL_IOCTL_WAIT);
#endif
	if (params != NULL) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
		priv->channel =
			ieee80211_frequency_to_channel(params->chandef.chan->
						       center_freq);
#else
		priv->channel =
			ieee80211_frequency_to_channel(params->channel->
						       center_freq);
#endif
#endif
		/* bss config */
		if (MLAN_STATUS_SUCCESS !=
		    woal_cfg80211_beacon_config(priv, params)) {
			ret = -EFAULT;
			goto done;
		}

		/* set mgmt frame ies */
		ret = woal_cfg80211_mgmt_frame_ie(priv,
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) && !defined(COMPAT_WIRELESS)
						  params->tail,
						  params->tail_len, NULL, 0,
						  NULL, 0, NULL, 0,
						  MGMT_MASK_BEACON
#else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
						  params->beacon.tail,
						  params->beacon.tail_len,
						  params->beacon.proberesp_ies,
						  params->beacon.
						  proberesp_ies_len,
						  params->beacon.assocresp_ies,
						  params->beacon.
						  assocresp_ies_len,
#else
						  params->tail,
						  params->tail_len,
						  params->proberesp_ies,
						  params->proberesp_ies_len,
						  params->assocresp_ies,
						  params->assocresp_ies_len,
#endif
						  NULL, 0,
						  MGMT_MASK_BEACON |
						  MGMT_MASK_PROBE_RESP |
						  MGMT_MASK_ASSOC_RESP
#endif
						  , MOAL_IOCTL_WAIT);
		if (ret)
			goto done;
	}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) || defined(COMPAT_WIRELESS)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
	if (params->beacon.beacon_ies && params->beacon.beacon_ies_len) {
		ret = woal_cfg80211_mgmt_frame_ie(priv,
						  params->beacon.beacon_ies,
						  params->beacon.beacon_ies_len,
						  NULL, 0, NULL, 0, NULL, 0,
						  MGMT_MASK_BEACON_WPS_P2P,
						  MOAL_IOCTL_WAIT);
		if (ret) {
			PRINTM(MERROR, "Failed to set beacon wps/p2p ie\n");
			goto done;
		}
	}
#else
	if (params->beacon_ies && params->beacon_ies_len) {
		ret = woal_cfg80211_mgmt_frame_ie(priv,
						  params->beacon_ies,
						  params->beacon_ies_len, NULL,
						  0, NULL, 0, NULL, 0,
						  MGMT_MASK_BEACON_WPS_P2P,
						  MOAL_IOCTL_WAIT);
		if (ret) {
			PRINTM(MERROR, "Failed to set beacon wps/p2p ie\n");
			goto done;
		}
	}
#endif
#endif

	/* if the bss is stopped, then start it */
	if (priv->bss_started == MFALSE) {
		if (MLAN_STATUS_SUCCESS !=
		    woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT, UAP_BSS_START)) {
			ret = -EFAULT;
			goto done;
		}
	}

	PRINTM(MMSG, "wlan: AP started\n");
done:
	LEAVE();
	return ret;
}