aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/ap.c
diff options
context:
space:
mode:
authorAvraham Stern <avraham.stern@intel.com>2013-08-25 08:24:29 (GMT)
committerJouni Malinen <j@w1.fi>2013-08-25 08:24:29 (GMT)
commit973622cd440505a22a1890040931579b5f8f1ac4 (patch)
treee97dac3990b0bf76d9643981c43ac295df3be73f /wpa_supplicant/ap.c
parentd99ca89d987e6bd28dbe37b4c6ff8b6168390627 (diff)
downloadhostap-973622cd440505a22a1890040931579b5f8f1ac4.zip
hostap-973622cd440505a22a1890040931579b5f8f1ac4.tar.gz
hostap-973622cd440505a22a1890040931579b5f8f1ac4.tar.bz2
wpa_supplicant: Fix AP mode frequency initialization
In AP mode the frequency was initialized only after trying to set up the AP which caused failure. Move AP frequency initialization to the right place. This allows an AP mode network block without the frequency parameter to be used with the default channel 11 being selected in that case. Signed-hostap: Avraham Stern <avraham.stern@intel.com>
Diffstat (limited to 'wpa_supplicant/ap.c')
-rw-r--r--wpa_supplicant/ap.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index c48a286..4de20dd 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -51,18 +51,12 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
os_strlcpy(bss->iface, wpa_s->ifname, sizeof(bss->iface));
- if (ssid->frequency == 0) {
- /* default channel 11 */
- conf->hw_mode = HOSTAPD_MODE_IEEE80211G;
- conf->channel = 11;
- } else {
- conf->hw_mode = ieee80211_freq_to_chan(ssid->frequency,
- &conf->channel);
- if (conf->hw_mode == NUM_HOSTAPD_MODES) {
- wpa_printf(MSG_ERROR, "Unsupported AP mode frequency: "
- "%d MHz", ssid->frequency);
- return -1;
- }
+ conf->hw_mode = ieee80211_freq_to_chan(ssid->frequency,
+ &conf->channel);
+ if (conf->hw_mode == NUM_HOSTAPD_MODES) {
+ wpa_printf(MSG_ERROR, "Unsupported AP mode frequency: %d MHz",
+ ssid->frequency);
+ return -1;
}
/* TODO: enable HT40 if driver supports it;
@@ -461,6 +455,8 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
params.mode = IEEE80211_MODE_AP;
break;
}
+ if (ssid->frequency == 0)
+ ssid->frequency = 2462; /* default channel 11 */
params.freq = ssid->frequency;
params.wpa_proto = ssid->proto;