fix(sniffer): resolve beacon channel mismatch - #2670
Merged
Conversation
- Use all_wifi_channels[ch] for beacon.channel in registerBeacon - Iterate registeredBeacons by const reference in sniffer_setup - Compare against all_wifi_channels[ch] instead of ch - Use pdMS_TO_TICKS(2) for the two-millisecond delay
Fix beacon channel mapping and deauth timing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
registerBeacon()was storing the channel index (ch) rather than the actual Wi‑Fi channel number. This caused two downstream bugs:countActiveBeaconsOnChannel()andrecentSsidsOnChannel()compared the stored index against a real channel number, so the check never matched – both functions effectively returned empty results.wsl_bypasser_send_raw_frame(), which calledesp_wifi_set_channel()with a value of 0–11 instead of a valid 1–12 channel, sending deauth frames on the wrong frequency.The fix stores
all_wifi_channels[ch]so beacon records always hold a real channel number. This automatically corrects the comparison incountActiveBeaconsOnChannel,recentSsidsOnChannel, and the deauth path.Two other review items from Copilot were addressed in the same area:
const auto &to avoid copying eachBeaconList.vTaskDelay(2 / portTICK_RATE_MS)was replaced withpdMS_TO_TICKS(2)for correctness on any tick rate.Types of Changes
Verification
platformio run -e reaper(or the target board) – no warnings.Testing
Existing build pipeline only; no unit tests are currently in place for the sniffer module.
Linked Issues
PR #2667 – Copilot review comments
User-Facing Change