1 /*
2  * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: This file contains centralized definitions of converged configuration.
22  */
23 
24 #ifndef __CFG_IE_ALLOWLIST_H
25 #define __CFG_IE_ALLOWLIST_H
26 
27 /*
28  * <ini>
29  * g_enable_probereq_whitelist_ies - Enable IE allow listing
30  * @Min: 0
31  * @Max: 1
32  * @Default: 0
33  *
34  * This ini is used to enable/disable probe request IE allow listing feature.
35  * Values 0 and 1 are used to disable and enable respectively, by default this
36  * feature is disabled.
37  *
38  * Related: None
39  *
40  * Supported Feature: Probe request IE allowlisting
41  *
42  * Usage: Internal/External
43  *
44  * </ini>
45  */
46 #define CFG_PROBE_REQ_IE_ALLOWLIST CFG_INI_BOOL( \
47 			"g_enable_probereq_whitelist_ies", \
48 			0, \
49 			"Enable IE allowlisting")
50 
51 /*
52  * For IE allow listing in Probe Req, following ini parameters from
53  * g_probe_req_ie_bitmap_0 to g_probe_req_ie_bitmap_7 are used. User needs to
54  * input this values in hexa decimal format, when bit is set in bitmap,
55  * corresponding IE needs to be included in probe request.
56  *
57  * Example:
58  * ========
59  * If IE 221 needs to be in the probe request, set the corresponding bit
60  * as follows:
61  * a= IE/32 = 221/32 = 6 = g_probe_req_ie_bitmap_6
62  * b = IE modulo 32 = 29,
63  * means set the bth bit in g_probe_req_ie_bitmap_a,
64  * therefore set 29th bit in g_probe_req_ie_bitmap_6,
65  * as a result, g_probe_req_ie_bitmap_6=20000000
66  *
67  * Note: For IE 221, its mandatory to set the gProbeReqOUIs.
68  */
69 
70 /*
71  * <ini>
72  * g_probe_req_ie_bitmap_0 - Used to set the bitmap of IEs from 0 to 31
73  * @Min: 0x00000000
74  * @Max: 0xFFFFFFFF
75  * @Default: 0x00000000
76  *
77  * This ini is used to include the IEs from 0 to 31 in probe request,
78  * when corresponding bit is set.
79  *
80  * Related: Need to enable g_enable_probereq_whitelist_ies.
81  *
82  * Supported Feature: Probe request ie allowlisting
83  *
84  * Usage: Internal/External
85  *
86  * </ini>
87  */
88 #define CFG_PROBE_REQ_IE_BIT_MAP0 CFG_INI_UINT( \
89 			"g_probe_req_ie_bitmap_0", \
90 			0x00000000, \
91 			0xFFFFFFFF, \
92 			0x00000000, \
93 			CFG_VALUE_OR_DEFAULT, \
94 			"IE Bitmap 0")
95 
96 /*
97  * <ini>
98  * g_probe_req_ie_bitmap_1 - Used to set the bitmap of IEs from 32 to 63
99  * @Min: 0x00000000
100  * @Max: 0xFFFFFFFF
101  * @Default: 0x00000000
102  *
103  * This ini is used to include the IEs from 32 to 63 in probe request,
104  * when corresponding bit is set.
105  *
106  * Related: Need to enable g_enable_probereq_whitelist_ies.
107  *
108  * Supported Feature: Probe request ie allowlisting
109  *
110  * Usage: Internal/External
111  *
112  * </ini>
113  */
114 #define CFG_PROBE_REQ_IE_BIT_MAP1 CFG_INI_UINT( \
115 			"g_probe_req_ie_bitmap_1", \
116 			0x00000000, \
117 			0xFFFFFFFF, \
118 			0x00000000, \
119 			CFG_VALUE_OR_DEFAULT, \
120 			"IE Bitmap 1")
121 
122 /*
123  * <ini>
124  * g_probe_req_ie_bitmap_2 - Used to set the bitmap of IEs from 64 to 95
125  * @Min: 0x00000000
126  * @Max: 0xFFFFFFFF
127  * @Default: 0x00000000
128  *
129  * This ini is used to include the IEs from 64 to 95 in probe request,
130  * when corresponding bit is set.
131  *
132  * Related: Need to enable g_enable_probereq_whitelist_ies.
133  *
134  * Supported Feature: Probe request ie allowlisting
135  *
136  * Usage: Internal/External
137  *
138  * </ini>
139  */
140 #define CFG_PROBE_REQ_IE_BIT_MAP2 CFG_INI_UINT( \
141 			"g_probe_req_ie_bitmap_2", \
142 			0x00000000, \
143 			0xFFFFFFFF, \
144 			0x00000000, \
145 			CFG_VALUE_OR_DEFAULT, \
146 			"IE Bitmap 2")
147 
148 /*
149  * <ini>
150  * g_probe_req_ie_bitmap_3 - Used to set the bitmap of IEs from 96 to 127
151  * @Min: 0x00000000
152  * @Max: 0xFFFFFFFF
153  * @Default: 0x00000000
154  *
155  * This ini is used to include the IEs from 96 to 127 in probe request,
156  * when corresponding bit is set.
157  *
158  * Related: Need to enable g_enable_probereq_whitelist_ies.
159  *
160  * Supported Feature: Probe request ie allowlisting
161  *
162  * Usage: Internal/External
163  *
164  * </ini>
165  */
166 #define CFG_PROBE_REQ_IE_BIT_MAP3 CFG_INI_UINT( \
167 			"g_probe_req_ie_bitmap_3", \
168 			0x00000000, \
169 			0xFFFFFFFF, \
170 			0x00000000, \
171 			CFG_VALUE_OR_DEFAULT, \
172 			"IE Bitmap 3")
173 
174 /*
175  * <ini>
176  * g_probe_req_ie_bitmap_4 - Used to set the bitmap of IEs from 128 to 159
177  * @Min: 0x00000000
178  * @Max: 0xFFFFFFFF
179  * @Default: 0x00000000
180  *
181  * This ini is used to include the IEs from 128 to 159 in probe request,
182  * when corresponding bit is set.
183  *
184  * Related: Need to enable g_enable_probereq_whitelist_ies.
185  *
186  * Supported Feature: Probe request ie allowlisting
187  *
188  * Usage: Internal/External
189  *
190  * </ini>
191  */
192 #define CFG_PROBE_REQ_IE_BIT_MAP4 CFG_INI_UINT( \
193 			"g_probe_req_ie_bitmap_4", \
194 			0x00000000, \
195 			0xFFFFFFFF, \
196 			0x00000000, \
197 			CFG_VALUE_OR_DEFAULT, \
198 			"IE Bitmap 4")
199 
200 /*
201  * <ini>
202  * g_probe_req_ie_bitmap_5 - Used to set the bitmap of IEs from 160 to 191
203  * @Min: 0x00000000
204  * @Max: 0xFFFFFFFF
205  * @Default: 0x00000000
206  *
207  * This ini is used to include the IEs from 160 to 191 in probe request,
208  * when corresponding bit is set.
209  *
210  * Related: Need to enable g_enable_probereq_whitelist_ies.
211  *
212  * Supported Feature: Probe request ie allowlisting
213  *
214  * Usage: Internal/External
215  *
216  * </ini>
217  */
218 #define CFG_PROBE_REQ_IE_BIT_MAP5 CFG_INI_UINT( \
219 			"g_probe_req_ie_bitmap_5", \
220 			0x00000000, \
221 			0xFFFFFFFF, \
222 			0x00000000, \
223 			CFG_VALUE_OR_DEFAULT, \
224 			"IE Bitmap 5")
225 
226 /*
227  * <ini>
228  * g_probe_req_ie_bitmap_6 - Used to set the bitmap of IEs from 192 to 223
229  * @Min: 0x00000000
230  * @Max: 0xFFFFFFFF
231  * @Default: 0x00000000
232  *
233  * This ini is used to include the IEs from 192 to 223 in probe request,
234  * when corresponding bit is set.
235  *
236  * Related: Need to enable g_enable_probereq_whitelist_ies.
237  *
238  * Supported Feature: Probe request ie allowlisting
239  *
240  * Usage: Internal/External
241  *
242  * </ini>
243  */
244 #define CFG_PROBE_REQ_IE_BIT_MAP6 CFG_INI_UINT( \
245 			"g_probe_req_ie_bitmap_6", \
246 			0x00000000, \
247 			0xFFFFFFFF, \
248 			0x00000000, \
249 			CFG_VALUE_OR_DEFAULT, \
250 			"IE Bitmap 6")
251 
252 /*
253  * <ini>
254  * g_probe_req_ie_bitmap_7 - Used to set the bitmap of IEs from 224 to 255
255  * @Min: 0x00000000
256  * @Max: 0xFFFFFFFF
257  * @Default: 0x00000000
258  *
259  * This ini is used to include the IEs from 224 to 255 in probe request,
260  * when corresponding bit is set.
261  *
262  * Related: Need to enable g_enable_probereq_whitelist_ies.
263  *
264  * Supported Feature: Probe request ie allowlisting
265  *
266  * Usage: Internal/External
267  *
268  * </ini>
269  */
270 #define CFG_PROBE_REQ_IE_BIT_MAP7 CFG_INI_UINT( \
271 			"g_probe_req_ie_bitmap_7", \
272 			0x00000000, \
273 			0xFFFFFFFF, \
274 			0x00000000, \
275 			CFG_VALUE_OR_DEFAULT, \
276 			"IE Bitmap 7")
277 
278 #define MAX_PRB_REQ_VENDOR_OUI_INI_LEN 160
279 #define VENDOR_SPECIFIC_IE_BITMAP 0x20000000
280 /*
281  * For vendor specific IE, Probe Req OUI types and sub types which are
282  * to be allow listed are specified in gProbeReqOUIs in the following
283  * example format - gProbeReqOUIs=AABBCCDD EEFF1122
284  */
285 
286 /*
287  * <ini>
288  * gProbeReqOUIs - Used to specify vendor specific OUIs
289  * @Default: Empty string
290  *
291  * This ini is used to include the specified OUIs in vendor specific IE
292  * of probe request.
293  *
294  * Related: Need to enable g_enable_probereq_whitelist_ies and
295  * vendor specific IE should be set in g_probe_req_ie_bitmap_6.
296  *
297  * Supported Feature: Probe request ie allowlisting
298  *
299  * Usage: Internal/External
300  *
301  * </ini>
302  */
303 #define CFG_PROBE_REQ_OUI CFG_INI_STRING( \
304 			"gProbeReqOUIs", \
305 			0, \
306 			MAX_PRB_REQ_VENDOR_OUI_INI_LEN, \
307 			"", \
308 			"Probe Req OUIs")
309 
310 #define CFG_IE_ALLOWLIST \
311 	CFG(CFG_PROBE_REQ_IE_ALLOWLIST) \
312 	CFG(CFG_PROBE_REQ_IE_BIT_MAP0) \
313 	CFG(CFG_PROBE_REQ_IE_BIT_MAP1) \
314 	CFG(CFG_PROBE_REQ_IE_BIT_MAP2) \
315 	CFG(CFG_PROBE_REQ_IE_BIT_MAP3) \
316 	CFG(CFG_PROBE_REQ_IE_BIT_MAP4) \
317 	CFG(CFG_PROBE_REQ_IE_BIT_MAP5) \
318 	CFG(CFG_PROBE_REQ_IE_BIT_MAP6) \
319 	CFG(CFG_PROBE_REQ_IE_BIT_MAP7) \
320 	CFG(CFG_PROBE_REQ_OUI)
321 
322 #endif
323