diff mbox

mesh: Set correct secondary channel offset if HT40 is disabled

Message ID 1469501140-4293-1-git-send-email-masashi.honma@gmail.com
State Changes Requested
Headers show

Commit Message

Masashi Honma July 26, 2016, 2:45 a.m. UTC
Previously, secondary channel offset could be non zero even though
disable_ht40=1. This patch fixes it.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
 wpa_supplicant/wpa_supplicant.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

Comments

Koen Vandeputte Aug. 11, 2016, 7:51 a.m. UTC | #1
Hi all,

I noticed this patch has not made it yet to the main branch.
It also solves the same issue in IBSS mode.

Should it help:

Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>


Kind Regards,

Koen

On 2016-07-26 04:45, Masashi Honma wrote:
> Previously, secondary channel offset could be non zero even though
> disable_ht40=1. This patch fixes it.
>
> Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
> ---
>   wpa_supplicant/wpa_supplicant.c | 32 ++++++++++++++++++++------------
>   1 file changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
> index aa4efd3..0548560 100644
> --- a/wpa_supplicant/wpa_supplicant.c
> +++ b/wpa_supplicant/wpa_supplicant.c
> @@ -1907,20 +1907,27 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
>   			break;
>   		}
>   	}
> +#ifdef CONFIG_HT_OVERRIDES
> +	if (ssid->disable_ht40)
> +		ht40 = 0;
> +#endif /* CONFIG_HT_OVERRIDES */
>   
> -	/* Find secondary channel */
> -	for (i = 0; i < mode->num_channels; i++) {
> -		sec_chan = &mode->channels[i];
> -		if (sec_chan->chan == channel + ht40 * 4)
> -			break;
> -		sec_chan = NULL;
> -	}
> -	if (!sec_chan)
> -		return;
> +	if (ht40) {
> +		/* Find secondary channel */
> +		for (i = 0; i < mode->num_channels; i++) {
> +			sec_chan = &mode->channels[i];
> +			if (sec_chan->chan == channel + ht40 * 4)
> +				break;
> +			sec_chan = NULL;
> +		}
> +		if (!sec_chan)
> +			return;
>   
> -	/* Check secondary channel flags */
> -	if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
> -		return;
> +		/* Check secondary channel flags */
> +		if (sec_chan->flag &
> +		    (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
> +			return;
> +	}
>   
>   	freq->channel = pri_chan->chan;
>   
> @@ -1936,6 +1943,7 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
>   		freq->sec_channel_offset = 1;
>   		break;
>   	default:
> +		freq->sec_channel_offset = 0;
>   		break;
>   	}
>
Jouni Malinen Aug. 13, 2016, 7:42 a.m. UTC | #2
On Tue, Jul 26, 2016 at 11:45:40AM +0900, Masashi Honma wrote:
> Previously, secondary channel offset could be non zero even though
> disable_ht40=1. This patch fixes it.

> diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
> @@ -1907,20 +1907,27 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,

> +#ifdef CONFIG_HT_OVERRIDES
> +	if (ssid->disable_ht40)
> +		ht40 = 0;
> +#endif /* CONFIG_HT_OVERRIDES */

Why would this not simply return here on disable_ht40? The way the
following changes are done would seem to imply that the previous if
!sec_chan return case is skipped and execution continues to set up VHT
parameters. This could then end up trying to claim that VHT is enabled
on a 80 MHz channel which should not really happen if HT40 is not
allowed.
Masashi Honma Aug. 18, 2016, 1:05 a.m. UTC | #3
On 2016年08月13日 16:42, Jouni Malinen wrote:
> Why would this not simply return here on disable_ht40? The way the
> following changes are done would seem to imply that the previous if
> !sec_chan return case is skipped and execution continues to set up VHT
> parameters. This could then end up trying to claim that VHT is enabled
> on a 80 MHz channel which should not really happen if HT40 is not
> allowed.

Thanks. I will modify it to return immediately.
And I will modify following check code to simplify it.

Masashi Honma.
diff mbox

Patch

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index aa4efd3..0548560 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1907,20 +1907,27 @@  void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
 			break;
 		}
 	}
+#ifdef CONFIG_HT_OVERRIDES
+	if (ssid->disable_ht40)
+		ht40 = 0;
+#endif /* CONFIG_HT_OVERRIDES */
 
-	/* Find secondary channel */
-	for (i = 0; i < mode->num_channels; i++) {
-		sec_chan = &mode->channels[i];
-		if (sec_chan->chan == channel + ht40 * 4)
-			break;
-		sec_chan = NULL;
-	}
-	if (!sec_chan)
-		return;
+	if (ht40) {
+		/* Find secondary channel */
+		for (i = 0; i < mode->num_channels; i++) {
+			sec_chan = &mode->channels[i];
+			if (sec_chan->chan == channel + ht40 * 4)
+				break;
+			sec_chan = NULL;
+		}
+		if (!sec_chan)
+			return;
 
-	/* Check secondary channel flags */
-	if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
-		return;
+		/* Check secondary channel flags */
+		if (sec_chan->flag &
+		    (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
+			return;
+	}
 
 	freq->channel = pri_chan->chan;
 
@@ -1936,6 +1943,7 @@  void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
 		freq->sec_channel_offset = 1;
 		break;
 	default:
+		freq->sec_channel_offset = 0;
 		break;
 	}