Skip to contentSkip to conversation

ath5k: capture CCK and OFDM restarts

PATCH In review Mathy Vanhoef 4 participants 6 messages Jun 13, 2014 – Jun 25, 2014 Atheros ATH5K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 ath5k: capture CCK and OFDM restarts

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" <[email protected]>

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

---
 drivers/net/wireless/ath/ath5k/base.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath5k/base.c +12 -1
index 39ba642..1bbc850 100644
@@ -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) {
 			/*
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 28 lines · Mathy Vanhoef

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" <[email protected]>

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

---
 drivers/net/wireless/ath/ath5k/base.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath5k/base.c +1 -1
index 39ba642..1bbc850 100644
@@ -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;
+

drivers/net/wireless/ath/ath5k/base.c ath5k_receive_frame_ok(struct ath5k_hw *ah, struct ath5k_rx_status *rs) · line 1475

Quoted 10 lines
drivers/net/wireless/ath/ath5k/base.c +10 -0
+			/*
+			 * 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

drivers/net/wireless/ath/ath5k/base.c ath5k_receive_frame_ok(struct ath5k_hw *ah, struct ath5k_rx_status *rs) · line 1476

Quoted 1 line
drivers/net/wireless/ath/ath5k/base.c +1 -0
+			}

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

- Felix

#2 lore raw
Quoted 41 lines · Felix Fietkau
Quoted 28 lines · Mathy Vanhoef

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" <[email protected]>

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

---
 drivers/net/wireless/ath/ath5k/base.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath5k/base.c +1 -1
index 39ba642..1bbc850 100644
@@ -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;
+

drivers/net/wireless/ath/ath5k/base.c ath5k_receive_frame_ok(struct ath5k_hw *ah, struct ath5k_rx_status *rs) · line 1475

Quoted 10 lines
drivers/net/wireless/ath/ath5k/base.c +10 -0
+			/*
+			 * 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

Quoted 6 lines

drivers/net/wireless/ath/ath5k/base.c ath5k_receive_frame_ok(struct ath5k_hw *ah, struct ath5k_rx_status *rs) · line 1476

Quoted 1 line
drivers/net/wireless/ath/ath5k/base.c +1 -0
+			}

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

- Felix

Just saw a spelling mistake in the comment, s/Threat/Treat.

The parenthesis around (~AR5K_RXERR_PHY) can indeed be removed. I suppose it's best to keep the return statement (I don't know precisely why it appears so early in the function, but it likely has a good reason). Updated patch is included below. --
From: "Mathy Vanhoef" <[email protected]>

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

---
 drivers/net/wireless/ath/ath5k/base.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath5k/base.c +14 -1
index 4b18434..6e7c636 100644
@@ -1457,7 +1457,20 @@ 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;
+
+			/*
+			 * Treat 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;
+			} else {
+				return false;
+			}
 		}
 		if (rs->rs_status & AR5K_RXERR_DECRYPT) {
 			/*
Signature · 1 line
1.8.1.2
#3 lore raw

On 2014-06-13 16:14, Mathy Vanhoef wrote:
[snip]

Quoted 1 line

Just saw a spelling mistake in the comment, s/Threat/Treat.

One more mistake in the comment.

Change the word "of" to "or":

...underwent a CCK of OFDM reset...

should be

...underwent a CCK or OFDM reset...

Gus

#4 lore raw

I'm sure the spelling error can be fixed when applying the patch.

This (and the previous patch) is useful for people using monitor mode to diagnose network problems, monitor traffic, research things, etc. So it would be nice to have it included!

Quoted 16 lines · Gus Wirth

On 2014-06-13 16:14, Mathy Vanhoef wrote:
[snip]

Quoted 1 line

Just saw a spelling mistake in the comment, s/Threat/Treat.

One more mistake in the comment.

Change the word "of" to "or":

...underwent a CCK of OFDM reset...

should be

...underwent a CCK or OFDM reset...

Gus

#5 lore raw
Quoted 5 lines · Mathy Vanhoef

I'm sure the spelling error can be fixed when applying the patch.

This (and the previous patch) is useful for people using monitor mode to diagnose network problems, monitor traffic, research things, etc. So it would be nice to have it included!

It would also be nice if you could repost it properly, instead of expecting me to dig through email threads to piece together a mergeable patch...

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.