int hostapd_acs_completed(struct hostapd_iface *iface) { int ret; switch (hostapd_check_chans(iface)) { case HOSTAPD_CHAN_VALID: break; case HOSTAPD_CHAN_ACS: /* WTF */ wpa_printf(MSG_ERROR, "ACS complete but not.. odd report this.."); hostapd_notify_bad_chans(iface); return -1; case HOSTAPD_CHAN_INVALID: default: wpa_printf(MSG_ERROR, "ACS picked unusable channels"); hostapd_notify_bad_chans(iface); return -1; } ret = hostapd_check_ht_capab(iface); if (ret < 0) return -1; if (ret == 1) { wpa_printf(MSG_DEBUG, "Interface initialization will " "be completed in a callback"); return 0; } return hostapd_setup_interface_complete(iface, 0); }
int hostapd_acs_completed(struct hostapd_iface *iface, int err) { int ret = -1; if (err) goto out; switch (hostapd_check_chans(iface)) { case HOSTAPD_CHAN_VALID: wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_COMPLETED "freq=%d channel=%d", hostapd_hw_get_freq(iface->bss[0], iface->conf->channel), iface->conf->channel); break; case HOSTAPD_CHAN_ACS: wpa_printf(MSG_ERROR, "ACS error - reported complete, but no result available"); wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_FAILED); hostapd_notify_bad_chans(iface); goto out; case HOSTAPD_CHAN_INVALID: default: wpa_printf(MSG_ERROR, "ACS picked unusable channels"); wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_FAILED); hostapd_notify_bad_chans(iface); goto out; } ret = hostapd_check_ht_capab(iface); if (ret < 0) goto out; if (ret == 1) { wpa_printf(MSG_DEBUG, "Interface initialization will be completed in a callback"); return 0; } ret = 0; out: return hostapd_setup_interface_complete(iface, ret); }
/** * hostapd_select_hw_mode - Select the hardware mode * @iface: Pointer to interface data. * Returns: 0 on success, < 0 on failure * * Sets up the hardware mode, channel, rates, and passive scanning * based on the configuration. */ int hostapd_select_hw_mode(struct hostapd_iface *iface) { int i; if (iface->num_hw_features < 1) return -1; if ((iface->conf->hw_mode == HOSTAPD_MODE_IEEE80211G || iface->conf->ieee80211n || iface->conf->ieee80211ac) && iface->conf->channel == 14) { wpa_printf(MSG_INFO, "Disable OFDM/HT/VHT on channel 14"); iface->conf->hw_mode = HOSTAPD_MODE_IEEE80211B; iface->conf->ieee80211n = 0; iface->conf->ieee80211ac = 0; } iface->current_mode = NULL; for (i = 0; i < iface->num_hw_features; i++) { struct hostapd_hw_modes *mode = &iface->hw_features[i]; if (mode->mode == iface->conf->hw_mode) { iface->current_mode = mode; break; } } if (iface->current_mode == NULL) { if (!(iface->drv_flags & WPA_DRIVER_FLAGS_ACS_OFFLOAD) || !(iface->drv_flags & WPA_DRIVER_FLAGS_SUPPORT_HW_MODE_ANY)) { wpa_printf(MSG_ERROR, "Hardware does not support configured mode"); hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_WARNING, "Hardware does not support configured mode (%d) (hw_mode in hostapd.conf)", (int) iface->conf->hw_mode); return -2; } } switch (hostapd_check_chans(iface)) { case HOSTAPD_CHAN_VALID: return 0; case HOSTAPD_CHAN_ACS: /* ACS will run and later complete */ return 1; case HOSTAPD_CHAN_INVALID: default: hostapd_notify_bad_chans(iface); return -3; } }
/** * hostapd_select_hw_mode - Select the hardware mode * @iface: Pointer to interface data. * Returns: 0 on success, < 0 on failure * * Sets up the hardware mode, channel, rates, and passive scanning * based on the configuration. */ int hostapd_select_hw_mode(struct hostapd_iface *iface) { int i; if (iface->num_hw_features < 1) return -1; iface->current_mode = NULL; for (i = 0; i < iface->num_hw_features; i++) { struct hostapd_hw_modes *mode = &iface->hw_features[i]; if (mode->mode == iface->conf->hw_mode) { iface->current_mode = mode; break; } } if (iface->current_mode == NULL) { wpa_printf(MSG_ERROR, "Hardware does not support configured " "mode"); hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_WARNING, "Hardware does not support configured mode " "(%d)", (int) iface->conf->hw_mode); return -2; } switch (hostapd_check_chans(iface)) { case HOSTAPD_CHAN_VALID: return 0; case HOSTAPD_CHAN_ACS: /* ACS will run and later complete */ return 1; case HOSTAPD_CHAN_INVALID: default: hostapd_notify_bad_chans(iface); return -4; return HOSTAPD_CHAN_INVALID; } }