ACS: Determine mode when using hw_mode=any
Set iface->current_mode and iface->conf->hw_mode when completing ACS based on the selected channel in the hw_mode=any case. Signed-off-by: Neo Jou <neojou@gmail.com>
This commit is contained in:
parent
c60362e6e8
commit
d07f1ade90
1 changed files with 33 additions and 0 deletions
|
@ -879,10 +879,43 @@ static int hostapd_is_usable_chans(struct hostapd_iface *iface)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void hostapd_determine_mode(struct hostapd_iface *iface)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
enum hostapd_hw_mode target_mode;
|
||||||
|
|
||||||
|
if (iface->current_mode ||
|
||||||
|
iface->conf->hw_mode != HOSTAPD_MODE_IEEE80211ANY)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (iface->freq < 4000)
|
||||||
|
target_mode = HOSTAPD_MODE_IEEE80211G;
|
||||||
|
else if (iface->freq > 50000)
|
||||||
|
target_mode = HOSTAPD_MODE_IEEE80211AD;
|
||||||
|
else
|
||||||
|
target_mode = HOSTAPD_MODE_IEEE80211A;
|
||||||
|
|
||||||
|
for (i = 0; i < iface->num_hw_features; i++) {
|
||||||
|
struct hostapd_hw_modes *mode;
|
||||||
|
|
||||||
|
mode = &iface->hw_features[i];
|
||||||
|
if (mode->mode == target_mode) {
|
||||||
|
iface->current_mode = mode;
|
||||||
|
iface->conf->hw_mode = mode->mode;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!iface->current_mode)
|
||||||
|
wpa_printf(MSG_ERROR, "ACS: Cannot decide mode");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static enum hostapd_chan_status
|
static enum hostapd_chan_status
|
||||||
hostapd_check_chans(struct hostapd_iface *iface)
|
hostapd_check_chans(struct hostapd_iface *iface)
|
||||||
{
|
{
|
||||||
if (iface->freq) {
|
if (iface->freq) {
|
||||||
|
hostapd_determine_mode(iface);
|
||||||
if (hostapd_is_usable_chans(iface))
|
if (hostapd_is_usable_chans(iface))
|
||||||
return HOSTAPD_CHAN_VALID;
|
return HOSTAPD_CHAN_VALID;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue