Fix capture adapter detection on adapters with long iw output #183
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-monitor-detect-pipefail"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this PR does
Fixes capture adapter detection for adapters whose
iw phy infooutput is long.iface_monitor_capablepipediwintogrep -q. Under the scripts'pipefail, grep exiting at the match leftiw's later writes to fail on SIGPIPE (141). So a monitor-capable adapter (seen on a tri-band MT7921U) read as not capable,kestrel capture statusshowed "adapter: none detected", and enabling capture was refused. The output is now captured before it is matched, as the note above the Bluetooth helpers incommon.shalready asks. The same change goes into the other pipes into an early-exiting reader on the capture, plugin-enable and update paths (ethtool | awk …exitincapture_resolve_iface,plugin_has_network_cap, and the update's link count), for consistency.Thanks to a community member who found this on hardware and sent in the fix through the GitHub mirror.
Checklist
make lint(ansible--syntax-check,yamllint,shellcheck --severity=error, and the real-data check). The Lint workflow runs this on the PR.make test(thekestrel_pipytest suite and the real-data check's tests). The Test workflow runs this on the PR..envfiles, real names, personal emails, device serials, and no real captured or device data: SSIDs, MAC addresses, GPS coordinates, capture files, diagnostics bundles, logs, or screenshots of a real device — placeholders only. The real-data check catches MACs, emails, keys and capture files; real SSIDs, coordinates and screenshots are on you.Release impact
kestrel_pipackage,plugins/*.py, systemd units, the journald drop-in, a lib script already in the engine'sLIB_SCRIPTS, or the CLI.config.txt/cmdline, kernel modules, the base image or partition size,builder/config.json,builder/config.yml, theMakefile, the Release workflow (.forgejo/workflows/main.yml), a shipped config default (config.toml/default.conf), or a brand-new lib script.common.shis in the engine'sLIB_SCRIPTS, andkestrel.shis the CLI.Notes for review
iw/ethtoolunderset -euo pipefail. With 3,000 lines of output after the match, the old helper found the adapter 0 times in 200 and the new one 100 times in 100. An adapter without monitor mode still reads as not capable, the built-in chip is still skipped, andcapture_resolve_iface autoreturns the right interface.plugin_has_network_capnow matches on captured output. A spurious 141 can no longer read as "nonetworkcapability", so the acknowledgment prompt is never skipped that way.make testlocally: 1715 passed, 5 failed intests/test_web.py. The same 5 fail onmainwith this host's Werkzeug 3.1.9, and nothing in this PR touches Python, so the box is left for the Test workflow.🤖 Generated with Claude Code