summaryrefslogtreecommitdiffstats
path: root/package/network/services/hostapd/patches/002-mesh-Set-correct-secondary-channel-offset-if-HT40-is.patch
blob: 243922002a856c1910bdccdaee62304d78f27868 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From: Masashi Honma <masashi.honma@gmail.com>
Date: Tue, 26 Jul 2016 11:45:40 +0900
Subject: [PATCH] mesh: Set correct secondary channel offset if HT40 is
 disabled

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>
---

--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1901,20 +1901,27 @@ void ibss_mesh_setup_freq(struct wpa_sup
 			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;
 
@@ -1930,6 +1937,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
 		freq->sec_channel_offset = 1;
 		break;
 	default:
+		freq->sec_channel_offset = 0;
 		break;
 	}