Skip to content

hostd: WiFi scanning via pcap monitor mode (Linux) #105

@dougborg

Description

@dougborg

Summary

Add WiFi scanning to hostd on Linux using the pcap crate for raw 802.11 frame capture in monitor mode. This reuses the library's parse_wifi_frame() and filter_wifi_with_rules() — same pipeline as ESP32 firmware.

Context

Phase 1 of hostd (BLE scanning via btleplug) is implemented. This adds the WiFi half, Linux-only since monitor mode requires CAP_NET_RAW.

Implementation

  • Add pcap crate dependency (behind a wifi feature flag or #[cfg(target_os = "linux")])
  • New hostd/src/wifi_linux.rs module:
    • Open monitor-mode interface via pcap::Capture::from_device()
    • Parse raw frames with airhound::scanner::parse_wifi_frame()
    • Convert to WiFiEvent and send on existing scan channel
  • Add WifiEvent variant handling in filter_task (currently BLE-only)
  • Channel hopping: either manage via netlink/iw or document external setup
  • Requires CAP_NET_RAW + CAP_NET_ADMIN or root

Dependencies

  • pcap = "2" (libpcap FFI)
  • System: libpcap-dev on Debian/Ubuntu

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthostdHost daemon (Mac/Linux)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions