hostapd: Reject 40 MHz channel config if regulatory rules do not allow it

When regulatory rules are configured not to support 40 MHz channels on
the 2.4 GHz band, hostapd_is_usable_chans() still allowed 40 MHz
channels (i.e., 1-9) to be used with ht_capab=[HT40+][HT40-].

Looking into hostapd_is_usable_chans():
1) Validate primary channel using hostapd_is_usable_chan()
2) Try to pick a default secondary channel if hostapd_is_usable_chan()
3) Try to pick a valid secondary channel if both HT40+/HT40- set, and
   further validate primary channel's allowed bandwidth mask.
4) Return channel not usable.

For example, for the 2.4 GHz channel 9 in Japan, its default secondary
channel is 13, which is valid per hostapd_is_usable_chan(), so step (2)
returns channel usable.

Add a more strict check to step (2) to clearly reject 40 MHz channel
configuration if regulatory rules do not allow the 40 MHz bandwidth,
which is similarly done in commit ce6d9ce15b ("hostapd: Add supported
channel bandwidth checking infrastructure").

Signed-off-by: Hu Wang <huw@codeaurora.org>
master
Hu Wang 3 years ago committed by Jouni Malinen
parent 20a522b9eb
commit c25b50306e

@ -917,8 +917,14 @@ static int hostapd_is_usable_chans(struct hostapd_iface *iface)
return 1;
if (hostapd_is_usable_chan(iface, iface->freq +
iface->conf->secondary_channel * 20, 0))
return 1;
iface->conf->secondary_channel * 20, 0)) {
if (iface->conf->secondary_channel == 1 &&
(pri_chan->allowed_bw & HOSTAPD_CHAN_WIDTH_40P))
return 1;
if (iface->conf->secondary_channel == -1 &&
(pri_chan->allowed_bw & HOSTAPD_CHAN_WIDTH_40M))
return 1;
}
if (!iface->conf->ht40_plus_minus_allowed)
return 0;

Loading…
Cancel
Save