hostapd: update to 2023-03-29
[openwrt/staging/dedeckeh.git] / package / network / services / hostapd / patches / 010-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch
index 6bc48abfb9508ebc444ee318df8f239529f0f428..761fe368cd2a9c50b6396216501a957e389ad422 100644 (file)
@@ -14,7 +14,7 @@ Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
 
 --- a/wpa_supplicant/wpa_supplicant.c
 +++ b/wpa_supplicant/wpa_supplicant.c
-@@ -2436,7 +2436,7 @@ static int drv_supports_vht(struct wpa_s
+@@ -2621,7 +2621,7 @@ static int drv_supports_vht(struct wpa_s
  }
  
  
@@ -23,7 +23,7 @@ Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
  {
        int i;
  
-@@ -2445,7 +2445,10 @@ static bool ibss_mesh_is_80mhz_avail(int
+@@ -2630,7 +2630,10 @@ static bool ibss_mesh_is_80mhz_avail(int
  
                chan = hw_get_channel_chan(mode, i, NULL);
                if (!chan ||
@@ -35,16 +35,16 @@ Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
                        return false;
        }
  
-@@ -2474,6 +2477,8 @@ void ibss_mesh_setup_freq(struct wpa_sup
-       int chwidth, seg0, seg1;
-       u32 vht_caps = 0;
-       bool is_24ghz, is_6ghz;
-+      bool dfs_enabled = wpa_s->conf->country[0] &&
-+                         (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR);
-       freq->freq = ssid->frequency;
-@@ -2570,8 +2575,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
+@@ -2757,7 +2760,7 @@ static void ibss_mesh_select_40mhz(struc
+                                  const struct wpa_ssid *ssid,
+                                  struct hostapd_hw_modes *mode,
+                                  struct hostapd_freq_params *freq,
+-                                 int obss_scan) {
++                                 int obss_scan, bool dfs_enabled) {
+       int chan_idx;
+       struct hostapd_channel_data *pri_chan = NULL, *sec_chan = NULL;
+       int i, res;
+@@ -2781,8 +2784,11 @@ static void ibss_mesh_select_40mhz(struc
                return;
  
        /* Check primary channel flags */
@@ -55,9 +55,9 @@ Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
 +              if (!dfs_enabled)
 +                      return;
  
-       freq->channel = pri_chan->chan;
-@@ -2604,8 +2612,11 @@ void ibss_mesh_setup_freq(struct wpa_sup
+ #ifdef CONFIG_HT_OVERRIDES
+       if (ssid->disable_ht40)
+@@ -2808,8 +2814,11 @@ static void ibss_mesh_select_40mhz(struc
                return;
  
        /* Check secondary channel flags */
@@ -70,25 +70,34 @@ Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
  
        if (ht40 == -1) {
                if (!(pri_chan->flag & HOSTAPD_CHAN_HT40MINUS))
-@@ -2694,7 +2705,7 @@ skip_to_6ghz:
-               return;
-       /* Back to HT configuration if channel not usable */
+@@ -2863,7 +2872,7 @@ static bool ibss_mesh_select_80_160mhz(s
+                                      const struct wpa_ssid *ssid,
+                                      struct hostapd_hw_modes *mode,
+                                      struct hostapd_freq_params *freq,
+-                                     int ieee80211_mode, bool is_6ghz) {
++                                     int ieee80211_mode, bool is_6ghz, bool dfs_enabled) {
+       static const int bw80[] = {
+               5180, 5260, 5500, 5580, 5660, 5745, 5825,
+               5955, 6035, 6115, 6195, 6275, 6355, 6435,
+@@ -2908,7 +2917,7 @@ static bool ibss_mesh_select_80_160mhz(s
+               goto skip_80mhz;
+       /* Use 40 MHz if channel not usable */
 -      if (!ibss_mesh_is_80mhz_avail(channel, mode))
 +      if (!ibss_mesh_is_80mhz_avail(channel, mode, dfs_enabled))
-               return;
+               goto skip_80mhz;
  
        chwidth = CONF_OPER_CHWIDTH_80MHZ;
-@@ -2708,7 +2719,7 @@ skip_to_6ghz:
-                * above; check the remaining four 20 MHz channels for the total
-                * of 160 MHz bandwidth.
-                */
--              if (!ibss_mesh_is_80mhz_avail(channel + 16, mode))
-+              if (!ibss_mesh_is_80mhz_avail(channel + 16, mode, dfs_enabled))
-                       return;
+@@ -2922,7 +2931,7 @@ static bool ibss_mesh_select_80_160mhz(s
+       if ((mode->he_capab[ieee80211_mode].phy_cap[
+                    HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] &
+            HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G) && is_6ghz &&
+-          ibss_mesh_is_80mhz_avail(channel + 16, mode)) {
++          ibss_mesh_is_80mhz_avail(channel + 16, mode, dfs_enabled)) {
                for (j = 0; j < ARRAY_SIZE(bw160); j++) {
-@@ -2738,10 +2749,12 @@ skip_to_6ghz:
+                       if (freq->freq == bw160[j]) {
+                               chwidth = CONF_OPER_CHWIDTH_160MHZ;
+@@ -2950,10 +2959,12 @@ static bool ibss_mesh_select_80_160mhz(s
                                if (!chan)
                                        continue;
  
@@ -104,3 +113,23 @@ Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
  
                                /* Found a suitable second segment for 80+80 */
                                chwidth = CONF_OPER_CHWIDTH_80P80MHZ;
+@@ -3008,6 +3019,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
+       int i, obss_scan = 1;
+       u8 channel;
+       bool is_6ghz;
++      bool dfs_enabled = wpa_s->conf->country[0] && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_RADAR);
+       freq->freq = ssid->frequency;
+@@ -3053,9 +3065,9 @@ void ibss_mesh_setup_freq(struct wpa_sup
+       freq->channel = channel;
+       /* Setup higher BW only for 5 GHz */
+       if (mode->mode == HOSTAPD_MODE_IEEE80211A) {
+-              ibss_mesh_select_40mhz(wpa_s, ssid, mode, freq, obss_scan);
++              ibss_mesh_select_40mhz(wpa_s, ssid, mode, freq, obss_scan, dfs_enabled);
+               if (!ibss_mesh_select_80_160mhz(wpa_s, ssid, mode, freq,
+-                                              ieee80211_mode, is_6ghz))
++                                              ieee80211_mode, is_6ghz, dfs_enabled))
+                       freq->he_enabled = freq->vht_enabled = false;
+       }