- switch (type) {
- case WLAN_FC_TYPE_DATA:
- if (len < 24)
- return;
- switch (fc & (WLAN_FC_FROMDS | WLAN_FC_TODS)) {
- case WLAN_FC_TODS:
- bssid = hdr->addr1;
- break;
- case WLAN_FC_FROMDS:
- bssid = hdr->addr2;
- break;
- default:
- /* discard */
- return;
- }
- break;
- case WLAN_FC_TYPE_CTRL:
- /* discard non-ps-poll frames */
- if (stype != WLAN_FC_STYPE_PSPOLL)
- return;
- bssid = hdr->addr1;
- break;
- case WLAN_FC_TYPE_MGMT:
- bssid = hdr->addr3;
- break;
- default:
- /* discard */
- return;
- }
-
-#ifdef HOSTAPD
- /* find interface frame belongs to */
- for (i = 0; i < iface->num_bss; i++) {
- if (memcmp(bssid, iface->bss[i]->own_addr, ETH_ALEN) == 0) {
- hapd = iface->bss[i];
- break;
- }
- }
-
- if (hapd == NULL) {
- hapd = iface->bss[0];
-
- if (bssid[0] != 0xff || bssid[1] != 0xff ||
- bssid[2] != 0xff || bssid[3] != 0xff ||
- bssid[4] != 0xff || bssid[5] != 0xff) {
- /*
- * Unknown BSSID - drop frame if this is not from
- * passive scanning or a beacon (at least ProbeReq
- * frames to other APs may be allowed through RX
- * filtering in the wlan hw/driver)
- */
- if ((type != WLAN_FC_TYPE_MGMT ||
- stype != WLAN_FC_STYPE_BEACON))
- return;
- } else
- broadcast_bssid = 1;
- }
- ctx = hapd;
-#endif /* HOSTAPD */
-
- switch (msg_type) {
- case ieee80211_msg_normal:
- /* continue processing */
- break;
- case ieee80211_msg_tx_callback_ack:
- handle_tx_callback(ctx, buf, data_len, 1);
- return;
- case ieee80211_msg_tx_callback_fail:
- handle_tx_callback(ctx, buf, data_len, 0);
- return;
- }
-
- switch (type) {