~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to net/mac80211/rx.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
143
143
        if (status->flag & RX_FLAG_HT) {
144
144
                /*
145
145
                 * MCS information is a separate field in radiotap,
146
 
                 * added below.
 
146
                 * added below. The byte here is needed as padding
 
147
                 * for the channel though, so initialise it to 0.
147
148
                 */
148
149
                *pos = 0;
149
150
        } else {
403
404
        struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb);
404
405
        struct sk_buff *skb = rx->skb;
405
406
 
406
 
        if (likely(!(status->rx_flags & IEEE80211_RX_IN_SCAN)))
 
407
        if (likely(!(status->rx_flags & IEEE80211_RX_IN_SCAN) &&
 
408
                   !local->sched_scanning))
407
409
                return RX_CONTINUE;
408
410
 
409
411
        if (test_bit(SCAN_HW_SCANNING, &local->scanning) ||
410
 
            test_bit(SCAN_SW_SCANNING, &local->scanning))
 
412
            test_bit(SCAN_SW_SCANNING, &local->scanning) ||
 
413
            local->sched_scanning)
411
414
                return ieee80211_scan_rx(rx->sdata, skb);
412
415
 
413
416
        /* scanning finished during invoking of handlers */
487
490
         * establisment frame, beacon or probe, drop the frame.
488
491
         */
489
492
 
490
 
        if (!rx->sta || sta_plink_state(rx->sta) != PLINK_ESTAB) {
 
493
        if (!rx->sta || sta_plink_state(rx->sta) != NL80211_PLINK_ESTAB) {
491
494
                struct ieee80211_mgmt *mgmt;
492
495
 
493
496
                if (!ieee80211_is_mgmt(hdr->frame_control))
494
497
                        return RX_DROP_MONITOR;
495
498
 
496
499
                if (ieee80211_is_action(hdr->frame_control)) {
 
500
                        u8 category;
497
501
                        mgmt = (struct ieee80211_mgmt *)hdr;
498
 
                        if (mgmt->u.action.category != WLAN_CATEGORY_MESH_PLINK)
 
502
                        category = mgmt->u.action.category;
 
503
                        if (category != WLAN_CATEGORY_MESH_ACTION &&
 
504
                                category != WLAN_CATEGORY_SELF_PROTECTED)
499
505
                                return RX_DROP_MONITOR;
500
506
                        return RX_CONTINUE;
501
507
                }
502
508
 
503
509
                if (ieee80211_is_probe_req(hdr->frame_control) ||
504
510
                    ieee80211_is_probe_resp(hdr->frame_control) ||
505
 
                    ieee80211_is_beacon(hdr->frame_control))
 
511
                    ieee80211_is_beacon(hdr->frame_control) ||
 
512
                    ieee80211_is_auth(hdr->frame_control))
506
513
                        return RX_CONTINUE;
507
514
 
508
515
                return RX_DROP_MONITOR;
650
657
 set_release_timer:
651
658
 
652
659
                mod_timer(&tid_agg_rx->reorder_timer,
653
 
                          tid_agg_rx->reorder_time[j] +
 
660
                          tid_agg_rx->reorder_time[j] + 1 +
654
661
                          HT_RX_REORDER_BUF_TIMEOUT);
655
662
        } else {
656
663
                del_timer(&tid_agg_rx->reorder_timer);
707
714
        /*
708
715
         * If the current MPDU is in the right order and nothing else
709
716
         * is stored we can process it directly, no need to buffer it.
 
717
         * If it is first but there's something stored, we may be able
 
718
         * to release frames after this one.
710
719
         */
711
720
        if (mpdu_seq_num == tid_agg_rx->head_seq_num &&
712
721
            tid_agg_rx->stored_mpdu_num == 0) {
1583
1592
}
1584
1593
 
1585
1594
static int
1586
 
__ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
 
1595
__ieee80211_data_to_8023(struct ieee80211_rx_data *rx, bool *port_control)
1587
1596
{
1588
1597
        struct ieee80211_sub_if_data *sdata = rx->sdata;
1589
1598
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
1591
1600
        struct ethhdr *ehdr;
1592
1601
        int ret;
1593
1602
 
 
1603
        *port_control = false;
1594
1604
        if (ieee80211_has_a4(hdr->frame_control) &&
1595
1605
            sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta)
1596
1606
                return -1;
1609
1619
                return -1;
1610
1620
 
1611
1621
        ret = ieee80211_data_to_8023(rx->skb, sdata->vif.addr, sdata->vif.type);
1612
 
        if (ret < 0 || !check_port_control)
 
1622
        if (ret < 0)
1613
1623
                return ret;
1614
1624
 
1615
1625
        ehdr = (struct ethhdr *) rx->skb->data;
1616
 
        if (ehdr->h_proto != rx->sdata->control_port_protocol)
 
1626
        if (ehdr->h_proto == rx->sdata->control_port_protocol)
 
1627
                *port_control = true;
 
1628
        else if (check_port_control)
1617
1629
                return -1;
1618
1630
 
1619
1631
        return 0;
1771
1783
 
1772
1784
        ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr,
1773
1785
                                 rx->sdata->vif.type,
1774
 
                                 rx->local->hw.extra_tx_headroom);
 
1786
                                 rx->local->hw.extra_tx_headroom, true);
1775
1787
 
1776
1788
        while (!skb_queue_empty(&frame_list)) {
1777
1789
                rx->skb = __skb_dequeue(&frame_list);
1914
1926
        struct net_device *dev = sdata->dev;
1915
1927
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
1916
1928
        __le16 fc = hdr->frame_control;
 
1929
        bool port_control;
1917
1930
        int err;
1918
1931
 
1919
1932
        if (unlikely(!ieee80211_is_data(hdr->frame_control)))
1930
1943
            sdata->vif.type == NL80211_IFTYPE_AP)
1931
1944
                return RX_DROP_MONITOR;
1932
1945
 
1933
 
        err = __ieee80211_data_to_8023(rx);
 
1946
        err = __ieee80211_data_to_8023(rx, &port_control);
1934
1947
        if (unlikely(err))
1935
1948
                return RX_DROP_UNUSABLE;
1936
1949
 
1937
1950
        if (!ieee80211_frame_allowed(rx, fc))
1938
1951
                return RX_DROP_MONITOR;
1939
1952
 
 
1953
        if (rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
 
1954
            unlikely(port_control) && sdata->bss) {
 
1955
                sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
 
1956
                                     u.ap);
 
1957
                dev = sdata->dev;
 
1958
                rx->sdata = sdata;
 
1959
        }
 
1960
 
1940
1961
        rx->skb->dev = dev;
1941
1962
 
1942
1963
        dev->stats.rx_packets++;
2189
2210
                        goto handled;
2190
2211
                }
2191
2212
                break;
2192
 
        case WLAN_CATEGORY_MESH_PLINK:
 
2213
        case WLAN_CATEGORY_MESH_ACTION:
2193
2214
                if (!ieee80211_vif_is_mesh(&sdata->vif))
2194
2215
                        break;
2195
2216
                goto queue;
2352
2373
        return RX_QUEUED;
2353
2374
}
2354
2375
 
2355
 
static void ieee80211_rx_michael_mic_report(struct ieee80211_hdr *hdr,
2356
 
                                            struct ieee80211_rx_data *rx)
2357
 
{
2358
 
        int keyidx;
2359
 
        unsigned int hdrlen;
2360
 
 
2361
 
        hdrlen = ieee80211_hdrlen(hdr->frame_control);
2362
 
        if (rx->skb->len >= hdrlen + 4)
2363
 
                keyidx = rx->skb->data[hdrlen + 3] >> 6;
2364
 
        else
2365
 
                keyidx = -1;
2366
 
 
2367
 
        if (!rx->sta) {
2368
 
                /*
2369
 
                 * Some hardware seem to generate incorrect Michael MIC
2370
 
                 * reports; ignore them to avoid triggering countermeasures.
2371
 
                 */
2372
 
                return;
2373
 
        }
2374
 
 
2375
 
        if (!ieee80211_has_protected(hdr->frame_control))
2376
 
                return;
2377
 
 
2378
 
        if (rx->sdata->vif.type == NL80211_IFTYPE_AP && keyidx) {
2379
 
                /*
2380
 
                 * APs with pairwise keys should never receive Michael MIC
2381
 
                 * errors for non-zero keyidx because these are reserved for
2382
 
                 * group keys and only the AP is sending real multicast
2383
 
                 * frames in the BSS.
2384
 
                 */
2385
 
                return;
2386
 
        }
2387
 
 
2388
 
        if (!ieee80211_is_data(hdr->frame_control) &&
2389
 
            !ieee80211_is_auth(hdr->frame_control))
2390
 
                return;
2391
 
 
2392
 
        mac80211_ev_michael_mic_failure(rx->sdata, keyidx, hdr, NULL,
2393
 
                                        GFP_ATOMIC);
2394
 
}
2395
 
 
2396
2376
/* TODO: use IEEE80211_RX_FRAGMENTED */
2397
2377
static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
2398
2378
                                        struct ieee80211_rate *rate)
2736
2716
        if (!prepares)
2737
2717
                return false;
2738
2718
 
2739
 
        if (status->flag & RX_FLAG_MMIC_ERROR) {
2740
 
                if (status->rx_flags & IEEE80211_RX_RA_MATCH)
2741
 
                        ieee80211_rx_michael_mic_report(hdr, rx);
2742
 
                return false;
2743
 
        }
2744
 
 
2745
2719
        if (!consume) {
2746
2720
                skb = skb_copy(skb, GFP_ATOMIC);
2747
2721
                if (!skb) {