Skip to content

feat: add owly-userspace 7-layer userspace AirDrop stack - #146

Open
sneurlax wants to merge 2 commits into
t4t5:mainfrom
sneurlax:feat/owly-userspace
Open

sneurlax wants to merge 2 commits into
t4t5:mainfrom
sneurlax:feat/owly-userspace

Conversation

@sneurlax

Copy link
Copy Markdown

What

This PR adds the missing composition layer between Owly’s sans-I/O protocol cores and its OS-specific drivers. It allows the complete AWDL-to-AirDrop stack to run and be tested inside one rootless process, without TAP interfaces, system sockets, disk staging, or Wi-Fi hardware. The crate originated as a standalone experiment and is being moved into the workspace to prevent API drift and provide a maintained integration testbed for the Owly protocol stack.

Why

This crate originated as the integration and bring-up track that ran in parallel with an original (unrelated-to-owly) AWDL implementation and the effort to make AirDrop work on non-Apple devices. It connected the AWDL state machine to userspace IPv6, mDNS, TLS, and AirDrop so the complete protocol could be developed and tested before the Linux TAP, privileged radio, and physical-hardware paths were ready. Moving it into the Owly workspace preserves that end-to-end harness, prevents it from drifting from owly-awdl and owly-airdrop, and provides a rootless environment for continued protocol and userspace-radio development.

See also the History section at the bottom.

Summary

Add owly-userspace as a new workspace crate that composes:

  • owly-awdl for AWDL synchronization, election, scheduling, and framing
  • smoltcp for userspace IPv6, TCP, and UDP
  • rustls for TLS inside smoltcp sockets
  • owly-airdrop for mDNS, /Discover, /Ask, uploads, and URL shares

The stack runs without root, TAP interfaces, or Wi-Fi hardware when using its deterministic simulator. It also provides a Radiotap-over-UDP transport and USB radio framing and firmware-transfer primitives.

Highlights

  • Deterministic multi-node RF simulation with channel isolation, packet loss, RSSI, and Radiotap PCAP capture
  • Userspace _airdrop._tcp mDNS discovery over ff02::fb:5353
  • TLS 1.2/1.3 pumped through smoltcp TCP sockets
  • Interactive accept/decline policy
  • In-memory Gzip and DVZip uploads with configurable resource limits
  • URL shares delivered directly to application memory
  • MT7612U and AR9271 USB bulk framing codecs
  • MT7612U endpoint selection, firmware parsing, and firmware-transfer primitives
  • Cross-target support for Linux, macOS, Windows, and Android-compatible builds

Showcase

cargo run -p owly-userspace --example showcase

cargo run -p owly-userspace --example showcase -- \
  --pcap /tmp/owly-showcase.pcap \
  --loss 50

The showcase exercises a four-node AWDL simulation, channel isolation, packet loss, mDNS, TLS, /Discover, an interactive decline, DVZip and Gzip transfers, URL sharing, simulated USB TX/RX framing, and PCAP inspection.

Feature behavior

Default features are udp and ring.

With default-features = false, applications must install a rustls crypto provider before creating TLS connections. USB enumeration and transport are available through nusb on Linux, macOS, and Windows; Android retains the framing APIs but reports enumeration as unsupported.

USB scope

This PR does not claim complete MT7612U hardware bring-up. It provides framing, endpoint selection, image parsing, control-transfer construction, and firmware image transfer. Reset, patch enablement, firmware startup, EEPROM handling, calibration, and MCU channel configuration remain future work.

Verification

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • cargo test -p owly-userspace --all-features --locked
  • cargo test -p owly-userspace --no-default-features --locked
  • Warning-denied rustdoc
  • Windows, Android, and macOS cross-target checks
  • cargo xtask coverage
  • cargo xtask hardware --check
  • Showcase runs at 0%, 5%, and 10% simulated packet loss
  • Radiotap PCAP output validated as libpcap 2.4

History

owly-userspace was originally created as a companion to a standalone (and unrelated-to-owly) AWDL crate during the early bring-up of AirDrop support for non-Apple devices. At that point, the work was progressing along two parallel tracks:

  1. Implement and validate AWDL itself: the synchronization, election, channel scheduling, peer discovery, and 802.11 framing needed to communicate with Apple devices.

  2. Bring up the higher-level AirDrop protocol: IPv6, mDNS discovery, TLS, /Discover, /Ask, and file transfer without making that work depend on a finished Linux radio driver, TAP interface, or particular Wi-Fi chipset.

owly-userspace (awdl-userspace at that time) connected those tracks. It supplied an in-process IPv6/TCP stack with smoltcp, drove TLS through rustls, and connected the result to the AirDrop protocol state machines. Its deterministic simulated radio made it possible to exercise the complete path while physical-radio support and OS integration were still being developed independently.

In other words, it was created as a bring-up and integration harness for proving that a non-Apple device could run the full AWDL-to-AirDrop stack and not just parse AWDL frames. It allowed protocol development, debugging, packet-loss testing, PCAP inspection, and early transport experimentation to continue before the privileged Linux and hardware paths were ready.

Now that owly-awdl and owly-airdrop live together in the Owly workspace and have evolved beyond their original standalone versions, this PR brings that parallel integration track back into the main project. Doing so prevents API drift and preserves it as a maintained end-to-end testbed, embedding example, and foundation for future userspace radio work.

Port owly-userspace into crates/owly-userspace on top of workspace
owly-awdl and owly-airdrop (v0.4.3):
- Inherit workspace package metadata, edition, version, and lints
- Drop unused crc32fast dependency and gate rustls/ring behind an
  optional default feature so cross-target checks (Windows, Android,
  macOS) succeed without C toolchains, matching owly-airdrop
- Add owly-userspace to justfile portability checks and version bump
- Keep all integration suites (7-layer sim, OWL wire vectors & fuzzing,
  UDP radiotap bridge, and MT7612U/AR9271 USB bulk framing)
Add examples/showcase.rs demonstrating what owly-userspace does that the
other workspace crates cannot do on their own: a single rootless,
zero-TAP, zero-hardware process running a 4-node AWDL mesh with channel
isolation and 5% RF packet loss, userspace IPv6/mDNS/TLS, interactive
/Ask decline, in-memory DVZip and Gzip transfers, URL sharing, MT7612U
USB bulk URB framing, and Radiotap PCAP capture/verification.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant