Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mac80211: Add RX flag to indicate ICV stripped

Add a flag that indicates that the WEP ICV was stripped from an
RX packet, allowing the device to not transfer that if it's
already checked.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

David Spinadel and committed by
Johannes Berg
cef0acd4 93be2b74

+8 -3
+4 -1
include/net/mac80211.h
··· 1017 1017 * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware. 1018 1018 * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame, 1019 1019 * verification has been done by the hardware. 1020 - * @RX_FLAG_IV_STRIPPED: The IV/ICV are stripped from this frame. 1020 + * @RX_FLAG_IV_STRIPPED: The IV and ICV are stripped from this frame. 1021 1021 * If this flag is set, the stack cannot do any replay detection 1022 1022 * hence the driver or hardware will have to do that. 1023 1023 * @RX_FLAG_PN_VALIDATED: Currently only valid for CCMP/GCMP frames, this ··· 1088 1088 * @RX_FLAG_ALLOW_SAME_PN: Allow the same PN as same packet before. 1089 1089 * This is used for AMSDU subframes which can have the same PN as 1090 1090 * the first subframe. 1091 + * @RX_FLAG_ICV_STRIPPED: The ICV is stripped from this frame. CRC checking must 1092 + * be done in the hardware. 1091 1093 */ 1092 1094 enum mac80211_rx_flags { 1093 1095 RX_FLAG_MMIC_ERROR = BIT(0), ··· 1125 1123 RX_FLAG_RADIOTAP_VENDOR_DATA = BIT(31), 1126 1124 RX_FLAG_MIC_STRIPPED = BIT_ULL(32), 1127 1125 RX_FLAG_ALLOW_SAME_PN = BIT_ULL(33), 1126 + RX_FLAG_ICV_STRIPPED = BIT_ULL(34), 1128 1127 }; 1129 1128 1130 1129 #define RX_FLAG_STBC_SHIFT 26
+2 -1
net/mac80211/wep.c
··· 293 293 return RX_DROP_UNUSABLE; 294 294 ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key); 295 295 /* remove ICV */ 296 - if (pskb_trim(rx->skb, rx->skb->len - IEEE80211_WEP_ICV_LEN)) 296 + if (!(status->flag & RX_FLAG_ICV_STRIPPED) && 297 + pskb_trim(rx->skb, rx->skb->len - IEEE80211_WEP_ICV_LEN)) 297 298 return RX_DROP_UNUSABLE; 298 299 } 299 300
+2 -1
net/mac80211/wpa.c
··· 294 294 return RX_DROP_UNUSABLE; 295 295 296 296 /* Trim ICV */ 297 - skb_trim(skb, skb->len - IEEE80211_TKIP_ICV_LEN); 297 + if (!(status->flag & RX_FLAG_ICV_STRIPPED)) 298 + skb_trim(skb, skb->len - IEEE80211_TKIP_ICV_LEN); 298 299 299 300 /* Remove IV */ 300 301 memmove(skb->data + IEEE80211_TKIP_IV_LEN, skb->data, hdrlen);