Use disable_ht/vht to constrain supported operating class information

If user has disabled HT or VHT, those related operating classes
should not be advertised as supported.

Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
Ben Greear 2018-08-24 13:27:44 -07:00 committed by Jouni Malinen
parent 27ebadccfb
commit cb828507f5
4 changed files with 43 additions and 7 deletions

View file

@ -208,6 +208,7 @@ enum chan_allowed verify_channel(struct hostapd_hw_modes *mode, u8 channel,
static int wpas_op_class_supported(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid,
const struct oper_class_map *op_class)
{
int chan;
@ -219,6 +220,39 @@ static int wpas_op_class_supported(struct wpa_supplicant *wpa_s,
if (!mode)
return 0;
#ifdef CONFIG_HT_OVERRIDES
if (ssid->disable_ht) {
switch (op_class->op_class) {
case 83:
case 84:
case 104:
case 105:
case 116:
case 117:
case 119:
case 120:
case 122:
case 123:
case 126:
case 127:
case 128:
case 129:
case 130:
/* Disable >= 40 MHz channels if HT is disabled */
return 0;
}
}
#endif /* CONFIG_HT_OVERRIDES */
#ifdef CONFIG_VHT_OVERRIDES
if (ssid->disable_vht) {
if (op_class->op_class >= 128 && op_class->op_class <= 130) {
/* Disable >= 80 MHz channels if VHT is disabled */
return 0;
}
}
#endif /* CONFIG_VHT_OVERRIDES */
if (op_class->op_class == 128) {
u8 channels[] = { 42, 58, 106, 122, 138, 155 };
@ -273,8 +307,9 @@ static int wpas_op_class_supported(struct wpa_supplicant *wpa_s,
}
size_t wpas_supp_op_class_ie(struct wpa_supplicant *wpa_s, int freq, u8 *pos,
size_t len)
size_t wpas_supp_op_class_ie(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid,
int freq, u8 *pos, size_t len)
{
struct wpabuf *buf;
u8 op, current, chan;
@ -304,7 +339,7 @@ size_t wpas_supp_op_class_ie(struct wpa_supplicant *wpa_s, int freq, u8 *pos,
wpabuf_put_u8(buf, current);
for (op = 0; global_op_class[op].op_class; op++) {
if (wpas_op_class_supported(wpa_s, &global_op_class[op]))
if (wpas_op_class_supported(wpa_s, ssid, &global_op_class[op]))
wpabuf_put_u8(buf, global_op_class[op].op_class);
}

View file

@ -520,7 +520,7 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
sme_auth_handle_rrm(wpa_s, bss);
wpa_s->sme.assoc_req_ie_len += wpas_supp_op_class_ie(
wpa_s, bss->freq,
wpa_s, ssid, bss->freq,
wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len,
sizeof(wpa_s->sme.assoc_req_ie) - wpa_s->sme.assoc_req_ie_len);

View file

@ -2668,7 +2668,7 @@ static u8 * wpas_populate_assoc_ies(
#endif /* CONFIG_P2P */
if (bss) {
wpa_ie_len += wpas_supp_op_class_ie(wpa_s, bss->freq,
wpa_ie_len += wpas_supp_op_class_ie(wpa_s, ssid, bss->freq,
wpa_ie + wpa_ie_len,
max_wpa_ie_len -
wpa_ie_len);

View file

@ -1407,8 +1407,9 @@ enum chan_allowed {
enum chan_allowed verify_channel(struct hostapd_hw_modes *mode, u8 channel,
u8 bw);
size_t wpas_supp_op_class_ie(struct wpa_supplicant *wpa_s, int freq, u8 *pos,
size_t len);
size_t wpas_supp_op_class_ie(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid,
int freq, u8 *pos, size_t len);
/**
* wpa_supplicant_ctrl_iface_ctrl_rsp_handle - Handle a control response