2 * Received Data frame processing
3 * Copyright (c) 2010-2015, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
9 #include "utils/includes.h"
11 #include "utils/common.h"
12 #include "common/defs.h"
13 #include "common/ieee802_11_defs.h"
17 static const char * data_stype(u16 stype
)
20 case WLAN_FC_STYPE_DATA
:
22 case WLAN_FC_STYPE_DATA_CFACK
:
24 case WLAN_FC_STYPE_DATA_CFPOLL
:
26 case WLAN_FC_STYPE_DATA_CFACKPOLL
:
27 return "DATA-CFACKPOLL";
28 case WLAN_FC_STYPE_NULLFUNC
:
30 case WLAN_FC_STYPE_CFACK
:
32 case WLAN_FC_STYPE_CFPOLL
:
34 case WLAN_FC_STYPE_CFACKPOLL
:
36 case WLAN_FC_STYPE_QOS_DATA
:
38 case WLAN_FC_STYPE_QOS_DATA_CFACK
:
39 return "QOSDATA-CFACK";
40 case WLAN_FC_STYPE_QOS_DATA_CFPOLL
:
41 return "QOSDATA-CFPOLL";
42 case WLAN_FC_STYPE_QOS_DATA_CFACKPOLL
:
43 return "QOSDATA-CFACKPOLL";
44 case WLAN_FC_STYPE_QOS_NULL
:
46 case WLAN_FC_STYPE_QOS_CFPOLL
:
48 case WLAN_FC_STYPE_QOS_CFACKPOLL
:
49 return "QOS-CFACKPOLL";
55 static void rx_data_eth(struct wlantest
*wt
, const u8
*bssid
,
56 const u8
*sta_addr
, const u8
*dst
, const u8
*src
,
57 u16 ethertype
, const u8
*data
, size_t len
, int prot
,
60 static void rx_data_vlan(struct wlantest
*wt
, const u8
*bssid
,
61 const u8
*sta_addr
, const u8
*dst
, const u8
*src
,
62 const u8
*data
, size_t len
, int prot
,
69 tag
= WPA_GET_BE16(data
);
70 wpa_printf(MSG_MSGDUMP
, "VLAN tag: Priority=%u ID=%u",
71 tag
>> 12, tag
& 0x0ffff);
72 /* ignore VLAN information and process the original frame */
73 rx_data_eth(wt
, bssid
, sta_addr
, dst
, src
, WPA_GET_BE16(data
+ 2),
74 data
+ 4, len
- 4, prot
, peer_addr
);
78 static void rx_data_eth(struct wlantest
*wt
, const u8
*bssid
,
79 const u8
*sta_addr
, const u8
*dst
, const u8
*src
,
80 u16 ethertype
, const u8
*data
, size_t len
, int prot
,
85 rx_data_eapol(wt
, bssid
, sta_addr
, dst
, src
, data
, len
, prot
);
88 rx_data_ip(wt
, bssid
, sta_addr
, dst
, src
, data
, len
,
92 rx_data_80211_encap(wt
, bssid
, sta_addr
, dst
, src
, data
, len
);
95 rx_data_vlan(wt
, bssid
, sta_addr
, dst
, src
, data
, len
, prot
,
102 static void rx_data_process(struct wlantest
*wt
, const u8
*bssid
,
104 const u8
*dst
, const u8
*src
,
105 const u8
*data
, size_t len
, int prot
,
111 if (len
>= 8 && os_memcmp(data
, "\xaa\xaa\x03\x00\x00\x00", 6) == 0) {
112 rx_data_eth(wt
, bssid
, sta_addr
, dst
, src
,
113 WPA_GET_BE16(data
+ 6), data
+ 8, len
- 8, prot
,
118 wpa_hexdump(MSG_DEBUG
, "Unrecognized LLC", data
, len
> 8 ? 8 : len
);
122 static u8
* try_all_ptk(struct wlantest
*wt
, int pairwise_cipher
,
123 const struct ieee80211_hdr
*hdr
,
124 const u8
*data
, size_t data_len
, size_t *decrypted_len
)
126 struct wlantest_ptk
*ptk
;
128 int prev_level
= wpa_debug_level
;
130 wpa_debug_level
= MSG_WARNING
;
131 dl_list_for_each(ptk
, &wt
->ptk
, struct wlantest_ptk
, list
) {
132 unsigned int tk_len
= ptk
->ptk_len
- 32;
134 if ((pairwise_cipher
== WPA_CIPHER_CCMP
||
135 pairwise_cipher
== 0) && tk_len
== 16) {
136 decrypted
= ccmp_decrypt(ptk
->ptk
.tk
, hdr
, data
,
137 data_len
, decrypted_len
);
138 } else if ((pairwise_cipher
== WPA_CIPHER_CCMP_256
||
139 pairwise_cipher
== 0) && tk_len
== 32) {
140 decrypted
= ccmp_256_decrypt(ptk
->ptk
.tk
, hdr
, data
,
141 data_len
, decrypted_len
);
142 } else if ((pairwise_cipher
== WPA_CIPHER_GCMP
||
143 pairwise_cipher
== WPA_CIPHER_GCMP_256
||
144 pairwise_cipher
== 0) &&
145 (tk_len
== 16 || tk_len
== 32)) {
146 decrypted
= gcmp_decrypt(ptk
->ptk
.tk
, tk_len
, hdr
,
147 data
, data_len
, decrypted_len
);
148 } else if ((pairwise_cipher
== WPA_CIPHER_TKIP
||
149 pairwise_cipher
== 0) && tk_len
== 32) {
150 decrypted
= tkip_decrypt(ptk
->ptk
.tk
, hdr
, data
,
151 data_len
, decrypted_len
);
154 wpa_debug_level
= prev_level
;
155 add_note(wt
, MSG_DEBUG
, "Found PTK match from list of all known PTKs");
159 wpa_debug_level
= prev_level
;
165 static void rx_data_bss_prot_group(struct wlantest
*wt
,
166 const struct ieee80211_hdr
*hdr
,
168 const u8
*qos
, const u8
*dst
, const u8
*src
,
169 const u8
*data
, size_t len
)
171 struct wlantest_bss
*bss
;
173 u8
*decrypted
= NULL
;
178 bss
= bss_get(wt
, hdr
->addr2
);
182 add_note(wt
, MSG_INFO
, "Too short group addressed data frame");
186 if (bss
->group_cipher
& (WPA_CIPHER_TKIP
| WPA_CIPHER_CCMP
) &&
188 add_note(wt
, MSG_INFO
, "Expected TKIP/CCMP frame from "
189 MACSTR
" did not have ExtIV bit set to 1",
190 MAC2STR(bss
->bssid
));
194 if (bss
->group_cipher
== WPA_CIPHER_TKIP
) {
195 if (data
[3] & 0x1f) {
196 add_note(wt
, MSG_INFO
, "TKIP frame from " MACSTR
197 " used non-zero reserved bit",
198 MAC2STR(bss
->bssid
));
200 if (data
[1] != ((data
[0] | 0x20) & 0x7f)) {
201 add_note(wt
, MSG_INFO
, "TKIP frame from " MACSTR
202 " used incorrect WEPSeed[1] (was 0x%x, "
204 MAC2STR(bss
->bssid
), data
[1],
205 (data
[0] | 0x20) & 0x7f);
207 } else if (bss
->group_cipher
== WPA_CIPHER_CCMP
) {
208 if (data
[2] != 0 || (data
[3] & 0x1f) != 0) {
209 add_note(wt
, MSG_INFO
, "CCMP frame from " MACSTR
210 " used non-zero reserved bit",
211 MAC2STR(bss
->bssid
));
215 keyid
= data
[3] >> 6;
216 if (bss
->gtk_len
[keyid
] == 0 && bss
->group_cipher
!= WPA_CIPHER_WEP40
)
218 add_note(wt
, MSG_MSGDUMP
, "No GTK known to decrypt the frame "
219 "(A2=" MACSTR
" KeyID=%d)",
220 MAC2STR(hdr
->addr2
), keyid
);
224 if (bss
->group_cipher
== WPA_CIPHER_TKIP
)
225 tkip_get_pn(pn
, data
);
226 else if (bss
->group_cipher
== WPA_CIPHER_WEP40
)
227 goto skip_replay_det
;
229 ccmp_get_pn(pn
, data
);
230 if (os_memcmp(pn
, bss
->rsc
[keyid
], 6) <= 0) {
231 u16 seq_ctrl
= le_to_host16(hdr
->seq_ctrl
);
232 add_note(wt
, MSG_INFO
, "CCMP/TKIP replay detected: A1=" MACSTR
233 " A2=" MACSTR
" A3=" MACSTR
" seq=%u frag=%u%s",
234 MAC2STR(hdr
->addr1
), MAC2STR(hdr
->addr2
),
236 WLAN_GET_SEQ_SEQ(seq_ctrl
),
237 WLAN_GET_SEQ_FRAG(seq_ctrl
),
238 (le_to_host16(hdr
->frame_control
) & WLAN_FC_RETRY
) ?
240 wpa_hexdump(MSG_INFO
, "RX PN", pn
, 6);
241 wpa_hexdump(MSG_INFO
, "RSC", bss
->rsc
[keyid
], 6);
246 if (bss
->group_cipher
== WPA_CIPHER_TKIP
)
247 decrypted
= tkip_decrypt(bss
->gtk
[keyid
], hdr
, data
, len
,
249 else if (bss
->group_cipher
== WPA_CIPHER_WEP40
)
250 decrypted
= wep_decrypt(wt
, hdr
, data
, len
, &dlen
);
251 else if (bss
->group_cipher
== WPA_CIPHER_CCMP
)
252 decrypted
= ccmp_decrypt(bss
->gtk
[keyid
], hdr
, data
, len
,
254 else if (bss
->group_cipher
== WPA_CIPHER_CCMP_256
)
255 decrypted
= ccmp_256_decrypt(bss
->gtk
[keyid
], hdr
, data
, len
,
257 else if (bss
->group_cipher
== WPA_CIPHER_GCMP
||
258 bss
->group_cipher
== WPA_CIPHER_GCMP_256
)
259 decrypted
= gcmp_decrypt(bss
->gtk
[keyid
], bss
->gtk_len
[keyid
],
260 hdr
, data
, len
, &dlen
);
263 rx_data_process(wt
, bss
->bssid
, NULL
, dst
, src
, decrypted
,
266 os_memcpy(bss
->rsc
[keyid
], pn
, 6);
267 write_pcap_decrypted(wt
, (const u8
*) hdr
, hdrlen
,
270 add_note(wt
, MSG_DEBUG
, "Failed to decrypt frame");
275 static void rx_data_bss_prot(struct wlantest
*wt
,
276 const struct ieee80211_hdr
*hdr
, size_t hdrlen
,
277 const u8
*qos
, const u8
*dst
, const u8
*src
,
278 const u8
*data
, size_t len
)
280 struct wlantest_bss
*bss
, *bss2
;
281 struct wlantest_sta
*sta
, *sta2
;
283 u16 fc
= le_to_host16(hdr
->frame_control
);
288 struct wlantest_tdls
*tdls
= NULL
, *found
;
290 int ptk_iter_done
= 0;
291 int try_ptk_iter
= 0;
294 if (hdr
->addr1
[0] & 0x01) {
295 rx_data_bss_prot_group(wt
, hdr
, hdrlen
, qos
, dst
, src
,
300 if ((fc
& (WLAN_FC_TODS
| WLAN_FC_FROMDS
)) ==
301 (WLAN_FC_TODS
| WLAN_FC_FROMDS
)) {
302 bss
= bss_find(wt
, hdr
->addr1
);
304 sta
= sta_find(bss
, hdr
->addr2
);
307 WLANTEST_STA_COUNTER_PROT_DATA_TX
]++;
309 if (!sta
|| !sta
->ptk_set
) {
310 bss2
= bss_find(wt
, hdr
->addr2
);
312 sta2
= sta_find(bss2
, hdr
->addr1
);
313 if (sta2
&& (!sta
|| sta2
->ptk_set
)) {
320 bss
= bss_find(wt
, hdr
->addr2
);
323 sta
= sta_find(bss
, hdr
->addr1
);
325 } else if (fc
& WLAN_FC_TODS
) {
326 bss
= bss_get(wt
, hdr
->addr1
);
329 sta
= sta_get(bss
, hdr
->addr2
);
331 sta
->counters
[WLANTEST_STA_COUNTER_PROT_DATA_TX
]++;
332 } else if (fc
& WLAN_FC_FROMDS
) {
333 bss
= bss_get(wt
, hdr
->addr2
);
336 sta
= sta_get(bss
, hdr
->addr1
);
338 bss
= bss_get(wt
, hdr
->addr3
);
341 sta
= sta_find(bss
, hdr
->addr2
);
342 sta2
= sta_find(bss
, hdr
->addr1
);
343 if (sta
== NULL
|| sta2
== NULL
)
346 dl_list_for_each(tdls
, &bss
->tdls
, struct wlantest_tdls
, list
)
348 if ((tdls
->init
== sta
&& tdls
->resp
== sta2
) ||
349 (tdls
->init
== sta2
&& tdls
->resp
== sta
)) {
357 add_note(wt
, MSG_DEBUG
,
358 "TDLS: Link not up, but Data "
365 (!sta
->ptk_set
&& sta
->pairwise_cipher
!= WPA_CIPHER_WEP40
)) &&
367 add_note(wt
, MSG_MSGDUMP
, "No PTK known to decrypt the frame");
368 if (dl_list_empty(&wt
->ptk
))
374 add_note(wt
, MSG_INFO
, "Too short encrypted data frame");
380 if (sta
->pairwise_cipher
& (WPA_CIPHER_TKIP
| WPA_CIPHER_CCMP
) &&
382 add_note(wt
, MSG_INFO
, "Expected TKIP/CCMP frame from "
383 MACSTR
" did not have ExtIV bit set to 1",
388 if (tk
== NULL
&& sta
->pairwise_cipher
== WPA_CIPHER_TKIP
) {
389 if (data
[3] & 0x1f) {
390 add_note(wt
, MSG_INFO
, "TKIP frame from " MACSTR
391 " used non-zero reserved bit",
392 MAC2STR(hdr
->addr2
));
394 if (data
[1] != ((data
[0] | 0x20) & 0x7f)) {
395 add_note(wt
, MSG_INFO
, "TKIP frame from " MACSTR
396 " used incorrect WEPSeed[1] (was 0x%x, "
398 MAC2STR(hdr
->addr2
), data
[1],
399 (data
[0] | 0x20) & 0x7f);
401 } else if (tk
|| sta
->pairwise_cipher
== WPA_CIPHER_CCMP
) {
402 if (data
[2] != 0 || (data
[3] & 0x1f) != 0) {
403 add_note(wt
, MSG_INFO
, "CCMP frame from " MACSTR
404 " used non-zero reserved bit",
405 MAC2STR(hdr
->addr2
));
409 keyid
= data
[3] >> 6;
411 add_note(wt
, MSG_INFO
, "Unexpected non-zero KeyID %d in "
412 "individually addressed Data frame from " MACSTR
,
413 keyid
, MAC2STR(hdr
->addr2
));
418 if (fc
& WLAN_FC_TODS
)
424 if (fc
& WLAN_FC_TODS
)
430 if (os_memcmp(hdr
->addr2
, tdls
->init
->addr
, ETH_ALEN
) == 0)
431 rsc
= tdls
->rsc_init
[tid
];
433 rsc
= tdls
->rsc_resp
[tid
];
434 } else if ((fc
& (WLAN_FC_TODS
| WLAN_FC_FROMDS
)) ==
435 (WLAN_FC_TODS
| WLAN_FC_FROMDS
)) {
436 if (os_memcmp(sta
->addr
, hdr
->addr2
, ETH_ALEN
) == 0)
437 rsc
= sta
->rsc_tods
[tid
];
439 rsc
= sta
->rsc_fromds
[tid
];
440 } else if (fc
& WLAN_FC_TODS
)
441 rsc
= sta
->rsc_tods
[tid
];
443 rsc
= sta
->rsc_fromds
[tid
];
446 if (tk
== NULL
&& sta
->pairwise_cipher
== WPA_CIPHER_TKIP
)
447 tkip_get_pn(pn
, data
);
448 else if (sta
->pairwise_cipher
== WPA_CIPHER_WEP40
)
449 goto skip_replay_det
;
451 ccmp_get_pn(pn
, data
);
452 if (os_memcmp(pn
, rsc
, 6) <= 0) {
453 u16 seq_ctrl
= le_to_host16(hdr
->seq_ctrl
);
454 add_note(wt
, MSG_INFO
, "CCMP/TKIP replay detected: A1=" MACSTR
455 " A2=" MACSTR
" A3=" MACSTR
" seq=%u frag=%u%s",
456 MAC2STR(hdr
->addr1
), MAC2STR(hdr
->addr2
),
458 WLAN_GET_SEQ_SEQ(seq_ctrl
),
459 WLAN_GET_SEQ_FRAG(seq_ctrl
),
460 (le_to_host16(hdr
->frame_control
) & WLAN_FC_RETRY
) ?
462 wpa_hexdump(MSG_INFO
, "RX PN", pn
, 6);
463 wpa_hexdump(MSG_INFO
, "RSC", rsc
, 6);
469 if (sta
->pairwise_cipher
== WPA_CIPHER_CCMP_256
)
470 decrypted
= ccmp_256_decrypt(tk
, hdr
, data
, len
, &dlen
);
471 else if (sta
->pairwise_cipher
== WPA_CIPHER_GCMP
||
472 sta
->pairwise_cipher
== WPA_CIPHER_GCMP_256
)
473 decrypted
= gcmp_decrypt(tk
, sta
->ptk
.tk_len
, hdr
, data
,
476 decrypted
= ccmp_decrypt(tk
, hdr
, data
, len
, &dlen
);
477 } else if (sta
->pairwise_cipher
== WPA_CIPHER_TKIP
) {
478 decrypted
= tkip_decrypt(sta
->ptk
.tk
, hdr
, data
, len
, &dlen
);
479 } else if (sta
->pairwise_cipher
== WPA_CIPHER_WEP40
) {
480 decrypted
= wep_decrypt(wt
, hdr
, data
, len
, &dlen
);
481 } else if (sta
->ptk_set
) {
482 if (sta
->pairwise_cipher
== WPA_CIPHER_CCMP_256
)
483 decrypted
= ccmp_256_decrypt(sta
->ptk
.tk
, hdr
, data
,
485 else if (sta
->pairwise_cipher
== WPA_CIPHER_GCMP
||
486 sta
->pairwise_cipher
== WPA_CIPHER_GCMP_256
)
487 decrypted
= gcmp_decrypt(sta
->ptk
.tk
, sta
->ptk
.tk_len
,
488 hdr
, data
, len
, &dlen
);
490 decrypted
= ccmp_decrypt(sta
->ptk
.tk
, hdr
, data
, len
,
493 decrypted
= try_all_ptk(wt
, sta
->pairwise_cipher
, hdr
, data
,
497 if (!decrypted
&& !ptk_iter_done
) {
498 decrypted
= try_all_ptk(wt
, sta
->pairwise_cipher
, hdr
, data
,
501 add_note(wt
, MSG_DEBUG
, "Current PTK did not work, but found a match from all known PTKs");
505 u16 fc
= le_to_host16(hdr
->frame_control
);
506 const u8
*peer_addr
= NULL
;
507 if (!(fc
& (WLAN_FC_FROMDS
| WLAN_FC_TODS
)))
508 peer_addr
= hdr
->addr1
;
510 os_memcpy(rsc
, pn
, 6);
511 rx_data_process(wt
, bss
->bssid
, sta
->addr
, dst
, src
, decrypted
,
513 write_pcap_decrypted(wt
, (const u8
*) hdr
, hdrlen
,
517 add_note(wt
, MSG_DEBUG
, "Failed to decrypt frame");
519 /* Assume the frame was corrupted and there was no FCS to check.
520 * Allow retry of this particular frame to be processed so that
521 * it could end up getting decrypted if it was received without
523 sta
->allow_duplicate
= 1;
529 static void rx_data_bss(struct wlantest
*wt
, const struct ieee80211_hdr
*hdr
,
530 size_t hdrlen
, const u8
*qos
, const u8
*dst
,
531 const u8
*src
, const u8
*data
, size_t len
)
533 u16 fc
= le_to_host16(hdr
->frame_control
);
534 int prot
= !!(fc
& WLAN_FC_ISWEP
);
537 u8 ack
= (qos
[0] & 0x60) >> 5;
538 wpa_printf(MSG_MSGDUMP
, "BSS DATA: " MACSTR
" -> " MACSTR
539 " len=%u%s tid=%u%s%s",
540 MAC2STR(src
), MAC2STR(dst
), (unsigned int) len
,
541 prot
? " Prot" : "", qos
[0] & 0x0f,
542 (qos
[0] & 0x10) ? " EOSP" : "",
544 (ack
== 1 ? " NoAck" :
545 (ack
== 2 ? " NoExpAck" : " BA")));
547 wpa_printf(MSG_MSGDUMP
, "BSS DATA: " MACSTR
" -> " MACSTR
549 MAC2STR(src
), MAC2STR(dst
), (unsigned int) len
,
550 prot
? " Prot" : "");
554 rx_data_bss_prot(wt
, hdr
, hdrlen
, qos
, dst
, src
, data
, len
);
556 const u8
*bssid
, *sta_addr
, *peer_addr
;
557 struct wlantest_bss
*bss
;
559 if (fc
& WLAN_FC_TODS
) {
561 sta_addr
= hdr
->addr2
;
563 } else if (fc
& WLAN_FC_FROMDS
) {
565 sta_addr
= hdr
->addr1
;
569 sta_addr
= hdr
->addr2
;
570 peer_addr
= hdr
->addr1
;
573 bss
= bss_get(wt
, bssid
);
575 struct wlantest_sta
*sta
= sta_get(bss
, sta_addr
);
579 int tid
= qos
[0] & 0x0f;
580 if (fc
& WLAN_FC_TODS
)
585 if (fc
& WLAN_FC_TODS
)
593 rx_data_process(wt
, bssid
, sta_addr
, dst
, src
, data
, len
, 0,
599 static struct wlantest_tdls
* get_tdls(struct wlantest
*wt
, const u8
*bssid
,
603 struct wlantest_bss
*bss
;
604 struct wlantest_sta
*sta1
, *sta2
;
605 struct wlantest_tdls
*tdls
, *found
= NULL
;
607 bss
= bss_find(wt
, bssid
);
610 sta1
= sta_find(bss
, sta1_addr
);
613 sta2
= sta_find(bss
, sta2_addr
);
617 dl_list_for_each(tdls
, &bss
->tdls
, struct wlantest_tdls
, list
) {
618 if ((tdls
->init
== sta1
&& tdls
->resp
== sta2
) ||
619 (tdls
->init
== sta2
&& tdls
->resp
== sta1
)) {
630 static void add_direct_link(struct wlantest
*wt
, const u8
*bssid
,
631 const u8
*sta1_addr
, const u8
*sta2_addr
)
633 struct wlantest_tdls
*tdls
;
635 tdls
= get_tdls(wt
, bssid
, sta1_addr
, sta2_addr
);
640 tdls
->counters
[WLANTEST_TDLS_COUNTER_VALID_DIRECT_LINK
]++;
642 tdls
->counters
[WLANTEST_TDLS_COUNTER_INVALID_DIRECT_LINK
]++;
646 static void add_ap_path(struct wlantest
*wt
, const u8
*bssid
,
647 const u8
*sta1_addr
, const u8
*sta2_addr
)
649 struct wlantest_tdls
*tdls
;
651 tdls
= get_tdls(wt
, bssid
, sta1_addr
, sta2_addr
);
656 tdls
->counters
[WLANTEST_TDLS_COUNTER_INVALID_AP_PATH
]++;
658 tdls
->counters
[WLANTEST_TDLS_COUNTER_VALID_AP_PATH
]++;
662 void rx_data(struct wlantest
*wt
, const u8
*data
, size_t len
)
664 const struct ieee80211_hdr
*hdr
;
667 const u8
*qos
= NULL
;
672 hdr
= (const struct ieee80211_hdr
*) data
;
673 fc
= le_to_host16(hdr
->frame_control
);
674 stype
= WLAN_FC_GET_STYPE(fc
);
676 if ((fc
& (WLAN_FC_TODS
| WLAN_FC_FROMDS
)) ==
677 (WLAN_FC_TODS
| WLAN_FC_FROMDS
))
687 switch (fc
& (WLAN_FC_TODS
| WLAN_FC_FROMDS
)) {
689 wpa_printf(MSG_EXCESSIVE
, "DATA %s%s%s IBSS DA=" MACSTR
" SA="
690 MACSTR
" BSSID=" MACSTR
,
691 data_stype(WLAN_FC_GET_STYPE(fc
)),
692 fc
& WLAN_FC_PWRMGT
? " PwrMgt" : "",
693 fc
& WLAN_FC_ISWEP
? " Prot" : "",
694 MAC2STR(hdr
->addr1
), MAC2STR(hdr
->addr2
),
695 MAC2STR(hdr
->addr3
));
696 add_direct_link(wt
, hdr
->addr3
, hdr
->addr1
, hdr
->addr2
);
697 rx_data_bss(wt
, hdr
, hdrlen
, qos
, hdr
->addr1
, hdr
->addr2
,
698 data
+ hdrlen
, len
- hdrlen
);
701 wpa_printf(MSG_EXCESSIVE
, "DATA %s%s%s FromDS DA=" MACSTR
702 " BSSID=" MACSTR
" SA=" MACSTR
,
703 data_stype(WLAN_FC_GET_STYPE(fc
)),
704 fc
& WLAN_FC_PWRMGT
? " PwrMgt" : "",
705 fc
& WLAN_FC_ISWEP
? " Prot" : "",
706 MAC2STR(hdr
->addr1
), MAC2STR(hdr
->addr2
),
707 MAC2STR(hdr
->addr3
));
708 add_ap_path(wt
, hdr
->addr2
, hdr
->addr1
, hdr
->addr3
);
709 rx_data_bss(wt
, hdr
, hdrlen
, qos
, hdr
->addr1
, hdr
->addr3
,
710 data
+ hdrlen
, len
- hdrlen
);
713 wpa_printf(MSG_EXCESSIVE
, "DATA %s%s%s ToDS BSSID=" MACSTR
714 " SA=" MACSTR
" DA=" MACSTR
,
715 data_stype(WLAN_FC_GET_STYPE(fc
)),
716 fc
& WLAN_FC_PWRMGT
? " PwrMgt" : "",
717 fc
& WLAN_FC_ISWEP
? " Prot" : "",
718 MAC2STR(hdr
->addr1
), MAC2STR(hdr
->addr2
),
719 MAC2STR(hdr
->addr3
));
720 add_ap_path(wt
, hdr
->addr1
, hdr
->addr3
, hdr
->addr2
);
721 rx_data_bss(wt
, hdr
, hdrlen
, qos
, hdr
->addr3
, hdr
->addr2
,
722 data
+ hdrlen
, len
- hdrlen
);
724 case WLAN_FC_TODS
| WLAN_FC_FROMDS
:
725 wpa_printf(MSG_EXCESSIVE
, "DATA %s%s%s WDS RA=" MACSTR
" TA="
726 MACSTR
" DA=" MACSTR
" SA=" MACSTR
,
727 data_stype(WLAN_FC_GET_STYPE(fc
)),
728 fc
& WLAN_FC_PWRMGT
? " PwrMgt" : "",
729 fc
& WLAN_FC_ISWEP
? " Prot" : "",
730 MAC2STR(hdr
->addr1
), MAC2STR(hdr
->addr2
),
732 MAC2STR((const u8
*) (hdr
+ 1)));
733 rx_data_bss(wt
, hdr
, hdrlen
, qos
, hdr
->addr1
, hdr
->addr2
,
734 data
+ hdrlen
, len
- hdrlen
);