diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-09-14 11:10:25 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:49:27 -0400 |
commit | 7848ba7d7a010ccb265617fc2bc053e2bdf06f48 (patch) | |
tree | 844da4a4d796d817b0040b284ddeaa320446eaab /net/mac80211/rx.c | |
parent | b708e610622cff07f4374a2b4410884f964b8489 (diff) |
[MAC80211]: rework hardware crypto flags
This patch reworks the various hardware crypto related
flags to make them more local, i.e. put them with each
key or each packet instead of into the hw struct.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r-- | net/mac80211/rx.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 8c6e29089216..28b8b6af4c42 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -363,7 +363,8 @@ ieee80211_rx_h_load_key(struct ieee80211_txrx_data *rx) | |||
363 | * we somehow allow the driver to tell us which key | 363 | * we somehow allow the driver to tell us which key |
364 | * the hardware used if this flag is set? | 364 | * the hardware used if this flag is set? |
365 | */ | 365 | */ |
366 | if (!(rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV)) | 366 | if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && |
367 | (rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED)) | ||
367 | return TXRX_CONTINUE; | 368 | return TXRX_CONTINUE; |
368 | 369 | ||
369 | hdrlen = ieee80211_get_hdrlen(rx->fc); | 370 | hdrlen = ieee80211_get_hdrlen(rx->fc); |
@@ -534,8 +535,8 @@ ieee80211_rx_h_wep_weak_iv_detection(struct ieee80211_txrx_data *rx) | |||
534 | return TXRX_CONTINUE; | 535 | return TXRX_CONTINUE; |
535 | 536 | ||
536 | /* Check for weak IVs, if hwaccel did not remove IV from the frame */ | 537 | /* Check for weak IVs, if hwaccel did not remove IV from the frame */ |
537 | if ((rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV) || | 538 | if (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED) || |
538 | !(rx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) | 539 | !(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) |
539 | if (ieee80211_wep_is_weak_iv(rx->skb, rx->key)) | 540 | if (ieee80211_wep_is_weak_iv(rx->skb, rx->key)) |
540 | rx->sta->wep_weak_iv_count++; | 541 | rx->sta->wep_weak_iv_count++; |
541 | 542 | ||
@@ -559,15 +560,14 @@ ieee80211_rx_h_wep_decrypt(struct ieee80211_txrx_data *rx) | |||
559 | return TXRX_DROP; | 560 | return TXRX_DROP; |
560 | } | 561 | } |
561 | 562 | ||
562 | if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED) || | 563 | if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) { |
563 | !(rx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) { | ||
564 | if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) { | 564 | if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) { |
565 | if (net_ratelimit()) | 565 | if (net_ratelimit()) |
566 | printk(KERN_DEBUG "%s: RX WEP frame, decrypt " | 566 | printk(KERN_DEBUG "%s: RX WEP frame, decrypt " |
567 | "failed\n", rx->dev->name); | 567 | "failed\n", rx->dev->name); |
568 | return TXRX_DROP; | 568 | return TXRX_DROP; |
569 | } | 569 | } |
570 | } else if (rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV) { | 570 | } else if (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED)) { |
571 | ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key); | 571 | ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key); |
572 | /* remove ICV */ | 572 | /* remove ICV */ |
573 | skb_trim(rx->skb, rx->skb->len - 4); | 573 | skb_trim(rx->skb, rx->skb->len - 4); |
@@ -898,13 +898,10 @@ static ieee80211_txrx_result | |||
898 | ieee80211_rx_h_drop_unencrypted(struct ieee80211_txrx_data *rx) | 898 | ieee80211_rx_h_drop_unencrypted(struct ieee80211_txrx_data *rx) |
899 | { | 899 | { |
900 | /* | 900 | /* |
901 | * Pass through unencrypted frames if the hardware might have | 901 | * Pass through unencrypted frames if the hardware has |
902 | * decrypted them already without telling us, but that can only | 902 | * decrypted them already. |
903 | * be true if we either didn't find a key or the found key is | ||
904 | * uploaded to the hardware. | ||
905 | */ | 903 | */ |
906 | if ((rx->local->hw.flags & IEEE80211_HW_DEVICE_HIDES_WEP) && | 904 | if (rx->u.rx.status->flag & RX_FLAG_DECRYPTED) |
907 | (!rx->key || (rx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE))) | ||
908 | return TXRX_CONTINUE; | 905 | return TXRX_CONTINUE; |
909 | 906 | ||
910 | /* Drop unencrypted frames if key is set. */ | 907 | /* Drop unencrypted frames if key is set. */ |
@@ -1212,8 +1209,7 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev, | |||
1212 | goto ignore; | 1209 | goto ignore; |
1213 | } | 1210 | } |
1214 | 1211 | ||
1215 | if ((rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV) && | 1212 | if (rx->sdata->type == IEEE80211_IF_TYPE_AP && keyidx) { |
1216 | rx->sdata->type == IEEE80211_IF_TYPE_AP && keyidx) { | ||
1217 | /* AP with Pairwise keys support should never receive Michael | 1213 | /* AP with Pairwise keys support should never receive Michael |
1218 | * MIC errors for non-zero keyidx because these are reserved | 1214 | * MIC errors for non-zero keyidx because these are reserved |
1219 | * for group keys and only the AP is sending real multicast | 1215 | * for group keys and only the AP is sending real multicast |