]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
mac80211: Add RX flag to indicate ICV stripped
authorDavid Spinadel <david.spinadel@intel.com>
Mon, 21 Nov 2016 14:58:40 +0000 (16:58 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 12 Jan 2017 09:15:18 +0000 (10:15 +0100)
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>
include/net/mac80211.h
net/mac80211/wep.c
net/mac80211/wpa.c

index 5f5cb194cd788052c918f856b64c1957eaa6865d..86967b85dfd07231e9e31032f67388ee6202dc95 100644 (file)
@@ -1017,7 +1017,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
  * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware.
  * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame,
  *     verification has been done by the hardware.
- * @RX_FLAG_IV_STRIPPED: The IV/ICV are stripped from this frame.
+ * @RX_FLAG_IV_STRIPPED: The IV and ICV are stripped from this frame.
  *     If this flag is set, the stack cannot do any replay detection
  *     hence the driver or hardware will have to do that.
  * @RX_FLAG_PN_VALIDATED: Currently only valid for CCMP/GCMP frames, this
@@ -1088,6 +1088,8 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
  * @RX_FLAG_ALLOW_SAME_PN: Allow the same PN as same packet before.
  *     This is used for AMSDU subframes which can have the same PN as
  *     the first subframe.
+ * @RX_FLAG_ICV_STRIPPED: The ICV is stripped from this frame. CRC checking must
+ *     be done in the hardware.
  */
 enum mac80211_rx_flags {
        RX_FLAG_MMIC_ERROR              = BIT(0),
@@ -1123,6 +1125,7 @@ enum mac80211_rx_flags {
        RX_FLAG_RADIOTAP_VENDOR_DATA    = BIT(31),
        RX_FLAG_MIC_STRIPPED            = BIT_ULL(32),
        RX_FLAG_ALLOW_SAME_PN           = BIT_ULL(33),
+       RX_FLAG_ICV_STRIPPED            = BIT_ULL(34),
 };
 
 #define RX_FLAG_STBC_SHIFT             26
index efa3f48f1ec5d51ea7191c8ae90dda77c0d330e1..73e8f347802ecadf5efb11fffa7b13d32a5705c1 100644 (file)
@@ -293,7 +293,8 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx)
                        return RX_DROP_UNUSABLE;
                ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key);
                /* remove ICV */
-               if (pskb_trim(rx->skb, rx->skb->len - IEEE80211_WEP_ICV_LEN))
+               if (!(status->flag & RX_FLAG_ICV_STRIPPED) &&
+                   pskb_trim(rx->skb, rx->skb->len - IEEE80211_WEP_ICV_LEN))
                        return RX_DROP_UNUSABLE;
        }
 
index 8af6dd388d1195540fdaf66f7ac55a452620ad5f..c1ef22df865fe77bf7cf0a42d560f54db98a3edd 100644 (file)
@@ -294,7 +294,8 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
                return RX_DROP_UNUSABLE;
 
        /* Trim ICV */
-       skb_trim(skb, skb->len - IEEE80211_TKIP_ICV_LEN);
+       if (!(status->flag & RX_FLAG_ICV_STRIPPED))
+               skb_trim(skb, skb->len - IEEE80211_TKIP_ICV_LEN);
 
        /* Remove IV */
        memmove(skb->data + IEEE80211_TKIP_IV_LEN, skb->data, hdrlen);