hostapd: Verify VHT 160/80+80 MHz driver support

Make sure the driver supports 160/80+80 MHz VHT capabilities
before trying to configure these channels.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>
This commit is contained in:
Eliad Peller 2013-10-27 19:17:23 +02:00 committed by Jouni Malinen
parent c781eb8428
commit 7f0303d5b0

View file

@ -467,7 +467,7 @@ static int hostapd_set_freq_params(struct hostapd_freq_params *data, int mode,
int freq, int channel, int ht_enabled, int freq, int channel, int ht_enabled,
int vht_enabled, int sec_channel_offset, int vht_enabled, int sec_channel_offset,
int vht_oper_chwidth, int center_segment0, int vht_oper_chwidth, int center_segment0,
int center_segment1) int center_segment1, u32 vht_caps)
{ {
int tmp; int tmp;
@ -494,6 +494,11 @@ static int hostapd_set_freq_params(struct hostapd_freq_params *data, int mode,
return -1; return -1;
break; break;
case VHT_CHANWIDTH_80P80MHZ: case VHT_CHANWIDTH_80P80MHZ:
if (!(vht_caps & VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)) {
wpa_printf(MSG_ERROR,
"80+80 channel width is not supported!");
return -1;
}
if (center_segment1 == center_segment0 + 4 || if (center_segment1 == center_segment0 + 4 ||
center_segment1 == center_segment0 - 4) center_segment1 == center_segment0 - 4)
return -1; return -1;
@ -517,6 +522,12 @@ static int hostapd_set_freq_params(struct hostapd_freq_params *data, int mode,
break; break;
case VHT_CHANWIDTH_160MHZ: case VHT_CHANWIDTH_160MHZ:
data->bandwidth = 160; data->bandwidth = 160;
if (!(vht_caps & (VHT_CAP_SUPP_CHAN_WIDTH_160MHZ |
VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ))) {
wpa_printf(MSG_ERROR,
"160MHZ channel width is not supported!");
return -1;
}
if (center_segment1) if (center_segment1)
return -1; return -1;
if (!sec_channel_offset) if (!sec_channel_offset)
@ -545,7 +556,8 @@ int hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq,
if (hostapd_set_freq_params(&data, mode, freq, channel, ht_enabled, if (hostapd_set_freq_params(&data, mode, freq, channel, ht_enabled,
vht_enabled, sec_channel_offset, vht_enabled, sec_channel_offset,
vht_oper_chwidth, vht_oper_chwidth,
center_segment0, center_segment1)) center_segment0, center_segment1,
hapd->iface->current_mode->vht_capab))
return -1; return -1;
if (hapd->driver == NULL) if (hapd->driver == NULL)
@ -738,7 +750,8 @@ int hostapd_start_dfs_cac(struct hostapd_data *hapd, int mode, int freq,
if (hostapd_set_freq_params(&data, mode, freq, channel, ht_enabled, if (hostapd_set_freq_params(&data, mode, freq, channel, ht_enabled,
vht_enabled, sec_channel_offset, vht_enabled, sec_channel_offset,
vht_oper_chwidth, center_segment0, vht_oper_chwidth, center_segment0,
center_segment1)) center_segment1,
hapd->iface->current_mode->vht_capab))
return -1; return -1;
res = hapd->driver->start_dfs_cac(hapd->drv_priv, &data); res = hapd->driver->start_dfs_cac(hapd->drv_priv, &data);