diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-03-12 08:49:14 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-13 14:54:17 -0400 |
commit | a8286911881948c7a2ecc63ee4224c258cce2da3 (patch) | |
tree | a35566503b81c654db55857f42fe9664d0aab3af /net/mac80211/wep.c | |
parent | 617bbde878604adfcd557fc2a8952f77ab4ebd95 (diff) |
mac80211: linearize SKBs as needed for crypto
Not linearizing every SKB will help actually pass
non-linear SKBs all the way up when on an encrypted
connection. For now, linearize TKIP completely as
it is lower performance and I don't quite grok all
the details.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/wep.c')
-rw-r--r-- | net/mac80211/wep.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c index 5cd87ba11bb7..7aa31bbfaa3b 100644 --- a/net/mac80211/wep.c +++ b/net/mac80211/wep.c | |||
@@ -284,22 +284,27 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx) | |||
284 | struct sk_buff *skb = rx->skb; | 284 | struct sk_buff *skb = rx->skb; |
285 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 285 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
286 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 286 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
287 | __le16 fc = hdr->frame_control; | ||
287 | 288 | ||
288 | if (!ieee80211_is_data(hdr->frame_control) && | 289 | if (!ieee80211_is_data(fc) && !ieee80211_is_auth(fc)) |
289 | !ieee80211_is_auth(hdr->frame_control)) | ||
290 | return RX_CONTINUE; | 290 | return RX_CONTINUE; |
291 | 291 | ||
292 | if (!(status->flag & RX_FLAG_DECRYPTED)) { | 292 | if (!(status->flag & RX_FLAG_DECRYPTED)) { |
293 | if (skb_linearize(rx->skb)) | ||
294 | return RX_DROP_UNUSABLE; | ||
293 | if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key)) | 295 | if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key)) |
294 | rx->sta->wep_weak_iv_count++; | 296 | rx->sta->wep_weak_iv_count++; |
295 | if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) | 297 | if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) |
296 | return RX_DROP_UNUSABLE; | 298 | return RX_DROP_UNUSABLE; |
297 | } else if (!(status->flag & RX_FLAG_IV_STRIPPED)) { | 299 | } else if (!(status->flag & RX_FLAG_IV_STRIPPED)) { |
300 | if (!pskb_may_pull(rx->skb, ieee80211_hdrlen(fc) + WEP_IV_LEN)) | ||
301 | return RX_DROP_UNUSABLE; | ||
298 | if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key)) | 302 | if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key)) |
299 | rx->sta->wep_weak_iv_count++; | 303 | rx->sta->wep_weak_iv_count++; |
300 | ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key); | 304 | ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key); |
301 | /* remove ICV */ | 305 | /* remove ICV */ |
302 | skb_trim(rx->skb, rx->skb->len - WEP_ICV_LEN); | 306 | if (pskb_trim(rx->skb, rx->skb->len - WEP_ICV_LEN)) |
307 | return RX_DROP_UNUSABLE; | ||
303 | } | 308 | } |
304 | 309 | ||
305 | return RX_CONTINUE; | 310 | return RX_CONTINUE; |