From cfb06ec73e22f24bf47468d259f18c835bc5470d Mon Sep 17 00:00:00 2001 From: LeandroLP23 Date: Wed, 4 Nov 2026 14:54:31 +0100 Subject: [PATCH 1/2] Get the Intel 8265 working with two quirks The 8265's firmware never sends from the ad-hoc cell's group queue, so Owly's broadcast action frames and multicast pile up there until iwlwifi calls the queue stuck and restarts the firmware, every ~21 s. And from the cell's first beacon on, it stops sending to the cell's stations too. - unicast_groups: owly-awdl sends each group frame as one unicast copy per peer, so the group queue stays empty. - ibss_rejoin_secs: the supervisor leaves and rejoins the cell this often, so the first beacon never comes. Leaving asserts the firmware, which restarts in about 1 s; owlymon0 and awdl0 survive it. Both are set for 8086:24fd only, which goes from broken to untested. Co-Authored-By: Claude Opus 5.5 --- crates/owly-awdl/src/driver.rs | 13 ++++++++ crates/owly-awdl/src/node.rs | 5 +++ crates/owly-awdl/tests/driver.rs | 42 +++++++++++++++++++++++- crates/owly-radio/drivers.toml | 8 +++-- crates/owly-radio/src/injection/mod.rs | 24 ++++++++++++++ crates/owly-radio/src/injection/setup.rs | 22 ++++++++++--- crates/owly-radio/src/quirks.rs | 8 +++++ 7 files changed, 114 insertions(+), 8 deletions(-) diff --git a/crates/owly-awdl/src/driver.rs b/crates/owly-awdl/src/driver.rs index e4639ac..514bdde 100644 --- a/crates/owly-awdl/src/driver.rs +++ b/crates/owly-awdl/src/driver.rs @@ -271,6 +271,19 @@ impl Driver { } fn transmit(&mut self, at: Time, frame: Frame) { + let cfg = self.node.config(); + if cfg.unicast_groups && frame.to.is_multicast() { + let no_ack = cfg.no_ack; + let peers: Vec = self.node.peers().map(|p| p.mac).collect(); + for mac in peers { + let mut copy = frame.clone(); + copy.bytes[4..10].copy_from_slice(&mac.0); + copy.to = mac; + copy.no_ack = no_ack; + self.transmit(at, copy); + } + return; + } if frame.is_action() { // Built for this moment, its sync TLVs and timestamp with it: by // the next try it would be stale, and the next PSF or MIF is diff --git a/crates/owly-awdl/src/node.rs b/crates/owly-awdl/src/node.rs index 7af678e..48050e2 100644 --- a/crates/owly-awdl/src/node.rs +++ b/crates/owly-awdl/src/node.rs @@ -120,6 +120,10 @@ pub struct Config { pub neighbour_echo: bool, /// Most peers tracked: [`MAX_PEERS`] by default. pub max_peers: usize, + /// Send each broadcast or multicast frame as one unicast copy per peer, + /// for radios whose firmware never sends group frames from an ad-hoc + /// cell and resets when its queue stalls (Intel 8265). + pub unicast_groups: bool, } impl Config { @@ -138,6 +142,7 @@ impl Config { rssi_threshold: Some(-65), neighbour_echo: true, max_peers: MAX_PEERS, + unicast_groups: false, } } } diff --git a/crates/owly-awdl/tests/driver.rs b/crates/owly-awdl/tests/driver.rs index 62304ca..da35e2f 100644 --- a/crates/owly-awdl/tests/driver.rs +++ b/crates/owly-awdl/tests/driver.rs @@ -99,6 +99,14 @@ fn config(n: u8) -> Config { } fn host(n: u8, tx: mpsc::UnboundedSender, rx: mpsc::UnboundedReceiver) -> Host { + host_with(config(n), tx, rx) +} + +fn host_with( + cfg: Config, + tx: mpsc::UnboundedSender, + rx: mpsc::UnboundedReceiver, +) -> Host { let (peers_tx, peers) = watch::channel(Vec::new()); let (send, outbound) = mpsc::unbounded_channel(); let (delivered_tx, delivered) = mpsc::unbounded_channel(); @@ -114,7 +122,7 @@ fn host(n: u8, tx: mpsc::UnboundedSender, rx: mpsc::UnboundedReceiver< }; let netif_read = read.clone(); let running = driver::spawn( - config(n), + cfg, move || { let netif = MemNetif { outbound, @@ -202,6 +210,38 @@ async fn two_nodes_on_an_in_memory_air_meet_and_pass_ipv6() { b.running.stop(); } +#[tokio::test(flavor = "multi_thread")] +async fn unicast_groups_sends_group_frames_to_each_peer_instead() { + let (a_tx, mut from_a) = mpsc::unbounded_channel::(); + let (to_b, b_rx) = mpsc::unbounded_channel(); + let (b_tx, a_rx) = mpsc::unbounded_channel(); + let mut cfg = config(1); + cfg.unicast_groups = true; + let a = host_with(cfg, a_tx, a_rx); + let mut b = host(2, b_tx, b_rx); + let receivers = Arc::new(std::sync::Mutex::new(Vec::new())); + let tap = receivers.clone(); + tokio::spawn(async move { + while let Some(frame) = from_a.recv().await { + tap.lock().unwrap().push(frame.bytes[4..10].to_vec()); + let _ = to_b.send(frame); + } + }); + let met = + tokio::time::timeout(Duration::from_secs(5), b.peers.wait_for(|p| p.len() == 1)).await; + assert!(met.is_ok(), "b never heard a"); + + let receivers = receivers.lock().unwrap(); + assert!(!receivers.is_empty()); + assert!( + receivers.iter().all(|r| r[..] == mac(2).0), + "a sent to {receivers:02x?}" + ); + drop(receivers); + a.running.stop(); + b.running.stop(); +} + #[test] fn a_transport_that_cant_open_fails_the_spawn() { let (peers, _) = watch::channel(Vec::new()); diff --git a/crates/owly-radio/drivers.toml b/crates/owly-radio/drivers.toml index 841c1e7..6a9895b 100644 --- a/crates/owly-radio/drivers.toml +++ b/crates/owly-radio/drivers.toml @@ -111,13 +111,15 @@ issues = [ notes = "Intel Wireless-AC 8260 (NUC6i7KYK, 8086:24f3, kernel 6.12)." [devices."8086:24fd"] -status = "broken" +status = "untested" mode = "exclusive" channels = [6] +unicast_groups = true +ibss_rejoin_secs = 9 issues = [ - "This Intel Wireless-AC 8265's firmware (8265-36) stalls a transmit queue and resets about 10 s after the ad-hoc cell starts on channel 6.", + "This Intel Wireless-AC 8265's firmware (8265-36) never sends the ad-hoc cell's group frames, and stops sending to its stations at the cell's first beacon. Owly sends group frames to each peer instead and rejoins the cell every 9 s, which restarts the firmware: a transfer pauses for about 1 s every 10 s.", ] -notes = "Intel Dual Band Wireless-AC 8265 (EliteBook x360 1030 G3, 8086:24fd, kernel 6.12). The reset repeats until the driver is reloaded. With a hidden AP forced in the cell's place, it runs without resetting but hears no AWDL action frames from the phone." +notes = "Intel Dual Band Wireless-AC 8265 (EliteBook x360 1030 G3, 8086:24fd, kernel 6.12; ASUS X580VD, kernel 7.0.14). Without the quirks the group queue stalls and the firmware resets every ~21 s, until the driver is reloaded. With a hidden AP forced in the cell's place, it runs without resetting but hears no AWDL action frames from the phone. With them, on the X580VD: four photos from an iPhone (10.3 MB) and one to it (1.1 MB in 12 s) in one session. Leaving the cell asserts the firmware (ADVANCED_SYSASSERT 0x3437); owlymon0 and awdl0 survive the restart. Firmware 8265-34 stalls the same way." [drivers.rtw88_8822be] status = "tested" diff --git a/crates/owly-radio/src/injection/mod.rs b/crates/owly-radio/src/injection/mod.rs index f70494c..ecd59b9 100644 --- a/crates/owly-radio/src/injection/mod.rs +++ b/crates/owly-radio/src/injection/mod.rs @@ -254,6 +254,7 @@ impl Injection { let supervisor = tokio::spawn(supervise( ops.clone(), prepared.hostapd, + prepared.rejoin, node.failed(), stopped, state_tx, @@ -343,11 +344,17 @@ impl Backend for Injection { async fn supervise( ops: Arc, mut hostapd: Option, + rejoin: Option<(String, u32, Duration)>, mut failed: watch::Receiver>, mut stopped: watch::Receiver, state: watch::Sender, ) -> Option { let mut check = tokio::time::interval(Duration::from_secs(1)); + let mut rejoin_tick = rejoin.as_ref().map(|(_, _, every)| { + let mut t = tokio::time::interval_at(tokio::time::Instant::now() + *every, *every); + t.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Delay); + t + }); let lost = |why: String| { tracing::warn!("link lost: {why}"); state.send_if_modified(|s| { @@ -366,6 +373,23 @@ async fn supervise( lost(why); } } + _ = async { + match rejoin_tick.as_mut() { + Some(t) => drop(t.tick().await), + None => std::future::pending().await, + } + } => { + let Some((cell, freq, _)) = rejoin.clone() else { continue }; + let ops = ops.clone(); + let joined = tokio::task::spawn_blocking(move || { + let _ = ops.leave_ibss(&cell); + ops.join_ibss(&cell, freq) + }) + .await; + if let Ok(Err(e)) = joined { + tracing::warn!("rejoining the ad-hoc cell: {e}"); + } + } _ = check.tick() => { // A driver that reloads (iwlwifi after a firmware crash) // takes the monitor interface with it (legacy #23). diff --git a/crates/owly-radio/src/injection/setup.rs b/crates/owly-radio/src/injection/setup.rs index fab1693..2a650a6 100644 --- a/crates/owly-radio/src/injection/setup.rs +++ b/crates/owly-radio/src/injection/setup.rs @@ -28,6 +28,9 @@ pub(crate) struct Prepared { pub announce: Announce, /// The hidden AP's hostapd, when the mode runs one. pub hostapd: Option, + /// The ad-hoc cell, its frequency and how often to rejoin it, when the + /// driver's `ibss_rejoin_secs` asks for that. + pub rejoin: Option<(String, u32, Duration)>, } /// Sets the radio up in the station's mode. Undoes what it did if a step @@ -171,11 +174,18 @@ impl Setup<'_> { } let mut hostapd = None; + let mut rejoin = None; let freq = if mode == Mode::ActiveMonitor { self.active_monitor(sta_mac, &freqs)? } else { let freq = if self.station.has(IfType::Adhoc) { - self.ibss_cell(sta_mac, &freqs)? + let (cell, freq) = self.ibss_cell(sta_mac, &freqs)?; + rejoin = self + .station + .quirk + .ibss_rejoin_secs + .map(|s| (cell, freq, Duration::from_secs(s))); + freq } else { let (freq, child) = self.ap_cell(sta_mac, &freqs)?; hostapd = Some(child); @@ -196,7 +206,9 @@ impl Setup<'_> { channel: Channel(channel), presence: Presence::Fixed, }; - Ok(self.finish(mode, radio, sta_mac, Announce::FIXED, hostapd)) + let mut prepared = self.finish(mode, radio, sta_mac, Announce::FIXED, hostapd); + prepared.rejoin = rejoin; + Ok(prepared) } /// AWDL on `radio`, on the station's MAC (AWDL-2), named after the @@ -230,11 +242,13 @@ impl Setup<'_> { awdl.no_ack = no_ack; } awdl.amsdu = self.settings.tx_amsdu; + awdl.unicast_groups = self.station.quirk.unicast_groups; Prepared { mode, awdl, announce, hostapd, + rejoin: None, } } @@ -332,7 +346,7 @@ impl Setup<'_> { /// Cards that refuse an ad-hoc interface beside the station, even down /// (some AX211s), get the station itself made the cell. Returns the /// frequency it started on. - fn ibss_cell(&mut self, mac: MacAddr, freqs: &[u32]) -> Result { + fn ibss_cell(&mut self, mac: MacAddr, freqs: &[u32]) -> Result<(String, u32), Error> { let ops = self.ops; let name = self.station.name.clone(); if ops.exists(IBSS) { @@ -379,7 +393,7 @@ impl Setup<'_> { } // mac80211 scans the channel once before it starts the cell. if self.wait(Duration::from_secs(10), || ops.link_freq(&cell) == Some(f)) { - return Ok(f); + return Ok((cell, f)); } tracing::info!("the ad-hoc cell on {f} MHz didn't start"); let _ = ops.leave_ibss(&cell); diff --git a/crates/owly-radio/src/quirks.rs b/crates/owly-radio/src/quirks.rs index 6153beb..14c4674 100644 --- a/crates/owly-radio/src/quirks.rs +++ b/crates/owly-radio/src/quirks.rs @@ -44,6 +44,14 @@ pub struct Quirk { /// selection, which doesn't use it yet. #[serde(default)] pub supports_tx_ldpc: bool, + /// Send broadcast and multicast as unicast to each peer: the firmware + /// never sends group frames from the ad-hoc cell. + #[serde(default)] + pub unicast_groups: bool, + /// Leave and rejoin the ad-hoc cell this often, in seconds: the + /// firmware stops sending to its stations from the cell's first beacon. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub ibss_rejoin_secs: Option, /// Known problems on this hardware, one sentence each, for the person /// at the computer. The probe reports them. #[serde(default)] From 0ef20980b67500c2bed1018552682452656dfcef Mon Sep 17 00:00:00 2001 From: "Tristan (t4t5)" Date: Fri, 20 Nov 2026 11:43:05 +0000 Subject: [PATCH 2/2] Guard the 8265 quirks against multicast peers and a zero rejoin interval Co-authored-by: Moein Halvaei --- crates/owly-awdl/src/driver.rs | 9 ++++++++- crates/owly-awdl/tests/driver.rs | 32 ++++++++++++++++++++++++++++++ crates/owly-radio/src/quirks.rs | 34 ++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/crates/owly-awdl/src/driver.rs b/crates/owly-awdl/src/driver.rs index 514bdde..a8867fe 100644 --- a/crates/owly-awdl/src/driver.rs +++ b/crates/owly-awdl/src/driver.rs @@ -274,7 +274,14 @@ impl Driver { let cfg = self.node.config(); if cfg.unicast_groups && frame.to.is_multicast() { let no_ack = cfg.no_ack; - let peers: Vec = self.node.peers().map(|p| p.mac).collect(); + // A peer address comes from the air. A group address would + // recurse into this branch and could never be a unicast copy. + let peers: Vec = self + .node + .peers() + .map(|p| p.mac) + .filter(|mac| !mac.is_multicast()) + .collect(); for mac in peers { let mut copy = frame.clone(); copy.bytes[4..10].copy_from_slice(&mac.0); diff --git a/crates/owly-awdl/tests/driver.rs b/crates/owly-awdl/tests/driver.rs index da35e2f..a9ca201 100644 --- a/crates/owly-awdl/tests/driver.rs +++ b/crates/owly-awdl/tests/driver.rs @@ -242,6 +242,38 @@ async fn unicast_groups_sends_group_frames_to_each_peer_instead() { b.running.stop(); } +#[tokio::test(flavor = "multi_thread")] +async fn unicast_groups_never_recurses_on_a_spoofed_multicast_peer() { + let (a_tx, mut from_a) = mpsc::unbounded_channel::(); + let (to_a, a_rx) = mpsc::unbounded_channel(); + let mut cfg = config(1); + cfg.unicast_groups = true; + let mut a = host_with(cfg, a_tx, a_rx); + + // A valid advertisement with an invalid transmitter address can still + // reach the peer table. It must never become another group transmission. + let mut spoofed = config(2); + spoofed.addr = MacAddr::BROADCAST; + let mut sender = owly_awdl::Node::new(spoofed, owly_awdl::Time(1)); + for action in sender.handle(owly_awdl::Input::Timer(owly_awdl::Time(1))) { + if let owly_awdl::Action::Transmit { frame, .. } = action { + to_a.send(Received { + bytes: frame.bytes, + rssi: Some(-40), + }) + .unwrap(); + } + } + tokio::time::timeout(Duration::from_secs(2), a.peers.wait_for(|p| !p.is_empty())) + .await + .expect("the spoofed peer was never processed") + .unwrap(); + tokio::time::sleep(Duration::from_millis(300)).await; + assert!(from_a.try_recv().is_err(), "sent to a group address"); + assert!(a.running.failed().borrow().is_none()); + a.running.stop(); +} + #[test] fn a_transport_that_cant_open_fails_the_spawn() { let (peers, _) = watch::channel(Vec::new()); diff --git a/crates/owly-radio/src/quirks.rs b/crates/owly-radio/src/quirks.rs index 14c4674..a27e705 100644 --- a/crates/owly-radio/src/quirks.rs +++ b/crates/owly-radio/src/quirks.rs @@ -164,6 +164,9 @@ impl Quirk { if self.channels.is_empty() { return Err("channels is empty".into()); } + if self.ibss_rejoin_secs == Some(0) { + return Err("ibss_rejoin_secs must be greater than zero".into()); + } Ok(()) } } @@ -247,6 +250,37 @@ mod tests { assert_eq!(q.notes, ""); } + #[test] + fn intel_8265_workarounds_are_opt_in_and_device_specific() { + let quirks = packaged(); + let (q, source) = quirks.get("iwlwifi", Some("8086:24fd")); + assert_eq!(source, Source::Device); + assert_eq!(q.status, Status::Untested); + assert_eq!(q.mode, Mode::Exclusive); + assert_eq!(q.channels, [6]); + assert!(q.unicast_groups); + assert_eq!(q.ibss_rejoin_secs, Some(9)); + + for id in ["8086:51f0", "8086:24f3", "8086:095a"] { + let (q, _) = quirks.get("iwlwifi", Some(id)); + assert!(!q.unicast_groups, "unexpected workaround for {id}"); + assert_eq!(q.ibss_rejoin_secs, None); + } + } + + #[test] + fn a_zero_ibss_rejoin_interval_is_rejected_before_starting_the_radio() { + let result = Quirks::parse( + r#" + [drivers.iwlwifi] + status = "untested" + mode = "exclusive" + ibss_rejoin_secs = 0 + "#, + ); + assert!(result.is_err(), "a zero interval panics the supervisor"); + } + #[test] fn mistakes_are_refused() { let text = r#"