diff options
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r-- | net/mac80211/rx.c | 295 |
1 files changed, 112 insertions, 183 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 9f2807aeaf52..6cbf1a7b3157 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -283,15 +283,15 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, | |||
283 | skb->protocol = htons(ETH_P_802_2); | 283 | skb->protocol = htons(ETH_P_802_2); |
284 | 284 | ||
285 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 285 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
286 | if (!netif_running(sdata->dev)) | ||
287 | continue; | ||
288 | |||
289 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) | 286 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) |
290 | continue; | 287 | continue; |
291 | 288 | ||
292 | if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) | 289 | if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) |
293 | continue; | 290 | continue; |
294 | 291 | ||
292 | if (!netif_running(sdata->dev)) | ||
293 | continue; | ||
294 | |||
295 | if (prev_dev) { | 295 | if (prev_dev) { |
296 | skb2 = skb_clone(skb, GFP_ATOMIC); | 296 | skb2 = skb_clone(skb, GFP_ATOMIC); |
297 | if (skb2) { | 297 | if (skb2) { |
@@ -361,7 +361,9 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx) | |||
361 | * boundary. In the case of regular frames, this simply means aligning the | 361 | * boundary. In the case of regular frames, this simply means aligning the |
362 | * payload to a four-byte boundary (because either the IP header is directly | 362 | * payload to a four-byte boundary (because either the IP header is directly |
363 | * contained, or IV/RFC1042 headers that have a length divisible by four are | 363 | * contained, or IV/RFC1042 headers that have a length divisible by four are |
364 | * in front of it). | 364 | * in front of it). If the payload data is not properly aligned and the |
365 | * architecture doesn't support efficient unaligned operations, mac80211 | ||
366 | * will align the data. | ||
365 | * | 367 | * |
366 | * With A-MSDU frames, however, the payload data address must yield two modulo | 368 | * With A-MSDU frames, however, the payload data address must yield two modulo |
367 | * four because there are 14-byte 802.3 headers within the A-MSDU frames that | 369 | * four because there are 14-byte 802.3 headers within the A-MSDU frames that |
@@ -375,25 +377,10 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx) | |||
375 | */ | 377 | */ |
376 | static void ieee80211_verify_alignment(struct ieee80211_rx_data *rx) | 378 | static void ieee80211_verify_alignment(struct ieee80211_rx_data *rx) |
377 | { | 379 | { |
378 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; | 380 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
379 | int hdrlen; | 381 | WARN_ONCE((unsigned long)rx->skb->data & 1, |
380 | 382 | "unaligned packet at 0x%p\n", rx->skb->data); | |
381 | #ifndef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT | ||
382 | return; | ||
383 | #endif | 383 | #endif |
384 | |||
385 | if (WARN_ONCE((unsigned long)rx->skb->data & 1, | ||
386 | "unaligned packet at 0x%p\n", rx->skb->data)) | ||
387 | return; | ||
388 | |||
389 | if (!ieee80211_is_data_present(hdr->frame_control)) | ||
390 | return; | ||
391 | |||
392 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | ||
393 | if (rx->flags & IEEE80211_RX_AMSDU) | ||
394 | hdrlen += ETH_HLEN; | ||
395 | WARN_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3, | ||
396 | "unaligned IP payload at 0x%p\n", rx->skb->data + hdrlen); | ||
397 | } | 384 | } |
398 | 385 | ||
399 | 386 | ||
@@ -476,7 +463,7 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx) | |||
476 | { | 463 | { |
477 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; | 464 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; |
478 | unsigned int hdrlen = ieee80211_hdrlen(hdr->frame_control); | 465 | unsigned int hdrlen = ieee80211_hdrlen(hdr->frame_control); |
479 | char *dev_addr = rx->sdata->dev->dev_addr; | 466 | char *dev_addr = rx->sdata->vif.addr; |
480 | 467 | ||
481 | if (ieee80211_is_data(hdr->frame_control)) { | 468 | if (ieee80211_is_data(hdr->frame_control)) { |
482 | if (is_multicast_ether_addr(hdr->addr1)) { | 469 | if (is_multicast_ether_addr(hdr->addr1)) { |
@@ -1021,10 +1008,10 @@ static void ap_sta_ps_start(struct sta_info *sta) | |||
1021 | 1008 | ||
1022 | atomic_inc(&sdata->bss->num_sta_ps); | 1009 | atomic_inc(&sdata->bss->num_sta_ps); |
1023 | set_sta_flags(sta, WLAN_STA_PS_STA); | 1010 | set_sta_flags(sta, WLAN_STA_PS_STA); |
1024 | drv_sta_notify(local, &sdata->vif, STA_NOTIFY_SLEEP, &sta->sta); | 1011 | drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta); |
1025 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 1012 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
1026 | printk(KERN_DEBUG "%s: STA %pM aid %d enters power save mode\n", | 1013 | printk(KERN_DEBUG "%s: STA %pM aid %d enters power save mode\n", |
1027 | sdata->dev->name, sta->sta.addr, sta->sta.aid); | 1014 | sdata->name, sta->sta.addr, sta->sta.aid); |
1028 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 1015 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
1029 | } | 1016 | } |
1030 | 1017 | ||
@@ -1038,13 +1025,13 @@ static void ap_sta_ps_end(struct sta_info *sta) | |||
1038 | 1025 | ||
1039 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 1026 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
1040 | printk(KERN_DEBUG "%s: STA %pM aid %d exits power save mode\n", | 1027 | printk(KERN_DEBUG "%s: STA %pM aid %d exits power save mode\n", |
1041 | sdata->dev->name, sta->sta.addr, sta->sta.aid); | 1028 | sdata->name, sta->sta.addr, sta->sta.aid); |
1042 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 1029 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
1043 | 1030 | ||
1044 | if (test_sta_flags(sta, WLAN_STA_PS_DRIVER)) { | 1031 | if (test_sta_flags(sta, WLAN_STA_PS_DRIVER)) { |
1045 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 1032 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
1046 | printk(KERN_DEBUG "%s: STA %pM aid %d driver-ps-blocked\n", | 1033 | printk(KERN_DEBUG "%s: STA %pM aid %d driver-ps-blocked\n", |
1047 | sdata->dev->name, sta->sta.addr, sta->sta.aid); | 1034 | sdata->name, sta->sta.addr, sta->sta.aid); |
1048 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 1035 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
1049 | return; | 1036 | return; |
1050 | } | 1037 | } |
@@ -1156,7 +1143,7 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata, | |||
1156 | printk(KERN_DEBUG "%s: RX reassembly removed oldest " | 1143 | printk(KERN_DEBUG "%s: RX reassembly removed oldest " |
1157 | "fragment entry (idx=%d age=%lu seq=%d last_frag=%d " | 1144 | "fragment entry (idx=%d age=%lu seq=%d last_frag=%d " |
1158 | "addr1=%pM addr2=%pM\n", | 1145 | "addr1=%pM addr2=%pM\n", |
1159 | sdata->dev->name, idx, | 1146 | sdata->name, idx, |
1160 | jiffies - entry->first_frag_time, entry->seq, | 1147 | jiffies - entry->first_frag_time, entry->seq, |
1161 | entry->last_frag, hdr->addr1, hdr->addr2); | 1148 | entry->last_frag, hdr->addr1, hdr->addr2); |
1162 | #endif | 1149 | #endif |
@@ -1424,7 +1411,6 @@ static int | |||
1424 | __ieee80211_data_to_8023(struct ieee80211_rx_data *rx) | 1411 | __ieee80211_data_to_8023(struct ieee80211_rx_data *rx) |
1425 | { | 1412 | { |
1426 | struct ieee80211_sub_if_data *sdata = rx->sdata; | 1413 | struct ieee80211_sub_if_data *sdata = rx->sdata; |
1427 | struct net_device *dev = sdata->dev; | ||
1428 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; | 1414 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; |
1429 | 1415 | ||
1430 | if (ieee80211_has_a4(hdr->frame_control) && | 1416 | if (ieee80211_has_a4(hdr->frame_control) && |
@@ -1436,7 +1422,7 @@ __ieee80211_data_to_8023(struct ieee80211_rx_data *rx) | |||
1436 | (sdata->vif.type == NL80211_IFTYPE_STATION && sdata->u.mgd.use_4addr))) | 1422 | (sdata->vif.type == NL80211_IFTYPE_STATION && sdata->u.mgd.use_4addr))) |
1437 | return -1; | 1423 | return -1; |
1438 | 1424 | ||
1439 | return ieee80211_data_to_8023(rx->skb, dev->dev_addr, sdata->vif.type); | 1425 | return ieee80211_data_to_8023(rx->skb, sdata->vif.addr, sdata->vif.type); |
1440 | } | 1426 | } |
1441 | 1427 | ||
1442 | /* | 1428 | /* |
@@ -1453,7 +1439,7 @@ static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx, __le16 fc) | |||
1453 | * of whether the frame was encrypted or not. | 1439 | * of whether the frame was encrypted or not. |
1454 | */ | 1440 | */ |
1455 | if (ehdr->h_proto == htons(ETH_P_PAE) && | 1441 | if (ehdr->h_proto == htons(ETH_P_PAE) && |
1456 | (compare_ether_addr(ehdr->h_dest, rx->sdata->dev->dev_addr) == 0 || | 1442 | (compare_ether_addr(ehdr->h_dest, rx->sdata->vif.addr) == 0 || |
1457 | compare_ether_addr(ehdr->h_dest, pae_group_addr) == 0)) | 1443 | compare_ether_addr(ehdr->h_dest, pae_group_addr) == 0)) |
1458 | return true; | 1444 | return true; |
1459 | 1445 | ||
@@ -1472,7 +1458,6 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) | |||
1472 | { | 1458 | { |
1473 | struct ieee80211_sub_if_data *sdata = rx->sdata; | 1459 | struct ieee80211_sub_if_data *sdata = rx->sdata; |
1474 | struct net_device *dev = sdata->dev; | 1460 | struct net_device *dev = sdata->dev; |
1475 | struct ieee80211_local *local = rx->local; | ||
1476 | struct sk_buff *skb, *xmit_skb; | 1461 | struct sk_buff *skb, *xmit_skb; |
1477 | struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data; | 1462 | struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data; |
1478 | struct sta_info *dsta; | 1463 | struct sta_info *dsta; |
@@ -1495,8 +1480,8 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) | |||
1495 | printk(KERN_DEBUG "%s: failed to clone " | 1480 | printk(KERN_DEBUG "%s: failed to clone " |
1496 | "multicast frame\n", dev->name); | 1481 | "multicast frame\n", dev->name); |
1497 | } else { | 1482 | } else { |
1498 | dsta = sta_info_get(local, skb->data); | 1483 | dsta = sta_info_get(sdata, skb->data); |
1499 | if (dsta && dsta->sdata->dev == dev) { | 1484 | if (dsta) { |
1500 | /* | 1485 | /* |
1501 | * The destination station is associated to | 1486 | * The destination station is associated to |
1502 | * this AP (in this VLAN), so send the frame | 1487 | * this AP (in this VLAN), so send the frame |
@@ -1512,7 +1497,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) | |||
1512 | if (skb) { | 1497 | if (skb) { |
1513 | int align __maybe_unused; | 1498 | int align __maybe_unused; |
1514 | 1499 | ||
1515 | #if defined(CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT) || !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | 1500 | #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS |
1516 | /* | 1501 | /* |
1517 | * 'align' will only take the values 0 or 2 here | 1502 | * 'align' will only take the values 0 or 2 here |
1518 | * since all frames are required to be aligned | 1503 | * since all frames are required to be aligned |
@@ -1556,16 +1541,10 @@ static ieee80211_rx_result debug_noinline | |||
1556 | ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) | 1541 | ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) |
1557 | { | 1542 | { |
1558 | struct net_device *dev = rx->sdata->dev; | 1543 | struct net_device *dev = rx->sdata->dev; |
1559 | struct ieee80211_local *local = rx->local; | 1544 | struct sk_buff *skb = rx->skb; |
1560 | u16 ethertype; | ||
1561 | u8 *payload; | ||
1562 | struct sk_buff *skb = rx->skb, *frame = NULL; | ||
1563 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1545 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1564 | __le16 fc = hdr->frame_control; | 1546 | __le16 fc = hdr->frame_control; |
1565 | const struct ethhdr *eth; | 1547 | struct sk_buff_head frame_list; |
1566 | int remaining, err; | ||
1567 | u8 dst[ETH_ALEN]; | ||
1568 | u8 src[ETH_ALEN]; | ||
1569 | 1548 | ||
1570 | if (unlikely(!ieee80211_is_data(fc))) | 1549 | if (unlikely(!ieee80211_is_data(fc))) |
1571 | return RX_CONTINUE; | 1550 | return RX_CONTINUE; |
@@ -1576,94 +1555,34 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) | |||
1576 | if (!(rx->flags & IEEE80211_RX_AMSDU)) | 1555 | if (!(rx->flags & IEEE80211_RX_AMSDU)) |
1577 | return RX_CONTINUE; | 1556 | return RX_CONTINUE; |
1578 | 1557 | ||
1579 | err = __ieee80211_data_to_8023(rx); | 1558 | if (ieee80211_has_a4(hdr->frame_control) && |
1580 | if (unlikely(err)) | 1559 | rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && |
1560 | !rx->sdata->u.vlan.sta) | ||
1581 | return RX_DROP_UNUSABLE; | 1561 | return RX_DROP_UNUSABLE; |
1582 | 1562 | ||
1583 | skb->dev = dev; | 1563 | if (is_multicast_ether_addr(hdr->addr1) && |
1584 | 1564 | ((rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && | |
1585 | dev->stats.rx_packets++; | 1565 | rx->sdata->u.vlan.sta) || |
1586 | dev->stats.rx_bytes += skb->len; | 1566 | (rx->sdata->vif.type == NL80211_IFTYPE_STATION && |
1587 | 1567 | rx->sdata->u.mgd.use_4addr))) | |
1588 | /* skip the wrapping header */ | ||
1589 | eth = (struct ethhdr *) skb_pull(skb, sizeof(struct ethhdr)); | ||
1590 | if (!eth) | ||
1591 | return RX_DROP_UNUSABLE; | 1568 | return RX_DROP_UNUSABLE; |
1592 | 1569 | ||
1593 | while (skb != frame) { | 1570 | skb->dev = dev; |
1594 | u8 padding; | 1571 | __skb_queue_head_init(&frame_list); |
1595 | __be16 len = eth->h_proto; | ||
1596 | unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len); | ||
1597 | |||
1598 | remaining = skb->len; | ||
1599 | memcpy(dst, eth->h_dest, ETH_ALEN); | ||
1600 | memcpy(src, eth->h_source, ETH_ALEN); | ||
1601 | |||
1602 | padding = ((4 - subframe_len) & 0x3); | ||
1603 | /* the last MSDU has no padding */ | ||
1604 | if (subframe_len > remaining) | ||
1605 | return RX_DROP_UNUSABLE; | ||
1606 | 1572 | ||
1607 | skb_pull(skb, sizeof(struct ethhdr)); | 1573 | ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr, |
1608 | /* if last subframe reuse skb */ | 1574 | rx->sdata->vif.type, |
1609 | if (remaining <= subframe_len + padding) | 1575 | rx->local->hw.extra_tx_headroom); |
1610 | frame = skb; | ||
1611 | else { | ||
1612 | /* | ||
1613 | * Allocate and reserve two bytes more for payload | ||
1614 | * alignment since sizeof(struct ethhdr) is 14. | ||
1615 | */ | ||
1616 | frame = dev_alloc_skb( | ||
1617 | ALIGN(local->hw.extra_tx_headroom, 4) + | ||
1618 | subframe_len + 2); | ||
1619 | |||
1620 | if (frame == NULL) | ||
1621 | return RX_DROP_UNUSABLE; | ||
1622 | |||
1623 | skb_reserve(frame, | ||
1624 | ALIGN(local->hw.extra_tx_headroom, 4) + | ||
1625 | sizeof(struct ethhdr) + 2); | ||
1626 | memcpy(skb_put(frame, ntohs(len)), skb->data, | ||
1627 | ntohs(len)); | ||
1628 | |||
1629 | eth = (struct ethhdr *) skb_pull(skb, ntohs(len) + | ||
1630 | padding); | ||
1631 | if (!eth) { | ||
1632 | dev_kfree_skb(frame); | ||
1633 | return RX_DROP_UNUSABLE; | ||
1634 | } | ||
1635 | } | ||
1636 | 1576 | ||
1637 | skb_reset_network_header(frame); | 1577 | while (!skb_queue_empty(&frame_list)) { |
1638 | frame->dev = dev; | 1578 | rx->skb = __skb_dequeue(&frame_list); |
1639 | frame->priority = skb->priority; | ||
1640 | rx->skb = frame; | ||
1641 | |||
1642 | payload = frame->data; | ||
1643 | ethertype = (payload[6] << 8) | payload[7]; | ||
1644 | |||
1645 | if (likely((compare_ether_addr(payload, rfc1042_header) == 0 && | ||
1646 | ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || | ||
1647 | compare_ether_addr(payload, | ||
1648 | bridge_tunnel_header) == 0)) { | ||
1649 | /* remove RFC1042 or Bridge-Tunnel | ||
1650 | * encapsulation and replace EtherType */ | ||
1651 | skb_pull(frame, 6); | ||
1652 | memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN); | ||
1653 | memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN); | ||
1654 | } else { | ||
1655 | memcpy(skb_push(frame, sizeof(__be16)), | ||
1656 | &len, sizeof(__be16)); | ||
1657 | memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN); | ||
1658 | memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN); | ||
1659 | } | ||
1660 | 1579 | ||
1661 | if (!ieee80211_frame_allowed(rx, fc)) { | 1580 | if (!ieee80211_frame_allowed(rx, fc)) { |
1662 | if (skb == frame) /* last frame */ | 1581 | dev_kfree_skb(rx->skb); |
1663 | return RX_DROP_UNUSABLE; | ||
1664 | dev_kfree_skb(frame); | ||
1665 | continue; | 1582 | continue; |
1666 | } | 1583 | } |
1584 | dev->stats.rx_packets++; | ||
1585 | dev->stats.rx_bytes += rx->skb->len; | ||
1667 | 1586 | ||
1668 | ieee80211_deliver_skb(rx); | 1587 | ieee80211_deliver_skb(rx); |
1669 | } | 1588 | } |
@@ -1721,7 +1640,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1721 | 1640 | ||
1722 | /* Frame has reached destination. Don't forward */ | 1641 | /* Frame has reached destination. Don't forward */ |
1723 | if (!is_multicast_ether_addr(hdr->addr1) && | 1642 | if (!is_multicast_ether_addr(hdr->addr1) && |
1724 | compare_ether_addr(sdata->dev->dev_addr, hdr->addr3) == 0) | 1643 | compare_ether_addr(sdata->vif.addr, hdr->addr3) == 0) |
1725 | return RX_CONTINUE; | 1644 | return RX_CONTINUE; |
1726 | 1645 | ||
1727 | mesh_hdr->ttl--; | 1646 | mesh_hdr->ttl--; |
@@ -1738,10 +1657,10 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1738 | 1657 | ||
1739 | if (!fwd_skb && net_ratelimit()) | 1658 | if (!fwd_skb && net_ratelimit()) |
1740 | printk(KERN_DEBUG "%s: failed to clone mesh frame\n", | 1659 | printk(KERN_DEBUG "%s: failed to clone mesh frame\n", |
1741 | sdata->dev->name); | 1660 | sdata->name); |
1742 | 1661 | ||
1743 | fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; | 1662 | fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; |
1744 | memcpy(fwd_hdr->addr2, sdata->dev->dev_addr, ETH_ALEN); | 1663 | memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); |
1745 | info = IEEE80211_SKB_CB(fwd_skb); | 1664 | info = IEEE80211_SKB_CB(fwd_skb); |
1746 | memset(info, 0, sizeof(*info)); | 1665 | memset(info, 0, sizeof(*info)); |
1747 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; | 1666 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; |
@@ -1870,7 +1789,7 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata, | |||
1870 | struct sk_buff *skb; | 1789 | struct sk_buff *skb; |
1871 | struct ieee80211_mgmt *resp; | 1790 | struct ieee80211_mgmt *resp; |
1872 | 1791 | ||
1873 | if (compare_ether_addr(mgmt->da, sdata->dev->dev_addr) != 0) { | 1792 | if (compare_ether_addr(mgmt->da, sdata->vif.addr) != 0) { |
1874 | /* Not to own unicast address */ | 1793 | /* Not to own unicast address */ |
1875 | return; | 1794 | return; |
1876 | } | 1795 | } |
@@ -1894,7 +1813,7 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata, | |||
1894 | resp = (struct ieee80211_mgmt *) skb_put(skb, 24); | 1813 | resp = (struct ieee80211_mgmt *) skb_put(skb, 24); |
1895 | memset(resp, 0, 24); | 1814 | memset(resp, 0, 24); |
1896 | memcpy(resp->da, mgmt->sa, ETH_ALEN); | 1815 | memcpy(resp->da, mgmt->sa, ETH_ALEN); |
1897 | memcpy(resp->sa, sdata->dev->dev_addr, ETH_ALEN); | 1816 | memcpy(resp->sa, sdata->vif.addr, ETH_ALEN); |
1898 | memcpy(resp->bssid, sdata->u.mgd.bssid, ETH_ALEN); | 1817 | memcpy(resp->bssid, sdata->u.mgd.bssid, ETH_ALEN); |
1899 | resp->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 1818 | resp->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
1900 | IEEE80211_STYPE_ACTION); | 1819 | IEEE80211_STYPE_ACTION); |
@@ -2274,7 +2193,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
2274 | if (!bssid && !sdata->u.mgd.use_4addr) | 2193 | if (!bssid && !sdata->u.mgd.use_4addr) |
2275 | return 0; | 2194 | return 0; |
2276 | if (!multicast && | 2195 | if (!multicast && |
2277 | compare_ether_addr(sdata->dev->dev_addr, hdr->addr1) != 0) { | 2196 | compare_ether_addr(sdata->vif.addr, hdr->addr1) != 0) { |
2278 | if (!(sdata->dev->flags & IFF_PROMISC)) | 2197 | if (!(sdata->dev->flags & IFF_PROMISC)) |
2279 | return 0; | 2198 | return 0; |
2280 | rx->flags &= ~IEEE80211_RX_RA_MATCH; | 2199 | rx->flags &= ~IEEE80211_RX_RA_MATCH; |
@@ -2291,7 +2210,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
2291 | return 0; | 2210 | return 0; |
2292 | rx->flags &= ~IEEE80211_RX_RA_MATCH; | 2211 | rx->flags &= ~IEEE80211_RX_RA_MATCH; |
2293 | } else if (!multicast && | 2212 | } else if (!multicast && |
2294 | compare_ether_addr(sdata->dev->dev_addr, | 2213 | compare_ether_addr(sdata->vif.addr, |
2295 | hdr->addr1) != 0) { | 2214 | hdr->addr1) != 0) { |
2296 | if (!(sdata->dev->flags & IFF_PROMISC)) | 2215 | if (!(sdata->dev->flags & IFF_PROMISC)) |
2297 | return 0; | 2216 | return 0; |
@@ -2308,7 +2227,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
2308 | break; | 2227 | break; |
2309 | case NL80211_IFTYPE_MESH_POINT: | 2228 | case NL80211_IFTYPE_MESH_POINT: |
2310 | if (!multicast && | 2229 | if (!multicast && |
2311 | compare_ether_addr(sdata->dev->dev_addr, | 2230 | compare_ether_addr(sdata->vif.addr, |
2312 | hdr->addr1) != 0) { | 2231 | hdr->addr1) != 0) { |
2313 | if (!(sdata->dev->flags & IFF_PROMISC)) | 2232 | if (!(sdata->dev->flags & IFF_PROMISC)) |
2314 | return 0; | 2233 | return 0; |
@@ -2319,11 +2238,11 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
2319 | case NL80211_IFTYPE_AP_VLAN: | 2238 | case NL80211_IFTYPE_AP_VLAN: |
2320 | case NL80211_IFTYPE_AP: | 2239 | case NL80211_IFTYPE_AP: |
2321 | if (!bssid) { | 2240 | if (!bssid) { |
2322 | if (compare_ether_addr(sdata->dev->dev_addr, | 2241 | if (compare_ether_addr(sdata->vif.addr, |
2323 | hdr->addr1)) | 2242 | hdr->addr1)) |
2324 | return 0; | 2243 | return 0; |
2325 | } else if (!ieee80211_bssid_match(bssid, | 2244 | } else if (!ieee80211_bssid_match(bssid, |
2326 | sdata->dev->dev_addr)) { | 2245 | sdata->vif.addr)) { |
2327 | if (!(rx->flags & IEEE80211_RX_IN_SCAN)) | 2246 | if (!(rx->flags & IEEE80211_RX_IN_SCAN)) |
2328 | return 0; | 2247 | return 0; |
2329 | rx->flags &= ~IEEE80211_RX_RA_MATCH; | 2248 | rx->flags &= ~IEEE80211_RX_RA_MATCH; |
@@ -2362,6 +2281,8 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
2362 | int prepares; | 2281 | int prepares; |
2363 | struct ieee80211_sub_if_data *prev = NULL; | 2282 | struct ieee80211_sub_if_data *prev = NULL; |
2364 | struct sk_buff *skb_new; | 2283 | struct sk_buff *skb_new; |
2284 | struct sta_info *sta, *tmp; | ||
2285 | bool found_sta = false; | ||
2365 | 2286 | ||
2366 | hdr = (struct ieee80211_hdr *)skb->data; | 2287 | hdr = (struct ieee80211_hdr *)skb->data; |
2367 | memset(&rx, 0, sizeof(rx)); | 2288 | memset(&rx, 0, sizeof(rx)); |
@@ -2378,68 +2299,76 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
2378 | ieee80211_parse_qos(&rx); | 2299 | ieee80211_parse_qos(&rx); |
2379 | ieee80211_verify_alignment(&rx); | 2300 | ieee80211_verify_alignment(&rx); |
2380 | 2301 | ||
2381 | rx.sta = sta_info_get(local, hdr->addr2); | 2302 | if (ieee80211_is_data(hdr->frame_control)) { |
2382 | if (rx.sta) | 2303 | for_each_sta_info(local, hdr->addr2, sta, tmp) { |
2383 | rx.sdata = rx.sta->sdata; | 2304 | rx.sta = sta; |
2384 | 2305 | found_sta = true; | |
2385 | if (rx.sdata && ieee80211_is_data(hdr->frame_control)) { | 2306 | rx.sdata = sta->sdata; |
2386 | rx.flags |= IEEE80211_RX_RA_MATCH; | 2307 | |
2387 | prepares = prepare_for_handlers(rx.sdata, &rx, hdr); | 2308 | rx.flags |= IEEE80211_RX_RA_MATCH; |
2388 | if (prepares) { | 2309 | prepares = prepare_for_handlers(rx.sdata, &rx, hdr); |
2389 | if (status->flag & RX_FLAG_MMIC_ERROR) { | 2310 | if (prepares) { |
2390 | if (rx.flags & IEEE80211_RX_RA_MATCH) | 2311 | if (status->flag & RX_FLAG_MMIC_ERROR) { |
2391 | ieee80211_rx_michael_mic_report(hdr, &rx); | 2312 | if (rx.flags & IEEE80211_RX_RA_MATCH) |
2392 | } else | 2313 | ieee80211_rx_michael_mic_report(hdr, &rx); |
2393 | prev = rx.sdata; | 2314 | } else |
2315 | prev = rx.sdata; | ||
2316 | } | ||
2394 | } | 2317 | } |
2395 | } else list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 2318 | } |
2396 | if (!netif_running(sdata->dev)) | 2319 | if (!found_sta) { |
2397 | continue; | 2320 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
2321 | if (!netif_running(sdata->dev)) | ||
2322 | continue; | ||
2398 | 2323 | ||
2399 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR || | 2324 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR || |
2400 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 2325 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
2401 | continue; | 2326 | continue; |
2402 | 2327 | ||
2403 | rx.flags |= IEEE80211_RX_RA_MATCH; | 2328 | rx.sta = sta_info_get(sdata, hdr->addr2); |
2404 | prepares = prepare_for_handlers(sdata, &rx, hdr); | ||
2405 | 2329 | ||
2406 | if (!prepares) | 2330 | rx.flags |= IEEE80211_RX_RA_MATCH; |
2407 | continue; | 2331 | prepares = prepare_for_handlers(sdata, &rx, hdr); |
2408 | 2332 | ||
2409 | if (status->flag & RX_FLAG_MMIC_ERROR) { | 2333 | if (!prepares) |
2410 | rx.sdata = sdata; | 2334 | continue; |
2411 | if (rx.flags & IEEE80211_RX_RA_MATCH) | ||
2412 | ieee80211_rx_michael_mic_report(hdr, &rx); | ||
2413 | continue; | ||
2414 | } | ||
2415 | 2335 | ||
2416 | /* | 2336 | if (status->flag & RX_FLAG_MMIC_ERROR) { |
2417 | * frame is destined for this interface, but if it's not | 2337 | rx.sdata = sdata; |
2418 | * also for the previous one we handle that after the | 2338 | if (rx.flags & IEEE80211_RX_RA_MATCH) |
2419 | * loop to avoid copying the SKB once too much | 2339 | ieee80211_rx_michael_mic_report(hdr, |
2420 | */ | 2340 | &rx); |
2341 | continue; | ||
2342 | } | ||
2421 | 2343 | ||
2422 | if (!prev) { | 2344 | /* |
2423 | prev = sdata; | 2345 | * frame is destined for this interface, but if it's |
2424 | continue; | 2346 | * not also for the previous one we handle that after |
2425 | } | 2347 | * the loop to avoid copying the SKB once too much |
2348 | */ | ||
2426 | 2349 | ||
2427 | /* | 2350 | if (!prev) { |
2428 | * frame was destined for the previous interface | 2351 | prev = sdata; |
2429 | * so invoke RX handlers for it | 2352 | continue; |
2430 | */ | 2353 | } |
2431 | 2354 | ||
2432 | skb_new = skb_copy(skb, GFP_ATOMIC); | 2355 | /* |
2433 | if (!skb_new) { | 2356 | * frame was destined for the previous interface |
2434 | if (net_ratelimit()) | 2357 | * so invoke RX handlers for it |
2435 | printk(KERN_DEBUG "%s: failed to copy " | 2358 | */ |
2436 | "multicast frame for %s\n", | 2359 | |
2437 | wiphy_name(local->hw.wiphy), | 2360 | skb_new = skb_copy(skb, GFP_ATOMIC); |
2438 | prev->dev->name); | 2361 | if (!skb_new) { |
2439 | continue; | 2362 | if (net_ratelimit()) |
2363 | printk(KERN_DEBUG "%s: failed to copy " | ||
2364 | "multicast frame for %s\n", | ||
2365 | wiphy_name(local->hw.wiphy), | ||
2366 | prev->name); | ||
2367 | continue; | ||
2368 | } | ||
2369 | ieee80211_invoke_rx_handlers(prev, &rx, skb_new, rate); | ||
2370 | prev = sdata; | ||
2440 | } | 2371 | } |
2441 | ieee80211_invoke_rx_handlers(prev, &rx, skb_new, rate); | ||
2442 | prev = sdata; | ||
2443 | } | 2372 | } |
2444 | if (prev) | 2373 | if (prev) |
2445 | ieee80211_invoke_rx_handlers(prev, &rx, skb, rate); | 2374 | ieee80211_invoke_rx_handlers(prev, &rx, skb, rate); |