Files
RedBear-OS/local
vasilito 89350ed795 redbear-iwlwifi: add Wi-Fi IP datapath bridge
Phase 3 of the systematic networking plan.

The bridge lives entirely in the redbear-iwlwifi recipe. It
exposes a network.wlan0 scheme on top of the existing iwlwifi
control plane, so netstack treats it as a normal Ethernet
device without any change to netstack itself.

Components (all in local/recipes/drivers/redbear-iwlwifi):

- src/bridge/mod.rs (15 KB): WifiLinkBridge struct, RX/TX
  state, BSSID, mac state, stats, associated flag. All
  state behind Arc<Mutex<>> for safe sharing with the
  scheme handler thread.
- src/bridge/convert.rs (26 KB): wifi_to_ethernet() and
  ethernet_to_wifi() pure functions. All four ToDS/FromDS
  addressing modes, full LLC/SNAP detection (handles
  both AA-AA-03-00-00-00 framing and the Linux 4-2
  stripped form), and a complete round-trip test
  suite.
- src/bridge/callback.rs (11 KB): the unsafe extern C
  callback that ieee80211_rx_drain calls. Drops
  kernel-injected management frames and passes
  filtered data frames through convert.rs.
- src/bridge/scheme.rs (16 KB): the Redox scheme handler.
  Registers network.wlan0 with read/write/handles.
  Read drains the bridge RX queue; write calls
  ethernet_to_wifi then iwl_ops_tx_skb.

linux_port.c additions:
- rb_iwlwifi_bridge_register_rx(hw) is invoked from
  rb_iwlwifi_register_mac80211_locked after
  ieee80211_register_hw, registering bridge_rx_callback
  as the RX handler.
- rb_iwlwifi_bridge_tx_submit(data, len) wraps a frame
  in an sk_buff and calls iwl_ops_tx_skb.
- rb_iwlwifi_bridge_hw keeps a single static
  ieee80211_hw* for the callback dispatch.

main.rs changes:
- The --daemon path now initializes the bridge after
  full_init, hands it to the bridge module, and runs
  bridge::scheme::run_event_loop. The previous
  'loop { sleep(3600); }' is gone.

Verification contract built into the bridge modules:
- convert.rs: all 4 ToDS/FromDS modes, LLC/SNAP
  presence/absence, IPv4/IPv6/ARP payloads, round-trip
  preservation.
- mod.rs: push/pop/activate/deactivate state machine.
- scheme.rs: scheme read/write handshake with mock
  driver backend.

Netstack impact: zero. The netcfg scheme already
discovers network.* and creates EthernetLink on
top; wlan0 looks identical to netstack.

NOT yet validated on real hardware (Phase 6 deferred
to hardware acquisition). Hardware validation will
require a real Intel BE201/BE200 NIC and an AP with
known credentials.
2026-07-26 19:34:49 +09:00
..