aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rx.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-08-28 17:01:54 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:48:51 -0400
commit8f20fc24986a083228823d9b68adca20714b254e (patch)
treeb5d7638b913649c7a181d6703ccd72e35ca06de9 /net/mac80211/rx.c
parent13262ffd4902805acad2618c12b41fcaa6c50791 (diff)
[MAC80211]: embed key conf in key, fix driver interface
This patch embeds the struct ieee80211_key_conf into struct ieee80211_key and thus avoids allocations and having data present twice. This required some more changes: 1) The removal of the IEEE80211_KEY_DEFAULT_TX_KEY key flag. This flag isn't used by drivers nor should it be since we have a set_key_idx() callback. Maybe that callback needs to be extended to include the key conf, but only a driver that requires it will tell. 2) The removal of the IEEE80211_KEY_DEFAULT_WEP_ONLY key flag. This flag is global, so it shouldn't be passed in the key conf structure. Pass it to the function instead. Also, this patch removes the AID parameter to the set_key() callback because it is currently unused and the hardware currently cannot know about the AID anyway. I suspect this was used with some hardware that actually selected the AID itself, but that functionality was removed. Additionally, I've removed the ALG_NULL key algorithm since we have ALG_NONE. 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.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index b52e3305a8f8..976b646a40de 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -374,7 +374,7 @@ ieee80211_rx_h_load_key(struct ieee80211_txrx_data *rx)
374 * pairwise or station-to-station keys, but for WEP we allow 374 * pairwise or station-to-station keys, but for WEP we allow
375 * using a key index as well. 375 * using a key index as well.
376 */ 376 */
377 if (rx->key && rx->key->alg != ALG_WEP && 377 if (rx->key && rx->key->conf.alg != ALG_WEP &&
378 !is_multicast_ether_addr(hdr->addr1)) 378 !is_multicast_ether_addr(hdr->addr1))
379 rx->key = NULL; 379 rx->key = NULL;
380 } 380 }
@@ -522,18 +522,15 @@ ieee80211_rx_h_wep_weak_iv_detection(struct ieee80211_txrx_data *rx)
522{ 522{
523 if (!rx->sta || !(rx->fc & IEEE80211_FCTL_PROTECTED) || 523 if (!rx->sta || !(rx->fc & IEEE80211_FCTL_PROTECTED) ||
524 (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA || 524 (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
525 !rx->key || rx->key->alg != ALG_WEP || 525 !rx->key || rx->key->conf.alg != ALG_WEP ||
526 !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) 526 !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
527 return TXRX_CONTINUE; 527 return TXRX_CONTINUE;
528 528
529 /* Check for weak IVs, if hwaccel did not remove IV from the frame */ 529 /* Check for weak IVs, if hwaccel did not remove IV from the frame */
530 if ((rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV) || 530 if ((rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV) ||
531 rx->key->force_sw_encrypt) { 531 (rx->key->conf.flags & IEEE80211_KEY_FORCE_SW_ENCRYPT))
532 u8 *iv = ieee80211_wep_is_weak_iv(rx->skb, rx->key); 532 if (ieee80211_wep_is_weak_iv(rx->skb, rx->key))
533 if (iv) {
534 rx->sta->wep_weak_iv_count++; 533 rx->sta->wep_weak_iv_count++;
535 }
536 }
537 534
538 return TXRX_CONTINUE; 535 return TXRX_CONTINUE;
539} 536}
@@ -541,7 +538,7 @@ ieee80211_rx_h_wep_weak_iv_detection(struct ieee80211_txrx_data *rx)
541static ieee80211_txrx_result 538static ieee80211_txrx_result
542ieee80211_rx_h_wep_decrypt(struct ieee80211_txrx_data *rx) 539ieee80211_rx_h_wep_decrypt(struct ieee80211_txrx_data *rx)
543{ 540{
544 if ((rx->key && rx->key->alg != ALG_WEP) || 541 if ((rx->key && rx->key->conf.alg != ALG_WEP) ||
545 !(rx->fc & IEEE80211_FCTL_PROTECTED) || 542 !(rx->fc & IEEE80211_FCTL_PROTECTED) ||
546 ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA && 543 ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA &&
547 ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT || 544 ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT ||
@@ -556,7 +553,7 @@ ieee80211_rx_h_wep_decrypt(struct ieee80211_txrx_data *rx)
556 } 553 }
557 554
558 if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED) || 555 if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED) ||
559 rx->key->force_sw_encrypt) { 556 (rx->key->conf.flags & IEEE80211_KEY_FORCE_SW_ENCRYPT)) {
560 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) { 557 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) {
561 if (net_ratelimit()) 558 if (net_ratelimit())
562 printk(KERN_DEBUG "%s: RX WEP frame, decrypt " 559 printk(KERN_DEBUG "%s: RX WEP frame, decrypt "
@@ -680,7 +677,7 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
680 /* This is the first fragment of a new frame. */ 677 /* This is the first fragment of a new frame. */
681 entry = ieee80211_reassemble_add(rx->sdata, frag, seq, 678 entry = ieee80211_reassemble_add(rx->sdata, frag, seq,
682 rx->u.rx.queue, &(rx->skb)); 679 rx->u.rx.queue, &(rx->skb));
683 if (rx->key && rx->key->alg == ALG_CCMP && 680 if (rx->key && rx->key->conf.alg == ALG_CCMP &&
684 (rx->fc & IEEE80211_FCTL_PROTECTED)) { 681 (rx->fc & IEEE80211_FCTL_PROTECTED)) {
685 /* Store CCMP PN so that we can verify that the next 682 /* Store CCMP PN so that we can verify that the next
686 * fragment has a sequential PN value. */ 683 * fragment has a sequential PN value. */
@@ -707,7 +704,7 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
707 if (entry->ccmp) { 704 if (entry->ccmp) {
708 int i; 705 int i;
709 u8 pn[CCMP_PN_LEN], *rpn; 706 u8 pn[CCMP_PN_LEN], *rpn;
710 if (!rx->key || rx->key->alg != ALG_CCMP) 707 if (!rx->key || rx->key->conf.alg != ALG_CCMP)
711 return TXRX_DROP; 708 return TXRX_DROP;
712 memcpy(pn, entry->last_pn, CCMP_PN_LEN); 709 memcpy(pn, entry->last_pn, CCMP_PN_LEN);
713 for (i = CCMP_PN_LEN - 1; i >= 0; i--) { 710 for (i = CCMP_PN_LEN - 1; i >= 0; i--) {
@@ -900,7 +897,8 @@ ieee80211_rx_h_drop_unencrypted(struct ieee80211_txrx_data *rx)
900 * uploaded to the hardware. 897 * uploaded to the hardware.
901 */ 898 */
902 if ((rx->local->hw.flags & IEEE80211_HW_DEVICE_HIDES_WEP) && 899 if ((rx->local->hw.flags & IEEE80211_HW_DEVICE_HIDES_WEP) &&
903 (!rx->key || !rx->key->force_sw_encrypt)) 900 (!rx->key ||
901 !(rx->key->conf.flags & IEEE80211_KEY_FORCE_SW_ENCRYPT)))
904 return TXRX_CONTINUE; 902 return TXRX_CONTINUE;
905 903
906 /* Drop unencrypted frames if key is set. */ 904 /* Drop unencrypted frames if key is set. */