bcm43439a0: add 802.11 frame injection support#688
Open
TBX3D wants to merge 1 commit into
Open
Conversation
Adds frame injection (TX) for the Raspberry Pi Pico W CYW43439, firmware 7.95.49 (tag 7_95_49_2271bb6). Monitor mode and radiotap already landed for this chip in seemoo-lab#579, so injection was the remaining capability gap; it is the feature requested in seemoo-lab#687. NEX_GET_CAPABILITIES now returns 0x7. The Pico W exposes no Linux netdev and no mon0 interface, so the classic netdev transmit hook does not apply here. Injection is driven instead by a new NEX_INJECT_FRAME (408) case on the existing wlc_ioctl_hook. The host sends one radiotap-prefixed 802.11 frame per ioctl; the patch strips the radiotap header and hands the bare frame to the classic sendframe() TX path. sendframe.c and injection.c are ported from the bcm43430a1 patch. inject_frame takes wlc directly, since the ioctl hook already holds it, rather than deriving it from a wl_info. The ioctl path reserves headroom before the copy so wlc_d11hdrs can prepend the d11 TX header without reallocating, and it does not report success for a frame that failed radiotap parsing. Three struct offsets that sendframe needs were resolved against a real 43439 ROM/RAM dump and are documented inline: wlc_band.hwrs_scb at 0x018, wlc_hw_info.up at 0x006, and sk_buff.scb at 0x028. Verified over the air: the injected beacon appears on channel 6 with source/BSSID 02:13:37:de:ad:01 and a broadcast destination, and the patched firmware links within the reclaim region.
Member
|
Thanks, looks fine on first glance. Will properly revisit in a couple of days. |
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.
Summary
Adds 802.11 frame injection (TX) for the Raspberry Pi Pico W (Infineon CYW43439,
bcm43439a0), firmware 7.95.49 (7_95_49_2271bb6).Monitor mode and radiotap for this chip were merged in #579. Frame injection was the remaining gap in the support table (
M:X RT:X I:blank) and is the feature requested in #687.NEX_GET_CAPABILITIESnow returns0x7(monitor | radiotap | injection).Approach
The Pico W runs the WLAN firmware over gSPI with no Linux netdev and no
mon0interface, so the classic injection trigger (hijacking the netdev transmit path and watchingmon0for radiotap frames) does not exist here. Injection is driven instead by a newNEX_INJECT_FRAME(408) case added to the existingwlc_ioctl_hook(GenericPatch4 @ 0x1EFC4). The host sends a single radiotap-prefixed 802.11 frame per ioctl; the patch parses and strips the radiotap header, then hands the bare frame to the classicsendframe()TX path (wlc_d11hdrs->wlc_get_txh_info->wlc_txfifo).Changes
patches/bcm43439a0/7_95_49_2271bb6/nexmon/src/sendframe.c(new): classic TX path, ported frombcm43430a1..../src/injection.c(new): radiotap parse plusinject_frame(wlc, p). Takeswlcdirectly because the ioctl hook already holds it, rather than deriving it from awl_info..../src/ioctl.c: theNEX_INJECT_FRAMEcase. It reserves headroom before the copy sowlc_d11hdrscan prepend the d11 TX header without reallocating, and it does not reportIOCTL_SUCCESSfor a frame that failed radiotap parsing..../src/patch.c:capabilities = NEX_CAP_MONITOR_MODE | NEX_CAP_MONITOR_MODE_RADIOTAP | NEX_CAP_FRAME_INJECTION.firmwares/bcm43439a0/structs.common.h: the three struct fieldssendframe()needs, plus the softwarewlc_bandand the opaquewlc_txh_infoscratch type.All required firmware symbols (
wlc_d11hdrs,wlc_get_txh_info,wlc_txfifo,pkt_buf_*,wlc_ioctl) are already resolved forCHIP_VER_BCM43439a0inpatches/common/wrapper.c, andNEX_INJECT_FRAMEandNEX_CAP_FRAME_INJECTIONalready exist in the common headers, so no common-header or Makefile changes were needed.Struct offsets
sendframe()reads three fields the 43439 header did not describe. Each was resolved against a real bcm43439a0 ROM/RAM dump. The firmware dispatches thesewlc_*functions through a ROM patch-table thunk into the loaded RAM blob, so the struct-access idioms were read from the RAM image and cross-checked against the ROM.wlc_band.hwrs_scb0x0180x82e7c8:wlc+0x20is band,band+0x18loads the scb, thenscb+16is dereferenced.wlc_hw_info.up0x006wlc->hwboolean gate (23 sites, base verified aswlc). The originally seeded 0x0a0 has zero gate sites.sk_buff.scb0x028wlc_txfiforeads the packet scb from[p+0x28], andwlc_d11hdrsdoes not write it, so thep->scb =assignment is required rather than redundant.Verification
Built with the nexmon toolchain; the patched firmware links within the reclaim region. Confirmed over the air with an independent monitor-mode witness on channel 6: the injected beacon is received with the expected test SSID, source/BSSID
02:13:37:de:ad:01, and broadcast destinationff:ff:ff:ff:ff:ff.Notes
wlc->monitor; the host is responsible for setting the channel first (and monitor mode too if it also wants RX).sendframe()still self-guards onhwrs_scbandhw->up.monitormode.cis unchanged. ItsMONITOR_*enum drift from the canonical bitflag scheme is noted in-tree but injection does not depend on it.