ath9k: add a temporary uci option for setting the channel bandwidth
[openwrt.git] / package / mac80211 / patches / 550-ath9k_mmic_verify.patch
1 --- a/drivers/net/wireless/ath/ath9k/recv.c
2 +++ b/drivers/net/wireless/ath/ath9k/recv.c
3 @@ -814,16 +814,17 @@ static bool ath9k_rx_accept(struct ath_c
4 struct ath_rx_status *rx_stats,
5 bool *decrypt_error)
6 {
7 -#define is_mc_or_valid_tkip_keyix ((is_mc || \
8 - (rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID && \
9 - test_bit(rx_stats->rs_keyix, common->tkip_keymap))))
10 -
11 + bool is_mc, is_valid_tkip, mic_error = false;
12 struct ath_hw *ah = common->ah;
13 __le16 fc;
14 u8 rx_status_len = ah->caps.rx_status_len;
15
16 fc = hdr->frame_control;
17
18 + is_mc = !!is_multicast_ether_addr(hdr->addr1);
19 + is_valid_tkip = rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID &&
20 + test_bit(rx_stats->rs_keyix, common->tkip_keymap);
21 +
22 if (!rx_stats->rs_datalen)
23 return false;
24 /*
25 @@ -853,19 +854,19 @@ static bool ath9k_rx_accept(struct ath_c
26 if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) {
27 *decrypt_error = true;
28 } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) {
29 - bool is_mc;
30 /*
31 * The MIC error bit is only valid if the frame
32 * is not a control frame or fragment, and it was
33 - * decrypted using a valid TKIP key.
34 + * decrypted using a valid TKIP key. For multicast
35 + * frames the hardware will not return a valid
36 + * key index, so accept the MIC bit for those
37 + * as well.
38 */
39 - is_mc = !!is_multicast_ether_addr(hdr->addr1);
40 -
41 if (!ieee80211_is_ctl(fc) &&
42 !ieee80211_has_morefrags(fc) &&
43 !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) &&
44 - is_mc_or_valid_tkip_keyix)
45 - rxs->flag |= RX_FLAG_MMIC_ERROR;
46 + (is_mc || is_valid_tkip))
47 + mic_error = true;
48 else
49 rx_stats->rs_status &= ~ATH9K_RXERR_MIC;
50 }
51 @@ -886,6 +887,22 @@ static bool ath9k_rx_accept(struct ath_c
52 }
53 }
54 }
55 +
56 + /*
57 + * For unicast frames the MIC error bit can have false positives,
58 + * so all MIC error reports need to be validated in software.
59 + * False negatives are not common, so skip software verification
60 + * if the hardware considers the MIC valid.
61 + */
62 + if (is_valid_tkip && ieee80211_is_data_present(hdr->frame_control) &&
63 + !(rx_stats->rs_status & (ATH9K_RXERR_DECRYPT | ATH9K_RXERR_CRC |
64 + ATH9K_RXERR_MIC))) {
65 + /* Strip the Michael MIC */
66 + rx_stats->rs_datalen -= 8;
67 + rxs->flag |= RX_FLAG_MMIC_STRIPPED;
68 + } else if (is_mc && mic_error) {
69 + rxs->flag |= RX_FLAG_MMIC_ERROR;
70 + }
71 return true;
72 }
73
This page took 0.059447 seconds and 5 git commands to generate.