diff options
author | David S. Miller <davem@davemloft.net> | 2008-06-14 20:15:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-14 20:15:39 -0400 |
commit | 942e7b102a4827fdb69a39c7f07c544542589ef9 (patch) | |
tree | 4c47174c91eb76aaa31abc141adbee1acc649987 /include/linux | |
parent | 7d06b2e053d2d536348e3a0f6bb02982a41bea37 (diff) | |
parent | 87291c0269e77b029282676448fed3706a54211a (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/ieee80211.h | 407 | ||||
-rw-r--r-- | include/linux/nl80211.h | 8 |
2 files changed, 379 insertions, 36 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 9300f37cd7e8..2998e3b5f166 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -98,6 +98,7 @@ | |||
98 | 98 | ||
99 | #define IEEE80211_MAX_SSID_LEN 32 | 99 | #define IEEE80211_MAX_SSID_LEN 32 |
100 | #define IEEE80211_MAX_MESH_ID_LEN 32 | 100 | #define IEEE80211_MAX_MESH_ID_LEN 32 |
101 | #define IEEE80211_QOS_CTL_LEN 2 | ||
101 | 102 | ||
102 | struct ieee80211_hdr { | 103 | struct ieee80211_hdr { |
103 | __le16 frame_control; | 104 | __le16 frame_control; |
@@ -109,6 +110,355 @@ struct ieee80211_hdr { | |||
109 | u8 addr4[6]; | 110 | u8 addr4[6]; |
110 | } __attribute__ ((packed)); | 111 | } __attribute__ ((packed)); |
111 | 112 | ||
113 | /** | ||
114 | * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set | ||
115 | * @fc: frame control bytes in little-endian byteorder | ||
116 | */ | ||
117 | static inline int ieee80211_has_tods(__le16 fc) | ||
118 | { | ||
119 | return (fc & cpu_to_le16(IEEE80211_FCTL_TODS)) != 0; | ||
120 | } | ||
121 | |||
122 | /** | ||
123 | * ieee80211_has_fromds - check if IEEE80211_FCTL_FROMDS is set | ||
124 | * @fc: frame control bytes in little-endian byteorder | ||
125 | */ | ||
126 | static inline int ieee80211_has_fromds(__le16 fc) | ||
127 | { | ||
128 | return (fc & cpu_to_le16(IEEE80211_FCTL_FROMDS)) != 0; | ||
129 | } | ||
130 | |||
131 | /** | ||
132 | * ieee80211_has_a4 - check if IEEE80211_FCTL_TODS and IEEE80211_FCTL_FROMDS are set | ||
133 | * @fc: frame control bytes in little-endian byteorder | ||
134 | */ | ||
135 | static inline int ieee80211_has_a4(__le16 fc) | ||
136 | { | ||
137 | __le16 tmp = cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS); | ||
138 | return (fc & tmp) == tmp; | ||
139 | } | ||
140 | |||
141 | /** | ||
142 | * ieee80211_has_morefrags - check if IEEE80211_FCTL_MOREFRAGS is set | ||
143 | * @fc: frame control bytes in little-endian byteorder | ||
144 | */ | ||
145 | static inline int ieee80211_has_morefrags(__le16 fc) | ||
146 | { | ||
147 | return (fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) != 0; | ||
148 | } | ||
149 | |||
150 | /** | ||
151 | * ieee80211_has_retry - check if IEEE80211_FCTL_RETRY is set | ||
152 | * @fc: frame control bytes in little-endian byteorder | ||
153 | */ | ||
154 | static inline int ieee80211_has_retry(__le16 fc) | ||
155 | { | ||
156 | return (fc & cpu_to_le16(IEEE80211_FCTL_RETRY)) != 0; | ||
157 | } | ||
158 | |||
159 | /** | ||
160 | * ieee80211_has_pm - check if IEEE80211_FCTL_PM is set | ||
161 | * @fc: frame control bytes in little-endian byteorder | ||
162 | */ | ||
163 | static inline int ieee80211_has_pm(__le16 fc) | ||
164 | { | ||
165 | return (fc & cpu_to_le16(IEEE80211_FCTL_PM)) != 0; | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * ieee80211_has_moredata - check if IEEE80211_FCTL_MOREDATA is set | ||
170 | * @fc: frame control bytes in little-endian byteorder | ||
171 | */ | ||
172 | static inline int ieee80211_has_moredata(__le16 fc) | ||
173 | { | ||
174 | return (fc & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) != 0; | ||
175 | } | ||
176 | |||
177 | /** | ||
178 | * ieee80211_has_protected - check if IEEE80211_FCTL_PROTECTED is set | ||
179 | * @fc: frame control bytes in little-endian byteorder | ||
180 | */ | ||
181 | static inline int ieee80211_has_protected(__le16 fc) | ||
182 | { | ||
183 | return (fc & cpu_to_le16(IEEE80211_FCTL_PROTECTED)) != 0; | ||
184 | } | ||
185 | |||
186 | /** | ||
187 | * ieee80211_has_order - check if IEEE80211_FCTL_ORDER is set | ||
188 | * @fc: frame control bytes in little-endian byteorder | ||
189 | */ | ||
190 | static inline int ieee80211_has_order(__le16 fc) | ||
191 | { | ||
192 | return (fc & cpu_to_le16(IEEE80211_FCTL_ORDER)) != 0; | ||
193 | } | ||
194 | |||
195 | /** | ||
196 | * ieee80211_is_mgmt - check if type is IEEE80211_FTYPE_MGMT | ||
197 | * @fc: frame control bytes in little-endian byteorder | ||
198 | */ | ||
199 | static inline int ieee80211_is_mgmt(__le16 fc) | ||
200 | { | ||
201 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) == | ||
202 | cpu_to_le16(IEEE80211_FTYPE_MGMT); | ||
203 | } | ||
204 | |||
205 | /** | ||
206 | * ieee80211_is_ctl - check if type is IEEE80211_FTYPE_CTL | ||
207 | * @fc: frame control bytes in little-endian byteorder | ||
208 | */ | ||
209 | static inline int ieee80211_is_ctl(__le16 fc) | ||
210 | { | ||
211 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) == | ||
212 | cpu_to_le16(IEEE80211_FTYPE_CTL); | ||
213 | } | ||
214 | |||
215 | /** | ||
216 | * ieee80211_is_data - check if type is IEEE80211_FTYPE_DATA | ||
217 | * @fc: frame control bytes in little-endian byteorder | ||
218 | */ | ||
219 | static inline int ieee80211_is_data(__le16 fc) | ||
220 | { | ||
221 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) == | ||
222 | cpu_to_le16(IEEE80211_FTYPE_DATA); | ||
223 | } | ||
224 | |||
225 | /** | ||
226 | * ieee80211_is_data_qos - check if type is IEEE80211_FTYPE_DATA and IEEE80211_STYPE_QOS_DATA is set | ||
227 | * @fc: frame control bytes in little-endian byteorder | ||
228 | */ | ||
229 | static inline int ieee80211_is_data_qos(__le16 fc) | ||
230 | { | ||
231 | /* | ||
232 | * mask with QOS_DATA rather than IEEE80211_FCTL_STYPE as we just need | ||
233 | * to check the one bit | ||
234 | */ | ||
235 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_STYPE_QOS_DATA)) == | ||
236 | cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA); | ||
237 | } | ||
238 | |||
239 | /** | ||
240 | * ieee80211_is_data_present - check if type is IEEE80211_FTYPE_DATA and has data | ||
241 | * @fc: frame control bytes in little-endian byteorder | ||
242 | */ | ||
243 | static inline int ieee80211_is_data_present(__le16 fc) | ||
244 | { | ||
245 | /* | ||
246 | * mask with 0x40 and test that that bit is clear to only return true | ||
247 | * for the data-containing substypes. | ||
248 | */ | ||
249 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | 0x40)) == | ||
250 | cpu_to_le16(IEEE80211_FTYPE_DATA); | ||
251 | } | ||
252 | |||
253 | /** | ||
254 | * ieee80211_is_assoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_REQ | ||
255 | * @fc: frame control bytes in little-endian byteorder | ||
256 | */ | ||
257 | static inline int ieee80211_is_assoc_req(__le16 fc) | ||
258 | { | ||
259 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
260 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_REQ); | ||
261 | } | ||
262 | |||
263 | /** | ||
264 | * ieee80211_is_assoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_RESP | ||
265 | * @fc: frame control bytes in little-endian byteorder | ||
266 | */ | ||
267 | static inline int ieee80211_is_assoc_resp(__le16 fc) | ||
268 | { | ||
269 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
270 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_RESP); | ||
271 | } | ||
272 | |||
273 | /** | ||
274 | * ieee80211_is_reassoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_REQ | ||
275 | * @fc: frame control bytes in little-endian byteorder | ||
276 | */ | ||
277 | static inline int ieee80211_is_reassoc_req(__le16 fc) | ||
278 | { | ||
279 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
280 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_REQ); | ||
281 | } | ||
282 | |||
283 | /** | ||
284 | * ieee80211_is_reassoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_RESP | ||
285 | * @fc: frame control bytes in little-endian byteorder | ||
286 | */ | ||
287 | static inline int ieee80211_is_reassoc_resp(__le16 fc) | ||
288 | { | ||
289 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
290 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_RESP); | ||
291 | } | ||
292 | |||
293 | /** | ||
294 | * ieee80211_is_probe_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_REQ | ||
295 | * @fc: frame control bytes in little-endian byteorder | ||
296 | */ | ||
297 | static inline int ieee80211_is_probe_req(__le16 fc) | ||
298 | { | ||
299 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
300 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ); | ||
301 | } | ||
302 | |||
303 | /** | ||
304 | * ieee80211_is_probe_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_RESP | ||
305 | * @fc: frame control bytes in little-endian byteorder | ||
306 | */ | ||
307 | static inline int ieee80211_is_probe_resp(__le16 fc) | ||
308 | { | ||
309 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
310 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); | ||
311 | } | ||
312 | |||
313 | /** | ||
314 | * ieee80211_is_beacon - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_BEACON | ||
315 | * @fc: frame control bytes in little-endian byteorder | ||
316 | */ | ||
317 | static inline int ieee80211_is_beacon(__le16 fc) | ||
318 | { | ||
319 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
320 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); | ||
321 | } | ||
322 | |||
323 | /** | ||
324 | * ieee80211_is_atim - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ATIM | ||
325 | * @fc: frame control bytes in little-endian byteorder | ||
326 | */ | ||
327 | static inline int ieee80211_is_atim(__le16 fc) | ||
328 | { | ||
329 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
330 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ATIM); | ||
331 | } | ||
332 | |||
333 | /** | ||
334 | * ieee80211_is_disassoc - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DISASSOC | ||
335 | * @fc: frame control bytes in little-endian byteorder | ||
336 | */ | ||
337 | static inline int ieee80211_is_disassoc(__le16 fc) | ||
338 | { | ||
339 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
340 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DISASSOC); | ||
341 | } | ||
342 | |||
343 | /** | ||
344 | * ieee80211_is_auth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_AUTH | ||
345 | * @fc: frame control bytes in little-endian byteorder | ||
346 | */ | ||
347 | static inline int ieee80211_is_auth(__le16 fc) | ||
348 | { | ||
349 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
350 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH); | ||
351 | } | ||
352 | |||
353 | /** | ||
354 | * ieee80211_is_deauth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DEAUTH | ||
355 | * @fc: frame control bytes in little-endian byteorder | ||
356 | */ | ||
357 | static inline int ieee80211_is_deauth(__le16 fc) | ||
358 | { | ||
359 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
360 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH); | ||
361 | } | ||
362 | |||
363 | /** | ||
364 | * ieee80211_is_action - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ACTION | ||
365 | * @fc: frame control bytes in little-endian byteorder | ||
366 | */ | ||
367 | static inline int ieee80211_is_action(__le16 fc) | ||
368 | { | ||
369 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
370 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION); | ||
371 | } | ||
372 | |||
373 | /** | ||
374 | * ieee80211_is_back_req - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK_REQ | ||
375 | * @fc: frame control bytes in little-endian byteorder | ||
376 | */ | ||
377 | static inline int ieee80211_is_back_req(__le16 fc) | ||
378 | { | ||
379 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
380 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK_REQ); | ||
381 | } | ||
382 | |||
383 | /** | ||
384 | * ieee80211_is_back - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK | ||
385 | * @fc: frame control bytes in little-endian byteorder | ||
386 | */ | ||
387 | static inline int ieee80211_is_back(__le16 fc) | ||
388 | { | ||
389 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
390 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK); | ||
391 | } | ||
392 | |||
393 | /** | ||
394 | * ieee80211_is_pspoll - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_PSPOLL | ||
395 | * @fc: frame control bytes in little-endian byteorder | ||
396 | */ | ||
397 | static inline int ieee80211_is_pspoll(__le16 fc) | ||
398 | { | ||
399 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
400 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL); | ||
401 | } | ||
402 | |||
403 | /** | ||
404 | * ieee80211_is_rts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_RTS | ||
405 | * @fc: frame control bytes in little-endian byteorder | ||
406 | */ | ||
407 | static inline int ieee80211_is_rts(__le16 fc) | ||
408 | { | ||
409 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
410 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS); | ||
411 | } | ||
412 | |||
413 | /** | ||
414 | * ieee80211_is_cts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CTS | ||
415 | * @fc: frame control bytes in little-endian byteorder | ||
416 | */ | ||
417 | static inline int ieee80211_is_cts(__le16 fc) | ||
418 | { | ||
419 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
420 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS); | ||
421 | } | ||
422 | |||
423 | /** | ||
424 | * ieee80211_is_ack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_ACK | ||
425 | * @fc: frame control bytes in little-endian byteorder | ||
426 | */ | ||
427 | static inline int ieee80211_is_ack(__le16 fc) | ||
428 | { | ||
429 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
430 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK); | ||
431 | } | ||
432 | |||
433 | /** | ||
434 | * ieee80211_is_cfend - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFEND | ||
435 | * @fc: frame control bytes in little-endian byteorder | ||
436 | */ | ||
437 | static inline int ieee80211_is_cfend(__le16 fc) | ||
438 | { | ||
439 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
440 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFEND); | ||
441 | } | ||
442 | |||
443 | /** | ||
444 | * ieee80211_is_cfendack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFENDACK | ||
445 | * @fc: frame control bytes in little-endian byteorder | ||
446 | */ | ||
447 | static inline int ieee80211_is_cfendack(__le16 fc) | ||
448 | { | ||
449 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
450 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFENDACK); | ||
451 | } | ||
452 | |||
453 | /** | ||
454 | * ieee80211_is_nullfunc - check if FTYPE=IEEE80211_FTYPE_DATA and STYPE=IEEE80211_STYPE_NULLFUNC | ||
455 | * @fc: frame control bytes in little-endian byteorder | ||
456 | */ | ||
457 | static inline int ieee80211_is_nullfunc(__le16 fc) | ||
458 | { | ||
459 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
460 | cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC); | ||
461 | } | ||
112 | 462 | ||
113 | struct ieee80211s_hdr { | 463 | struct ieee80211s_hdr { |
114 | u8 flags; | 464 | u8 flags; |
@@ -320,6 +670,7 @@ struct ieee80211_ht_addt_info { | |||
320 | #define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10 | 670 | #define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10 |
321 | /* 802.11n HT IE masks */ | 671 | /* 802.11n HT IE masks */ |
322 | #define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 | 672 | #define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 |
673 | #define IEEE80211_HT_IE_CHA_SEC_NONE 0x00 | ||
323 | #define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01 | 674 | #define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01 |
324 | #define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03 | 675 | #define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03 |
325 | #define IEEE80211_HT_IE_CHA_WIDTH 0x04 | 676 | #define IEEE80211_HT_IE_CHA_WIDTH 0x04 |
@@ -552,65 +903,57 @@ enum ieee80211_back_parties { | |||
552 | #define WLAN_MAX_KEY_LEN 32 | 903 | #define WLAN_MAX_KEY_LEN 32 |
553 | 904 | ||
554 | /** | 905 | /** |
906 | * ieee80211_get_qos_ctl - get pointer to qos control bytes | ||
907 | * @hdr: the frame | ||
908 | * | ||
909 | * The qos ctrl bytes come after the frame_control, duration, seq_num | ||
910 | * and 3 or 4 addresses of length ETH_ALEN. | ||
911 | * 3 addr: 2 + 2 + 2 + 3*6 = 24 | ||
912 | * 4 addr: 2 + 2 + 2 + 4*6 = 30 | ||
913 | */ | ||
914 | static inline u8 *ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr) | ||
915 | { | ||
916 | if (ieee80211_has_a4(hdr->frame_control)) | ||
917 | return (u8 *)hdr + 30; | ||
918 | else | ||
919 | return (u8 *)hdr + 24; | ||
920 | } | ||
921 | |||
922 | /** | ||
555 | * ieee80211_get_SA - get pointer to SA | 923 | * ieee80211_get_SA - get pointer to SA |
924 | * @hdr: the frame | ||
556 | * | 925 | * |
557 | * Given an 802.11 frame, this function returns the offset | 926 | * Given an 802.11 frame, this function returns the offset |
558 | * to the source address (SA). It does not verify that the | 927 | * to the source address (SA). It does not verify that the |
559 | * header is long enough to contain the address, and the | 928 | * header is long enough to contain the address, and the |
560 | * header must be long enough to contain the frame control | 929 | * header must be long enough to contain the frame control |
561 | * field. | 930 | * field. |
562 | * | ||
563 | * @hdr: the frame | ||
564 | */ | 931 | */ |
565 | static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) | 932 | static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) |
566 | { | 933 | { |
567 | __le16 fc = hdr->frame_control; | 934 | if (ieee80211_has_a4(hdr->frame_control)) |
568 | fc &= cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS); | ||
569 | |||
570 | switch (fc) { | ||
571 | case __constant_cpu_to_le16(IEEE80211_FCTL_FROMDS): | ||
572 | return hdr->addr3; | ||
573 | case __constant_cpu_to_le16(IEEE80211_FCTL_TODS|IEEE80211_FCTL_FROMDS): | ||
574 | return hdr->addr4; | 935 | return hdr->addr4; |
575 | default: | 936 | if (ieee80211_has_fromds(hdr->frame_control)) |
576 | return hdr->addr2; | 937 | return hdr->addr3; |
577 | } | 938 | return hdr->addr2; |
578 | } | 939 | } |
579 | 940 | ||
580 | /** | 941 | /** |
581 | * ieee80211_get_DA - get pointer to DA | 942 | * ieee80211_get_DA - get pointer to DA |
943 | * @hdr: the frame | ||
582 | * | 944 | * |
583 | * Given an 802.11 frame, this function returns the offset | 945 | * Given an 802.11 frame, this function returns the offset |
584 | * to the destination address (DA). It does not verify that | 946 | * to the destination address (DA). It does not verify that |
585 | * the header is long enough to contain the address, and the | 947 | * the header is long enough to contain the address, and the |
586 | * header must be long enough to contain the frame control | 948 | * header must be long enough to contain the frame control |
587 | * field. | 949 | * field. |
588 | * | ||
589 | * @hdr: the frame | ||
590 | */ | 950 | */ |
591 | static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) | 951 | static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) |
592 | { | 952 | { |
593 | __le16 fc = hdr->frame_control; | 953 | if (ieee80211_has_tods(hdr->frame_control)) |
594 | fc &= cpu_to_le16(IEEE80211_FCTL_TODS); | ||
595 | |||
596 | if (fc) | ||
597 | return hdr->addr3; | 954 | return hdr->addr3; |
598 | else | 955 | else |
599 | return hdr->addr1; | 956 | return hdr->addr1; |
600 | } | 957 | } |
601 | 958 | ||
602 | /** | ||
603 | * ieee80211_get_morefrag - determine whether the MOREFRAGS bit is set | ||
604 | * | ||
605 | * This function determines whether the "more fragments" bit is set | ||
606 | * in the frame. | ||
607 | * | ||
608 | * @hdr: the frame | ||
609 | */ | ||
610 | static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr) | ||
611 | { | ||
612 | __le16 fc = hdr->frame_control; | ||
613 | return !!(fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)); | ||
614 | } | ||
615 | |||
616 | #endif /* IEEE80211_H */ | 959 | #endif /* IEEE80211_H */ |
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index ea6517e58b04..aa8411e2a160 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -122,13 +122,13 @@ enum nl80211_commands { | |||
122 | NL80211_CMD_NEW_STATION, | 122 | NL80211_CMD_NEW_STATION, |
123 | NL80211_CMD_DEL_STATION, | 123 | NL80211_CMD_DEL_STATION, |
124 | 124 | ||
125 | /* add commands here */ | ||
126 | |||
127 | NL80211_CMD_GET_MPATH, | 125 | NL80211_CMD_GET_MPATH, |
128 | NL80211_CMD_SET_MPATH, | 126 | NL80211_CMD_SET_MPATH, |
129 | NL80211_CMD_NEW_MPATH, | 127 | NL80211_CMD_NEW_MPATH, |
130 | NL80211_CMD_DEL_MPATH, | 128 | NL80211_CMD_DEL_MPATH, |
131 | 129 | ||
130 | /* add commands here */ | ||
131 | |||
132 | /* used to define NL80211_CMD_MAX below */ | 132 | /* used to define NL80211_CMD_MAX below */ |
133 | __NL80211_CMD_AFTER_LAST, | 133 | __NL80211_CMD_AFTER_LAST, |
134 | NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 | 134 | NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 |
@@ -230,13 +230,13 @@ enum nl80211_attrs { | |||
230 | 230 | ||
231 | NL80211_ATTR_MNTR_FLAGS, | 231 | NL80211_ATTR_MNTR_FLAGS, |
232 | 232 | ||
233 | /* add attributes here, update the policy in nl80211.c */ | ||
234 | |||
235 | NL80211_ATTR_MESH_ID, | 233 | NL80211_ATTR_MESH_ID, |
236 | NL80211_ATTR_STA_PLINK_ACTION, | 234 | NL80211_ATTR_STA_PLINK_ACTION, |
237 | NL80211_ATTR_MPATH_NEXT_HOP, | 235 | NL80211_ATTR_MPATH_NEXT_HOP, |
238 | NL80211_ATTR_MPATH_INFO, | 236 | NL80211_ATTR_MPATH_INFO, |
239 | 237 | ||
238 | /* add attributes here, update the policy in nl80211.c */ | ||
239 | |||
240 | __NL80211_ATTR_AFTER_LAST, | 240 | __NL80211_ATTR_AFTER_LAST, |
241 | NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 | 241 | NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 |
242 | }; | 242 | }; |