diff mbox

hostapd: check validity of cwmin/cwmax values

Message ID 1430834154-27662-1-git-send-email-matthias.may@neratec.com
State Superseded
Headers show

Commit Message

Matthias May May 5, 2015, 1:55 p.m. UTC
Add checks to ensure no invalid cwmin/cwmax parameter are set.

Signed-off-by: Matthias May <matthias.may@neratec.com>
---
 hostapd/config_file.c          | 5 +++++
 src/common/ieee802_11_common.c | 5 +++++
 2 files changed, 10 insertions(+)

Comments

Matthias May May 6, 2015, 7:09 a.m. UTC | #1
On 05/05/15 15:55, Matthias May wrote:
> Add checks to ensure no invalid cwmin/cwmax parameter are set.
>
> Signed-off-by: Matthias May <matthias.may@neratec.com>
> ---
>   hostapd/config_file.c          | 5 +++++
>   src/common/ieee802_11_common.c | 5 +++++
>   2 files changed, 10 insertions(+)
>
> diff --git a/hostapd/config_file.c b/hostapd/config_file.c
> index 0c1f401..a30260f 100644
> --- a/hostapd/config_file.c
> +++ b/hostapd/config_file.c
> @@ -967,6 +967,11 @@ static int hostapd_config_tx_queue(struct hostapd_config *conf, char *name,
>   		wpa_printf(MSG_ERROR, "Unknown tx_queue field '%s'", pos);
>   		return -1;
>   	}
> +	if (queue->cwmin > queue->cwmax) {
> +		wpa_printf(MSG_ERROR, "Invalid TX queue cwMin/cwMax values. "
> +		"min(%d) greater than max(%d)", queue->cwmin, queue->cwmax);
> +		return -1;
> +	}
>   
>   	return 0;
>   }
> diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
> index e23007a..c729c61 100644
> --- a/src/common/ieee802_11_common.c
> +++ b/src/common/ieee802_11_common.c
> @@ -534,6 +534,11 @@ int hostapd_config_wmm_ac(struct hostapd_wmm_ac_params wmm_ac_params[],
>   		wpa_printf(MSG_ERROR, "Unknown wmm_ac_ field '%s'", pos);
>   		return -1;
>   	}
> +	if (ac->cwmin > ac->cwmax) {
> +		wpa_printf(MSG_ERROR, "Invalid WMM ac cwMin/cwMax values. "
> +		"min(%d) greater than max(%d)", ac->cwmin, ac->cwmax);
> +		return -1;
> +	}
>   
>   	return 0;
>   }
Please disregard this patch.
Some further tests showed that this did not actually do what i intended 
it to do.
I will send a v2.

Regards
Matthias
diff mbox

Patch

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 0c1f401..a30260f 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -967,6 +967,11 @@  static int hostapd_config_tx_queue(struct hostapd_config *conf, char *name,
 		wpa_printf(MSG_ERROR, "Unknown tx_queue field '%s'", pos);
 		return -1;
 	}
+	if (queue->cwmin > queue->cwmax) {
+		wpa_printf(MSG_ERROR, "Invalid TX queue cwMin/cwMax values. "
+		"min(%d) greater than max(%d)", queue->cwmin, queue->cwmax);
+		return -1;
+	}
 
 	return 0;
 }
diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index e23007a..c729c61 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -534,6 +534,11 @@  int hostapd_config_wmm_ac(struct hostapd_wmm_ac_params wmm_ac_params[],
 		wpa_printf(MSG_ERROR, "Unknown wmm_ac_ field '%s'", pos);
 		return -1;
 	}
+	if (ac->cwmin > ac->cwmax) {
+		wpa_printf(MSG_ERROR, "Invalid WMM ac cwMin/cwMax values. "
+		"min(%d) greater than max(%d)", ac->cwmin, ac->cwmax);
+		return -1;
+	}
 
 	return 0;
 }