[PATCHv2] hostapd: check validity of cwmin/cwmax values
Matthias May
matthias.may
Wed May 6 00:18:07 PDT 2015
Signed-off-by: Matthias May <matthias.may at neratec.com>
---
src/ap/ap_config.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index c44f70d..07fb9d2 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -842,6 +842,26 @@ static int hostapd_config_check_bss(struct hostapd_bss_config *bss,
return 0;
}
+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)
{
@@ -872,6 +892,11 @@ int hostapd_config_check(struct hostapd_config *conf, int full_config)
return -1;
}
+ for (i = 0; i < 4; 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;
--
2.1.4
More information about the Hostap
mailing list