#include "includes.h"
+#include "common.h"
#include "hostapd.h"
-#include "ieee802_11_defs.h"
-#include "ieee802_11_common.h"
+#include "common/ieee802_11_defs.h"
+#include "common/ieee802_11_common.h"
#include "eloop.h"
#include "hw_features.h"
#include "driver_i.h"
hapd->iface->num_rates = 0;
hapd->iface->current_rates =
- os_malloc(mode->num_rates * sizeof(struct hostapd_rate_data));
+ os_zalloc(mode->num_rates * sizeof(struct hostapd_rate_data));
if (!hapd->iface->current_rates) {
wpa_printf(MSG_ERROR, "Failed to allocate memory for rate "
"table.");
if (hapd->iconf->supported_rates &&
!hostapd_rate_found(hapd->iconf->supported_rates,
- mode->rates[i].rate))
+ mode->rates[i]))
continue;
rate = &hapd->iface->current_rates[hapd->iface->num_rates];
- os_memcpy(rate, &mode->rates[i],
- sizeof(struct hostapd_rate_data));
+ rate->rate = mode->rates[i];
if (hostapd_rate_found(basic_rates, rate->rate)) {
rate->flags |= HOSTAPD_RATE_BASIC;
num_basic_rates++;
- } else
- rate->flags &= ~HOSTAPD_RATE_BASIC;
+ }
wpa_printf(MSG_DEBUG, "RATE[%d] rate=%d flags=0x%x",
hapd->iface->num_rates, rate->rate, rate->flags);
hapd->iface->num_rates++;
if (!match) {
for (i = 0; i < scan_res->num; i++) {
struct wpa_scan_res *bss = scan_res->res[i];
- ieee80211n_get_pri_sec_chan(bss, &pri_chan, &sec_chan);
+ ieee80211n_get_pri_sec_chan(bss, &bss_pri_chan,
+ &bss_sec_chan);
if (pri_chan == bss_sec_chan &&
sec_chan == bss_pri_chan) {
wpa_printf(MSG_INFO, "Switch own primary and "
*/
int hostapd_select_hw_mode(struct hostapd_iface *iface)
{
- int i, j, ok, ret;
+ int i, j, ok;
if (iface->num_hw_features < 1)
return -1;
break;
}
}
+ if (iface->conf->channel == 0) {
+ /* TODO: could request a scan of neighboring BSSes and select
+ * the channel automatically */
+ wpa_printf(MSG_ERROR, "Channel not configured "
+ "(hw_mode/channel in hostapd.conf)");
+ return -1;
+ }
if (ok == 0 && iface->conf->channel != 0) {
hostapd_logger(iface->bss[0], NULL,
HOSTAPD_MODULE_IEEE80211,
return -1;
}
- ret = hostapd_passive_scan(iface->bss[0], 0,
- iface->conf->passive_scan_mode,
- iface->conf->passive_scan_interval,
- iface->conf->passive_scan_listen,
- NULL, NULL);
- if (ret) {
- if (ret == -1) {
- wpa_printf(MSG_DEBUG, "Passive scanning not "
- "supported");
- } else {
- wpa_printf(MSG_ERROR, "Could not set passive "
- "scanning: %s", strerror(ret));
- }
- ret = 0;
- }
-
- return ret;
+ return 0;
}