]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - wpa_supplicant/wpa_supplicant.c
Enhance get_mode() to return correct hw_mode with 6 GHz support
[thirdparty/hostap.git] / wpa_supplicant / wpa_supplicant.c
index 8cf148f90afa8983ae8e0509b495268308aeca74..aa7e1d09a271eec4d974921b17f56fca6d6d38f9 100644 (file)
@@ -3249,7 +3249,7 @@ get_supported_edmg(struct wpa_supplicant *wpa_s,
        if (hw_mode == NUM_HOSTAPD_MODES)
                goto fail;
 
-       mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, hw_mode);
+       mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, hw_mode, 0);
        if (!mode)
                goto fail;
 
@@ -7727,12 +7727,17 @@ int wpas_vendor_elem_remove(struct wpa_supplicant *wpa_s, int frame,
 
 
 struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes,
-                                  u16 num_modes, enum hostapd_hw_mode mode)
+                                  u16 num_modes, enum hostapd_hw_mode mode,
+                                  int is_6ghz)
 {
        u16 i;
 
        for (i = 0; i < num_modes; i++) {
-               if (modes[i].mode == mode)
+               if (modes[i].mode != mode ||
+                   !modes[i].num_channels || !modes[i].channels)
+                       continue;
+               if ((!is_6ghz && !is_6ghz_freq(modes[i].channels[0].freq)) ||
+                   (is_6ghz && is_6ghz_freq(modes[i].channels[0].freq)))
                        return &modes[i];
        }