[PATCH] ieee80211: Move IV/ICV stripping into ieee80211_rx

This patch adds a host_strip_iv_icv flag to ieee80211 which indicates that
ieee80211_rx should strip the IV/ICV/other security features from the payload.
This saves on some memmove() calls in the driver and seems like something that
belongs in the stack as it can be used by bcm43xx, ipw2200, and zd1211rw

I will submit the ipw2200 patch separately as it needs testing.

This patch also adds some sensible variable reuse (idx vs keyidx) in
ieee80211_rx

Signed-off-by: Daniel Drake <dsd@gentoo.org>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Šī revīzija ir iekļauta:
Daniel Drake
2006-09-27 03:50:31 +01:00
revīziju iesūtīja Jeff Garzik
vecāks f2423723d7
revīzija c9308b06c0
4 mainīti faili ar 55 papildinājumiem un 25 dzēšanām

Parādīt failu

@@ -690,6 +690,7 @@ static int bcm43xx_wx_set_swencryption(struct net_device *net_dev,
bcm->ieee->host_encrypt = !!on;
bcm->ieee->host_decrypt = !!on;
bcm->ieee->host_build_iv = !on;
bcm->ieee->host_strip_iv_icv = !on;
spin_unlock_irqrestore(&bcm->irq_lock, flags);
mutex_unlock(&bcm->mutex);

Parādīt failu

@@ -543,25 +543,6 @@ int bcm43xx_rx(struct bcm43xx_private *bcm,
break;
}
frame_ctl = le16_to_cpu(wlhdr->frame_ctl);
if ((frame_ctl & IEEE80211_FCTL_PROTECTED) && !bcm->ieee->host_decrypt) {
frame_ctl &= ~IEEE80211_FCTL_PROTECTED;
wlhdr->frame_ctl = cpu_to_le16(frame_ctl);
/* trim IV and ICV */
/* FIXME: this must be done only for WEP encrypted packets */
if (skb->len < 32) {
dprintkl(KERN_ERR PFX "RX packet dropped (PROTECTED flag "
"set and length < 32)\n");
return -EINVAL;
} else {
memmove(skb->data + 4, skb->data, 24);
skb_pull(skb, 4);
skb_trim(skb, skb->len - 4);
stats.len -= 8;
}
wlhdr = (struct ieee80211_hdr_4addr *)(skb->data);
}
switch (WLAN_FC_GET_TYPE(frame_ctl)) {
case IEEE80211_FTYPE_MGMT:
ieee80211_rx_mgt(bcm->ieee, wlhdr, &stats);