[PATCH] mac80211: Defer setting of RX_FLAG_DECRYPTED.

The decryption handlers will skip the frame if the RX_FLAG_DECRYPTED
flag is set, so the early flag setting introduced by Johannes breaks
decryption. To work around this, call the handlers first and then set
the flag.

Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Mattias Nissler 2007-10-07 16:35:31 +02:00 committed by David S. Miller
parent 0654ff055c
commit e2f036da2f

View file

@ -424,6 +424,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
int keyidx; int keyidx;
int hdrlen; int hdrlen;
ieee80211_txrx_result result = TXRX_DROP;
struct ieee80211_key *stakey = NULL; struct ieee80211_key *stakey = NULL;
/* /*
@ -522,21 +523,22 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
ieee80211_wep_is_weak_iv(rx->skb, rx->key)) ieee80211_wep_is_weak_iv(rx->skb, rx->key))
rx->sta->wep_weak_iv_count++; rx->sta->wep_weak_iv_count++;
/* either the frame will be decrypted or dropped */
rx->u.rx.status->flag |= RX_FLAG_DECRYPTED;
switch (rx->key->conf.alg) { switch (rx->key->conf.alg) {
case ALG_WEP: case ALG_WEP:
return ieee80211_crypto_wep_decrypt(rx); result = ieee80211_crypto_wep_decrypt(rx);
break;
case ALG_TKIP: case ALG_TKIP:
return ieee80211_crypto_tkip_decrypt(rx); result = ieee80211_crypto_tkip_decrypt(rx);
break;
case ALG_CCMP: case ALG_CCMP:
return ieee80211_crypto_ccmp_decrypt(rx); result = ieee80211_crypto_ccmp_decrypt(rx);
break;
} }
/* not reached */ /* either the frame has been decrypted or will be dropped */
WARN_ON(1); rx->u.rx.status->flag |= RX_FLAG_DECRYPTED;
return TXRX_DROP;
return result;
} }
static void ap_sta_ps_start(struct net_device *dev, struct sta_info *sta) static void ap_sta_ps_start(struct net_device *dev, struct sta_info *sta)