]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Fix rate table handling
authorFelix Fietkau <nbd@openwrt.org>
Tue, 9 Nov 2010 14:17:50 +0000 (16:17 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 9 Nov 2010 14:17:50 +0000 (16:17 +0200)
With the nl80211 driver, the rate table is mode dependent, so it
must be initialized after the hardware mode has been selected.

src/ap/hostapd.c
src/ap/hw_features.c
src/ap/hw_features.h

index c5b678a8d9f5ef018ec6cd83211e6b69d1e7a2ea..d7cd92cb40b012fce85237e374d6667711d37c44 100644 (file)
@@ -728,6 +728,17 @@ int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
                }
        }
 
+       if (iface->current_mode) {
+               if (hostapd_prepare_rates(hapd, iface->current_mode)) {
+                       wpa_printf(MSG_ERROR, "Failed to prepare rates "
+                                  "table.");
+                       hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+                                      HOSTAPD_LEVEL_WARNING,
+                                      "Failed to prepare rates table.");
+                       return -1;
+               }
+       }
+
        if (hapd->iconf->rts_threshold > -1 &&
            hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) {
                wpa_printf(MSG_ERROR, "Could not set RTS threshold for "
index 3bceb52bf046a759a60452036a958480fd6389b5..8d9a511e7b55aa87878128eabc75ad397f256ff8 100644 (file)
@@ -101,8 +101,8 @@ int hostapd_get_hw_features(struct hostapd_iface *iface)
 }
 
 
-static int hostapd_prepare_rates(struct hostapd_data *hapd,
-                                struct hostapd_hw_modes *mode)
+int hostapd_prepare_rates(struct hostapd_data *hapd,
+                         struct hostapd_hw_modes *mode)
 {
        int i, num_basic_rates = 0;
        int basic_rates_a[] = { 60, 120, 240, -1 };
@@ -668,14 +668,6 @@ int hostapd_select_hw_mode(struct hostapd_iface *iface)
                return -1;
        }
 
-       if (hostapd_prepare_rates(iface->bss[0], iface->current_mode)) {
-               wpa_printf(MSG_ERROR, "Failed to prepare rates table.");
-               hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211,
-                                          HOSTAPD_LEVEL_WARNING,
-                                          "Failed to prepare rates table.");
-               return -1;
-       }
-
        return 0;
 }
 
index 0295549fe1d387ff1bef9ae21938a8f30c25af1c..88c232215619a19e7da787fbb0be36bd68d3fdc0 100644 (file)
@@ -25,6 +25,8 @@ const char * hostapd_hw_mode_txt(int mode);
 int hostapd_hw_get_freq(struct hostapd_data *hapd, int chan);
 int hostapd_hw_get_channel(struct hostapd_data *hapd, int freq);
 int hostapd_check_ht_capab(struct hostapd_iface *iface);
+int hostapd_prepare_rates(struct hostapd_data *hapd,
+                         struct hostapd_hw_modes *mode);
 #else /* NEED_AP_MLME */
 static inline void
 hostapd_free_hw_features(struct hostapd_hw_modes *hw_features,
@@ -57,6 +59,12 @@ static inline int hostapd_check_ht_capab(struct hostapd_iface *iface)
        return 0;
 }
 
+static inline int hostapd_prepare_rates(struct hostapd_data *hapd,
+                                       struct hostapd_hw_modes *mode)
+{
+       return 0;
+}
+
 #endif /* NEED_AP_MLME */
 
 #endif /* HW_FEATURES_H */