aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/wpa.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-11-16 09:28:55 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-11-21 16:20:42 -0500
commit252b86c43225d067468dd182e9ae616ad2532bc8 (patch)
treed584ef11ebd143960c1890e361a89653fb9812c9 /net/mac80211/wpa.c
parent83c76570961573e56a238d84ba18f2581ef1e6b5 (diff)
mac80211: use skb list for fragments
We are currently linking the skbs by using skb->next directly. This works, but the preferred way is to use a struct sk_buff_head instead. That also prepares for passing that to drivers directly. While at it I noticed we calculate the duration for fragments twice -- remove one of them. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/wpa.c')
-rw-r--r--net/mac80211/wpa.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 106e15a4649f..93aab0715e8a 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -223,14 +223,14 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
223ieee80211_tx_result 223ieee80211_tx_result
224ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx) 224ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx)
225{ 225{
226 struct sk_buff *skb = tx->skb; 226 struct sk_buff *skb;
227 227
228 ieee80211_tx_set_protected(tx); 228 ieee80211_tx_set_protected(tx);
229 229
230 do { 230 skb_queue_walk(&tx->skbs, skb) {
231 if (tkip_encrypt_skb(tx, skb) < 0) 231 if (tkip_encrypt_skb(tx, skb) < 0)
232 return TX_DROP; 232 return TX_DROP;
233 } while ((skb = skb->next)); 233 }
234 234
235 return TX_CONTINUE; 235 return TX_CONTINUE;
236} 236}
@@ -449,14 +449,14 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
449ieee80211_tx_result 449ieee80211_tx_result
450ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx) 450ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
451{ 451{
452 struct sk_buff *skb = tx->skb; 452 struct sk_buff *skb;
453 453
454 ieee80211_tx_set_protected(tx); 454 ieee80211_tx_set_protected(tx);
455 455
456 do { 456 skb_queue_walk(&tx->skbs, skb) {
457 if (ccmp_encrypt_skb(tx, skb) < 0) 457 if (ccmp_encrypt_skb(tx, skb) < 0)
458 return TX_DROP; 458 return TX_DROP;
459 } while ((skb = skb->next)); 459 }
460 460
461 return TX_CONTINUE; 461 return TX_CONTINUE;
462} 462}
@@ -554,15 +554,22 @@ static inline void bip_ipn_swap(u8 *d, const u8 *s)
554ieee80211_tx_result 554ieee80211_tx_result
555ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx) 555ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx)
556{ 556{
557 struct sk_buff *skb = tx->skb; 557 struct sk_buff *skb;
558 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 558 struct ieee80211_tx_info *info;
559 struct ieee80211_key *key = tx->key; 559 struct ieee80211_key *key = tx->key;
560 struct ieee80211_mmie *mmie; 560 struct ieee80211_mmie *mmie;
561 u8 aad[20]; 561 u8 aad[20];
562 u64 pn64; 562 u64 pn64;
563 563
564 if (WARN_ON(skb_queue_len(&tx->skbs) != 1))
565 return TX_DROP;
566
567 skb = skb_peek(&tx->skbs);
568
569 info = IEEE80211_SKB_CB(skb);
570
564 if (info->control.hw_key) 571 if (info->control.hw_key)
565 return 0; 572 return TX_CONTINUE;
566 573
567 if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) 574 if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
568 return TX_DROP; 575 return TX_DROP;