/** * @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; }
/** * @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; }