Commit eb9fb5b8 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: trim RX data

The RX data contains the netdev, which is
duplicated since we have the sdata, and the
RX status pointer, which is duplicate since
we have the skb. Remove those two fields to
have fewer fields that depend on each other
and simply load them as necessary.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent a02ae758
...@@ -167,12 +167,10 @@ typedef unsigned __bitwise__ ieee80211_rx_result; ...@@ -167,12 +167,10 @@ typedef unsigned __bitwise__ ieee80211_rx_result;
struct ieee80211_rx_data { struct ieee80211_rx_data {
struct sk_buff *skb; struct sk_buff *skb;
struct net_device *dev;
struct ieee80211_local *local; struct ieee80211_local *local;
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
struct sta_info *sta; struct sta_info *sta;
struct ieee80211_key *key; struct ieee80211_key *key;
struct ieee80211_rx_status *status;
struct ieee80211_rate *rate; struct ieee80211_rate *rate;
unsigned int flags; unsigned int flags;
......
This diff is collapsed.
...@@ -281,16 +281,18 @@ bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key) ...@@ -281,16 +281,18 @@ bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key)
ieee80211_rx_result ieee80211_rx_result
ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx) ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx)
{ {
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; struct sk_buff *skb = rx->skb;
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
if (!ieee80211_is_data(hdr->frame_control) && if (!ieee80211_is_data(hdr->frame_control) &&
!ieee80211_is_auth(hdr->frame_control)) !ieee80211_is_auth(hdr->frame_control))
return RX_CONTINUE; return RX_CONTINUE;
if (!(rx->status->flag & RX_FLAG_DECRYPTED)) { if (!(status->flag & RX_FLAG_DECRYPTED)) {
if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key))
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
} else if (!(rx->status->flag & RX_FLAG_IV_STRIPPED)) { } else if (!(status->flag & RX_FLAG_IV_STRIPPED)) {
ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key); ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key);
/* remove ICV */ /* remove ICV */
skb_trim(rx->skb, rx->skb->len - WEP_ICV_LEN); skb_trim(rx->skb, rx->skb->len - WEP_ICV_LEN);
......
...@@ -85,16 +85,16 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) ...@@ -85,16 +85,16 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
u8 *data, *key = NULL, key_offset; u8 *data, *key = NULL, key_offset;
size_t data_len; size_t data_len;
unsigned int hdrlen; unsigned int hdrlen;
struct ieee80211_hdr *hdr;
u8 mic[MICHAEL_MIC_LEN]; u8 mic[MICHAEL_MIC_LEN];
struct sk_buff *skb = rx->skb; struct sk_buff *skb = rx->skb;
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
int authenticator = 1, wpa_test = 0; int authenticator = 1, wpa_test = 0;
/* No way to verify the MIC if the hardware stripped it */ /* No way to verify the MIC if the hardware stripped it */
if (rx->status->flag & RX_FLAG_MMIC_STRIPPED) if (status->flag & RX_FLAG_MMIC_STRIPPED)
return RX_CONTINUE; return RX_CONTINUE;
hdr = (struct ieee80211_hdr *)skb->data;
if (!rx->key || rx->key->conf.alg != ALG_TKIP || if (!rx->key || rx->key->conf.alg != ALG_TKIP ||
!ieee80211_has_protected(hdr->frame_control) || !ieee80211_has_protected(hdr->frame_control) ||
!ieee80211_is_data_present(hdr->frame_control)) !ieee80211_is_data_present(hdr->frame_control))
...@@ -216,6 +216,7 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx) ...@@ -216,6 +216,7 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
int hdrlen, res, hwaccel = 0, wpa_test = 0; int hdrlen, res, hwaccel = 0, wpa_test = 0;
struct ieee80211_key *key = rx->key; struct ieee80211_key *key = rx->key;
struct sk_buff *skb = rx->skb; struct sk_buff *skb = rx->skb;
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
hdrlen = ieee80211_hdrlen(hdr->frame_control); hdrlen = ieee80211_hdrlen(hdr->frame_control);
...@@ -225,8 +226,8 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx) ...@@ -225,8 +226,8 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
if (!rx->sta || skb->len - hdrlen < 12) if (!rx->sta || skb->len - hdrlen < 12)
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
if (rx->status->flag & RX_FLAG_DECRYPTED) { if (status->flag & RX_FLAG_DECRYPTED) {
if (rx->status->flag & RX_FLAG_IV_STRIPPED) { if (status->flag & RX_FLAG_IV_STRIPPED) {
/* /*
* Hardware took care of all processing, including * Hardware took care of all processing, including
* replay protection, and stripped the ICV/IV so * replay protection, and stripped the ICV/IV so
...@@ -442,6 +443,7 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) ...@@ -442,6 +443,7 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
int hdrlen; int hdrlen;
struct ieee80211_key *key = rx->key; struct ieee80211_key *key = rx->key;
struct sk_buff *skb = rx->skb; struct sk_buff *skb = rx->skb;
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
u8 pn[CCMP_PN_LEN]; u8 pn[CCMP_PN_LEN];
int data_len; int data_len;
...@@ -455,8 +457,8 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) ...@@ -455,8 +457,8 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
if (!rx->sta || data_len < 0) if (!rx->sta || data_len < 0)
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
if ((rx->status->flag & RX_FLAG_DECRYPTED) && if ((status->flag & RX_FLAG_DECRYPTED) &&
(rx->status->flag & RX_FLAG_IV_STRIPPED)) (status->flag & RX_FLAG_IV_STRIPPED))
return RX_CONTINUE; return RX_CONTINUE;
ccmp_hdr2pn(pn, skb->data + hdrlen); ccmp_hdr2pn(pn, skb->data + hdrlen);
...@@ -466,7 +468,7 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) ...@@ -466,7 +468,7 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
} }
if (!(rx->status->flag & RX_FLAG_DECRYPTED)) { if (!(status->flag & RX_FLAG_DECRYPTED)) {
/* hardware didn't decrypt/verify MIC */ /* hardware didn't decrypt/verify MIC */
ccmp_special_blocks(skb, pn, key->u.ccmp.rx_crypto_buf, 1); ccmp_special_blocks(skb, pn, key->u.ccmp.rx_crypto_buf, 1);
...@@ -563,6 +565,7 @@ ieee80211_rx_result ...@@ -563,6 +565,7 @@ ieee80211_rx_result
ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx) ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx)
{ {
struct sk_buff *skb = rx->skb; struct sk_buff *skb = rx->skb;
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
struct ieee80211_key *key = rx->key; struct ieee80211_key *key = rx->key;
struct ieee80211_mmie *mmie; struct ieee80211_mmie *mmie;
u8 aad[20], mic[8], ipn[6]; u8 aad[20], mic[8], ipn[6];
...@@ -571,8 +574,8 @@ ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx) ...@@ -571,8 +574,8 @@ ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx)
if (!ieee80211_is_mgmt(hdr->frame_control)) if (!ieee80211_is_mgmt(hdr->frame_control))
return RX_CONTINUE; return RX_CONTINUE;
if ((rx->status->flag & RX_FLAG_DECRYPTED) && if ((status->flag & RX_FLAG_DECRYPTED) &&
(rx->status->flag & RX_FLAG_IV_STRIPPED)) (status->flag & RX_FLAG_IV_STRIPPED))
return RX_CONTINUE; return RX_CONTINUE;
if (skb->len < 24 + sizeof(*mmie)) if (skb->len < 24 + sizeof(*mmie))
...@@ -591,7 +594,7 @@ ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx) ...@@ -591,7 +594,7 @@ ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx)
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
} }
if (!(rx->status->flag & RX_FLAG_DECRYPTED)) { if (!(status->flag & RX_FLAG_DECRYPTED)) {
/* hardware didn't decrypt/verify MIC */ /* hardware didn't decrypt/verify MIC */
bip_aad(skb, aad); bip_aad(skb, aad);
ieee80211_aes_cmac(key->u.aes_cmac.tfm, ieee80211_aes_cmac(key->u.aes_cmac.tfm,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment