mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
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>
This commit is contained in:
parent
d99ca89d98
commit
973622cd44
@ -51,19 +51,13 @@ 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);
|
||||
wpa_printf(MSG_ERROR, "Unsupported AP mode frequency: %d MHz",
|
||||
ssid->frequency);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: enable HT40 if driver supports it;
|
||||
* drop to 11b if driver does not support 11g */
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user