diff mbox

[2/2] ath5k: capture CCK and OFDM restarts

Message ID 539B7019.1050801@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Mathy Vanhoef June 13, 2014, 9:41 p.m. UTC
Hi all,

This patch allows users to see CCK and OFDM restarts when FIF_FCSFAIL is set.
Without this patch only the stronger frame (causing the restart) would be
visible.

The patch has been tested using our reactive jammer. The prefix of the weaker
frame is being correctly passed on as a frame with bad CRC!
--
From: "Mathy Vanhoef" <vanhoefm@gmail.com>

Treat frames that underwent a CCK or OFDM restart as frames with an invalid CRC.

Signed-off-by: Mathy Vanhoef <vanhoefm@gmail.com>
---
 drivers/net/wireless/ath/ath5k/base.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Felix Fietkau June 13, 2014, 10:07 p.m. UTC | #1
On 2014-06-13 23:41, Mathy Vanhoef wrote:
> Hi all,
> 
> This patch allows users to see CCK and OFDM restarts when FIF_FCSFAIL is set.
> Without this patch only the stronger frame (causing the restart) would be
> visible.
> 
> The patch has been tested using our reactive jammer. The prefix of the weaker
> frame is being correctly passed on as a frame with bad CRC!
> --
> From: "Mathy Vanhoef" <vanhoefm@gmail.com>
> 
> Treat frames that underwent a CCK or OFDM restart as frames with an invalid CRC.
> 
> Signed-off-by: Mathy Vanhoef <vanhoefm@gmail.com>
> ---
>  drivers/net/wireless/ath/ath5k/base.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
> index 39ba642..1bbc850 100644
> --- a/drivers/net/wireless/ath/ath5k/base.c
> +++ b/drivers/net/wireless/ath/ath5k/base.c
> @@ -1462,7 +1462,19 @@ ath5k_receive_frame_ok(struct ath5k_hw *ah, struct ath5k_rx_status *rs)
>  			ah->stats.rxerr_phy++;
>  			if (rs->rs_phyerr > 0 && rs->rs_phyerr < 32)
>  				ah->stats.rxerr_phy_code[rs->rs_phyerr]++;
> -			return false;
> +
> +			/*
> +			 * Threat packets that underwent a CCK of OFDM reset as having a bad CRC.
> +			 * These restarts happen when the radio resynchronizes to a stronger frame
> +			 * while receiving a weaker frame. Here we receive the prefix of the weak
> +			 * frame. Since these are incomplete packets, mark their CRC as invalid.
> +			 */
> +			if (rs->rs_phyerr == AR5K_RX_PHY_ERROR_OFDM_RESTART ||
> +			    rs->rs_phyerr == AR5K_RX_PHY_ERROR_CCK_RESTART) {
> +				rs->rs_status |= AR5K_RXERR_CRC;
> +				rs->rs_status &= (~AR5K_RXERR_PHY);
Unnecessary braces

> +			}
What about the return statement you removed, shouldn't you add that back
for the 'else' case?

- Felix
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 39ba642..1bbc850 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1462,7 +1462,19 @@  ath5k_receive_frame_ok(struct ath5k_hw *ah, struct ath5k_rx_status *rs)
 			ah->stats.rxerr_phy++;
 			if (rs->rs_phyerr > 0 && rs->rs_phyerr < 32)
 				ah->stats.rxerr_phy_code[rs->rs_phyerr]++;
-			return false;
+
+			/*
+			 * Threat packets that underwent a CCK of OFDM reset as having a bad CRC.
+			 * These restarts happen when the radio resynchronizes to a stronger frame
+			 * while receiving a weaker frame. Here we receive the prefix of the weak
+			 * frame. Since these are incomplete packets, mark their CRC as invalid.
+			 */
+			if (rs->rs_phyerr == AR5K_RX_PHY_ERROR_OFDM_RESTART ||
+			    rs->rs_phyerr == AR5K_RX_PHY_ERROR_CCK_RESTART) {
+				rs->rs_status |= AR5K_RXERR_CRC;
+				rs->rs_status &= (~AR5K_RXERR_PHY);
+			}
 		}
 		if (rs->rs_status & AR5K_RXERR_DECRYPT) {
 			/*
-- 
1.8.1.2