]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Use freq_list to constrain supported operating class information
authorBen Greear <greearb@candelatech.com>
Fri, 24 Aug 2018 19:01:28 +0000 (12:01 -0700)
committerJouni Malinen <j@w1.fi>
Mon, 7 Jan 2019 22:20:04 +0000 (00:20 +0200)
If a station is configured to allow only a subset of frequencies for an
association, the supported operating classes may need to be more limited
than what the hardware supports.

Signed-off-by: Ben Greear <greearb@candelatech.com>
wpa_supplicant/op_classes.c

index 277f27038cbd26ddb34f958dcba620df1157ff7b..947917bb05f46a6674b79f7c4c2a0b31711fd66e 100644 (file)
@@ -215,11 +215,38 @@ 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, take that into
+        * account here. */
+       if (ssid->freq_list && ssid->freq_list[0]) {
+               for (z = 0; ; z++) {
+                       int f = ssid->freq_list[z];
+
+                       if (f == 0)
+                               break; /* end of list */
+                       if (f > 4000 && f < 6000)
+                               freq5 = 1;
+                       else if (f > 2400 && f < 2500)
+                               freq2 = 1;
+               }
+       } 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 >= 81 && op_class->op_class <= 84 && !freq2)
+               return 0;
+
 #ifdef CONFIG_HT_OVERRIDES
        if (ssid->disable_ht) {
                switch (op_class->op_class) {