]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: check validity of cwMin/cwMax values
authorMatthias May <matthias.may@neratec.com>
Wed, 6 May 2015 07:18:07 +0000 (09:18 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 7 May 2015 17:57:32 +0000 (20:57 +0300)
Signed-off-by: Matthias May <matthias.may@neratec.com>
src/ap/ap_config.c

index c44f70d6c7e79dbc78a58a3635c8fcac51f21a82..455013aa7c1edf9ffeeeb3c7d8571f38fa09ce9d 100644 (file)
@@ -843,6 +843,29 @@ static int hostapd_config_check_bss(struct hostapd_bss_config *bss,
 }
 
 
+static int hostapd_config_check_cw(struct hostapd_config *conf, int queue)
+{
+       int tx_cwmin = conf->tx_queue[queue].cwmin;
+       int tx_cwmax = conf->tx_queue[queue].cwmax;
+       int ac_cwmin = conf->wmm_ac_params[queue].cwmin;
+       int ac_cwmax = conf->wmm_ac_params[queue].cwmax;
+
+       if (tx_cwmin > tx_cwmax) {
+               wpa_printf(MSG_ERROR,
+                          "Invalid TX queue cwMin/cwMax values. cwMin(%d) greater than cwMax(%d)",
+                          tx_cwmin, tx_cwmax);
+               return -1;
+       }
+       if (ac_cwmin > ac_cwmax) {
+               wpa_printf(MSG_ERROR,
+                          "Invalid WMM AC cwMin/cwMax values. cwMin(%d) greater than cwMax(%d)",
+                          ac_cwmin, ac_cwmax);
+               return -1;
+       }
+       return 0;
+}
+
+
 int hostapd_config_check(struct hostapd_config *conf, int full_config)
 {
        size_t i;
@@ -872,6 +895,11 @@ int hostapd_config_check(struct hostapd_config *conf, int full_config)
                return -1;
        }
 
+       for (i = 0; i < NUM_TX_QUEUES; i++) {
+               if (hostapd_config_check_cw(conf, i))
+                       return -1;
+       }
+
        for (i = 0; i < conf->num_bss; i++) {
                if (hostapd_config_check_bss(conf->bss[i], conf, full_config))
                        return -1;