hostapd: fix basic rate selection for 5ghz
[openwrt.git] / package / hostapd / patches / 370-basic_rates.patch
1 --- a/src/ap/hostapd.c
2 +++ b/src/ap/hostapd.c
3 @@ -707,6 +707,14 @@ int hostapd_setup_interface_complete(str
4                 }
5         }
6  
7 +       if (hostapd_prepare_rates(hapd, iface->current_mode)) {
8 +               wpa_printf(MSG_ERROR, "Failed to prepare rates table.");
9 +               hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
10 +                                          HOSTAPD_LEVEL_WARNING,
11 +                                          "Failed to prepare rates table.");
12 +               return -1;
13 +       }
14 +
15         if (hapd->iconf->rts_threshold > -1 &&
16             hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) {
17                 wpa_printf(MSG_ERROR, "Could not set RTS threshold for "
18 --- a/src/ap/hw_features.c
19 +++ b/src/ap/hw_features.c
20 @@ -101,8 +101,8 @@ int hostapd_get_hw_features(struct hosta
21  }
22  
23  
24 -static int hostapd_prepare_rates(struct hostapd_data *hapd,
25 -                                struct hostapd_hw_modes *mode)
26 +int hostapd_prepare_rates(struct hostapd_data *hapd,
27 +                         struct hostapd_hw_modes *mode)
28  {
29         int i, num_basic_rates = 0;
30         int basic_rates_a[] = { 60, 120, 240, -1 };
31 @@ -668,14 +668,6 @@ int hostapd_select_hw_mode(struct hostap
32                 return -1;
33         }
34  
35 -       if (hostapd_prepare_rates(iface->bss[0], iface->current_mode)) {
36 -               wpa_printf(MSG_ERROR, "Failed to prepare rates table.");
37 -               hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211,
38 -                                          HOSTAPD_LEVEL_WARNING,
39 -                                          "Failed to prepare rates table.");
40 -               return -1;
41 -       }
42 -
43         return 0;
44  }
45  
46 --- a/src/ap/hw_features.h
47 +++ b/src/ap/hw_features.h
48 @@ -25,6 +25,8 @@ const char * hostapd_hw_mode_txt(int mod
49  int hostapd_hw_get_freq(struct hostapd_data *hapd, int chan);
50  int hostapd_hw_get_channel(struct hostapd_data *hapd, int freq);
51  int hostapd_check_ht_capab(struct hostapd_iface *iface);
52 +int hostapd_prepare_rates(struct hostapd_data *hapd,
53 +                         struct hostapd_hw_modes *mode);
54  #else /* NEED_AP_MLME */
55  static inline void
56  hostapd_free_hw_features(struct hostapd_hw_modes *hw_features,
57 @@ -56,6 +58,11 @@ static inline int hostapd_check_ht_capab
58  {
59         return 0;
60  }
61 +static inline int hostapd_prepare_rates(struct hostapd_data *hapd,
62 +                                       struct hostapd_hw_modes *mode)
63 +{
64 +       return 0;
65 +}
66  
67  #endif /* NEED_AP_MLME */
68