From: Ben Greear <greearb@xxxxxxxxxxxxxxx> If a station is configured to scan only a subset of frequencies, then the supported operating classes may need to be more limited than what the hardware supports. Signed-off-by: Ben Greear <greearb@xxxxxxxxxxxxxxx> --- wpa_supplicant/op_classes.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/wpa_supplicant/op_classes.c b/wpa_supplicant/op_classes.c index d23b009..d886134 100644 --- a/wpa_supplicant/op_classes.c +++ b/wpa_supplicant/op_classes.c @@ -14,6 +14,7 @@ #include "utils/common.h" #include "common/ieee802_11_common.h" #include "wpa_supplicant_i.h" +#include "config.h" static enum chan_allowed allow_channel(struct hostapd_hw_modes *mode, u8 chan, @@ -214,11 +215,41 @@ static int wpas_op_class_supported(struct wpa_supplicant *wpa_s, size_t i; struct hostapd_hw_modes *mode; int found; + int z; + int freq2 = 0; + int freq5 = 0; mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, op_class->mode); if (!mode) return 0; + /* If we are configured to disable certain things, then take that + * into account here. + */ + if (wpa_s->conf->freq_list && wpa_s->conf->freq_list[0]) { + z = 0; + while (1) { + int f = wpa_s->conf->freq_list[z]; + if (f == 0) + break; /* end of list */ + if (f > 3000) + freq5 = 1; + else if (f < 3000) + freq2 = 1; + z++; + } + } + else { + /* No frequencies specified, can use anything hardware supports */ + freq2 = freq5 = 1; + } + if ((op_class->op_class >= 115) && (op_class->op_class <= 130) && (!freq5)) { + return 0; + } + if ((op_class->op_class <= 84) && (op_class->op_class >= 81) && (!freq2)) { + return 0; + } + if (op_class->op_class == 128) { u8 channels[] = { 42, 58, 106, 122, 138, 155 }; -- 2.7.5 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap