ACS: Allow subset of channels to be configured

Add the possibility to define a subset of channels used by the ACS
engine when not operating on DFS channels.

Signed-off-by: Adrien Decostre <ad.decostre@gmail.com>
This commit is contained in:
Adrien Decostre 2015-01-12 08:57:17 +01:00 committed by Jouni Malinen
parent 95ff306988
commit 1648cc6427
2 changed files with 22 additions and 4 deletions

View file

@ -158,10 +158,7 @@ channel=1
#acs_num_scans=5 #acs_num_scans=5
# Channel list restriction. This option allows hostapd to select one of the # Channel list restriction. This option allows hostapd to select one of the
# provided channels when a channel should be automatically selected. This # provided channels when a channel should be automatically selected.
# is currently only used for DFS when the current channels becomes unavailable
# due to radar interference, and is currently only useful when ieee80211h=1 is
# set.
# Default: not set (allow any enabled channel to be selected) # Default: not set (allow any enabled channel to be selected)
#chanlist=100 104 108 112 116 #chanlist=100 104 108 112 116

View file

@ -455,6 +455,22 @@ static int acs_usable_chan(struct hostapd_channel_data *chan)
} }
static int is_in_chanlist(struct hostapd_iface *iface,
struct hostapd_channel_data *chan)
{
int *entry;
if (!iface->conf->chanlist)
return 1;
for (entry = iface->conf->chanlist; *entry != -1; entry++) {
if (*entry == chan->chan)
return 1;
}
return 0;
}
static void acs_survey_all_chans_intereference_factor( static void acs_survey_all_chans_intereference_factor(
struct hostapd_iface *iface) struct hostapd_iface *iface)
{ {
@ -467,6 +483,9 @@ static void acs_survey_all_chans_intereference_factor(
if (!acs_usable_chan(chan)) if (!acs_usable_chan(chan))
continue; continue;
if (!is_in_chanlist(iface, chan))
continue;
wpa_printf(MSG_DEBUG, "ACS: Survey analysis for channel %d (%d MHz)", wpa_printf(MSG_DEBUG, "ACS: Survey analysis for channel %d (%d MHz)",
chan->chan, chan->freq); chan->chan, chan->freq);
@ -543,6 +562,8 @@ acs_find_ideal_chan(struct hostapd_iface *iface)
if (chan->flag & HOSTAPD_CHAN_DISABLED) if (chan->flag & HOSTAPD_CHAN_DISABLED)
continue; continue;
if (!is_in_chanlist(iface, chan))
continue;
/* HT40 on 5 GHz has a limited set of primary channels as per /* HT40 on 5 GHz has a limited set of primary channels as per
* 11n Annex J */ * 11n Annex J */