Skip to content

feat(start-wrt): turn flow offloading back on with the flowtable fixed - #4691

Open
Dominion5254 wants to merge 2 commits into
masterfrom
wrt/flowtable-wifi-offload
Open

Dominion5254 wants to merge 2 commits into
masterfrom
wrt/flowtable-wifi-offload

Conversation

@Dominion5254

@Dominion5254 Dominion5254 commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

1.4.0 ships with flow offloading off (#4689) because the kernel dropped offloaded packets towards Wi-Fi clients. This fixes the kernel and turns offloading back on, as 1.4.1.

Cause

Linux 6.18.y backported b5964aac51e0 ("netfilter: flowtable: consolidate xmit path") and 2bdc536c9da7 ("netfilter: flowtable: always set route tuple out ifindex"). An offloaded neigh-xmit flow now transmits on the device that forward path discovery found instead of the route's device. For a route that ends at a bridge, that breaks two ways:

  • Wi-Fi clients. mac80211 reports no forward path for mt7915 without WED, so the flow is offloaded with no output device. The fast path tears it down and drops the packet, the classic path offloads it again, and up to every other packet is lost. This is the stall fix(start-wrt): turn off flow offloading #4689 worked around; the GSO explanation in that PR was wrong.
  • Wired clients on a single-profile router. With one profile the LAN is br-lan with no VLAN devices, and discovery resolves to the bridge port. The flow bypasses the bridge: it skips the bridge output hook where startwrt_pp_v6_bind binds a published IPv6 address to its device, and it keeps leaving through that port after the client has moved to another.

The fast path also wrote neigh->ha into the frame without looking at the neighbour's state, so a flow to an unresolved or departed neighbour was sent to an all-zero or stale MAC, which a bridge floods.

Mainline's fix (871df5007eda, 3ae37eafd366) is not in 6.18.y, and it needs the bridge ports in the flowtable, which the fw4 in OpenWrt 25.12 does not list.

Change

  • patches-6.18/0005: call neigh_event_send() before the fast path uses the neighbour address, as the classic output path does.
  • patches-6.18/0006: transmit a neigh-xmit flow through the route's device unless the path's last device is a flowtable device, as before those commits.
  • RestoreFlowOffloading sets flow_offloading for a router that has no value; an explicit value stays. The firstboot firewall sets it for a new install.
  • A router that skips releases runs EnableFlowOffloading, DisableFlowOffloading and RestoreFlowOffloading in one pass. The activity entry leaves out a migration that a later one in the same pass undoes.
  • "Bumping the kernel" in projects/start-wrt/AGENTS.md gains a step to re-check both patches: they still apply over an upstream fix that changes what they do.
  • Version 1.4.1.

Changelog fragments & versions fails until start-wrt/v1.4.0 is tagged (1.4.1 is ahead of the expected 1.4.0). Re-run it after the tag; do not merge before the cut.

Verification

On 20e89e5 (based on master 35a38d8):

  • make start-wrt-test: 949 + 37 passed. make start-wrt-format-check and prettier on the changed Markdown: clean.
  • Both patches apply to a pristine 6.18.57 tree.

Live bench, K1, image built from this branch's patches, offloading on:

Check Kernel without the patches / with 0006's first form This branch
WAN → Wi-Fi TCP ~10 KB/s (stock 1.4.0 image) 103 Mbit/s
Second profile, wired → Admin Wi-Fi TCP ~0.1 Mbit/s 48 Mbit/s on a 2.4 GHz link
Single profile: bridge output hook, 204 MiB TCP download saw 1 packet saw all of it
Single profile: bridge output drop rule shaped like the IPv6 MAC bind, 800 offloaded UDP replies dropped 0 dropped 800
Single profile: forwarding entry moved to another port mid-download flow kept leaving the old port flow followed it
Two profiles: the same hook and drop-rule checks all seen, dropped 800 all seen, dropped 800
Client leaves mid-flow (UDP) flooded for the whole run, then to 00:00:00:00:00:00 stops when the neighbour fails, as the classic path does

Throughput against the image before 0006's second hunk, single profile: wired TCP 790 → 785 down, 940 → 941 up; wired UDP at 600 Mbit/s 0% loss both; Wi-Fi 5 GHz TCP 102 → 103 down, 114 → 112 up. Two profiles: wired 800 down, 939 up.

VPN, wired client: outbound 654 down / 549 up Mbit/s, inbound 653 / 677, UDP at 100 Mbit/s 0% loss. The upload figure is the same with offloading off (546). Only LAN → tunnel is offloaded; the tunnel devices are not flowtable devices.

Migration, with the 1.4.1 binary on a router at record 15 with no flow_offloading: a reboot advanced the record to 16, set the option, brought the flowtable up, and logged "Updated settings for v1.4.1 to speed up forwarding of established connections". A rerun changed nothing; an explicit 0 at record 15 stayed 0. With the migrated config: wired 797 down / 941 up, Wi-Fi 103 / 113, 0% UDP loss, no kernel warnings, bench.sh smoke passes.

Added after review, same kernel image, single profile, offloading on:

  • IPv6 between LAN and WAN (static WAN address with a routed prefix): wired TCP 928 down / 928 up Mbit/s, wired UDP at 600 Mbit/s 0% loss (33% with offloading off), Wi-Fi 100 / 111, Wi-Fi UDP at 40 Mbit/s 0% loss. The bridge output hook counted every IPv6 TCP packet to both clients.
  • IPv6 MAC bind end to end: a UDP port published to a wired client through published-ports set, then the router's neighbour entry for that address pointed at another LAN client. No spoof: 200 of 200 packets delivered. Spoof before the flow: 200 of 200 dropped by the bind. Spoof applied mid-flow: 212 delivered, then 288 dropped. The other client received none, and the flow was offloaded in each case.
  • PPPoE WAN: wired TCP 844–862 down / 685–690 up with offloading on, 417 / 532 with it off; wired UDP at 600 Mbit/s 0% loss; Wi-Fi 105 / 102; the flowtable lists pppoe-wan; a reboot comes back with the session up and 860 down. The upload retransmissions are the same with offloading off.

Not run: a clean image build. This PR's CI skips Build OpenWrt image, and the local build was incremental.

Linux 6.18.y backported b5964aac51e0 ("netfilter: flowtable: consolidate
xmit path") and 2bdc536c9da7 ("netfilter: flowtable: always set route
tuple out ifindex"), which make an offloaded neigh-xmit flow transmit on
the device that forward path discovery found instead of the route's
device. For a route that ends at a bridge that breaks two ways:

- mac80211 reports no forward path for mt7915 without WED, so a flow
  towards a Wi-Fi client is offloaded with no output device: the fast
  path tears it down and drops the packet, the classic path offloads it
  again, and up to every other packet is lost.
- For a wired client on a bridge without VLAN devices, the single-profile
  layout, discovery resolves to the bridge port. The flow bypasses the
  bridge, so it skips the bridge output hook that binds a published IPv6
  address to its device, and keeps leaving through that port after the
  client has moved to another.

Carry two kernel patches until 6.18.y has a fix:

- 0005 calls neigh_event_send() before the fast path uses the neighbour
  address, as the classic output path does, so an unresolved or departed
  neighbour is probed instead of being sent to an all-zero or stale MAC.
- 0006 transmits a neigh-xmit flow through the route's device unless the
  path's last device is a flowtable device, as before those commits.

The kernel bump steps now say to re-check both patches, which still apply
over an upstream fix that changes what they do.
1.4.0 shipped with flow offloading off because the kernel dropped
offloaded packets towards Wi-Fi clients. With the flowtable patches in
place, RestoreFlowOffloading sets it for a router that has no setting, and
the firstboot firewall sets it for a new install. An explicit value stays.

A router that skips releases runs EnableFlowOffloading,
DisableFlowOffloading and RestoreFlowOffloading in one pass; the activity
entry names only the last of a migration and the one that undoes it.

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved on code at 20e89e5656b549c479808bdfb21fc90580e29f29; it merges cleanly with current master. No correctness changes requested.

Before merge: release/tag StartWRT 1.4.0 and rerun the failing Changelog fragments & versions check. Its log confirms the documented mismatch: expected 1.4.0, found 1.4.1. Other CI remains pending; this approval does not establish passing CI.

Brief

  • Restores software flow offloading for fresh installs and upgrades with no saved setting, while preserving an explicit disable. The append-only migration reuses the existing enable helper and migration record; it adds no separate setting or API contract. Updates that skip releases still run the intervening migrations, but their activity summary omits effects subsequently undone in the same pass.
  • Fixes two independent kernel failures before restoring that default. The route-device fallback avoids dropping Wi-Fi-bound packets after failed path discovery and avoids bypassing bridge output filtering or pinning wired traffic to an obsolete bridge port. Both IPv4 and IPv6 neighbour-transmit paths now drive neighbour resolution/probing before using the destination MAC; an unusable neighbour tears down the flow and drops that packet, leaving subsequent packets to classic forwarding.
  • Reuses the kernel neighbour state machine rather than inventing neighbour tracking. The intentional departure from mainline's fail-closed discovery changes preserves acceleration with the pinned OpenWrt firewall, whose software flowtable lists zone devices rather than their bridge ports. Carrying these patches costs an explicit semantic review at each kernel bump; the contributor instructions now require it.

Implementation diff: +67 / −5 lines in 5 files (excludes lockfiles, tests, docs, release notes, and changelog). Kernel patches count their stored unified-diff payload, excluding explanatory headers.

Evidence and limits

The author reports 949 + 37 passing Rust tests, clean scoped formatting, and patch applicability to pristine Linux 6.18.57. Recorded K1 bench evidence covers the Wi-Fi stall, bridge output/drop enforcement, movement between bridge ports, departed neighbours, throughput, VPN forwarding, reboot migration, replay, and explicit-disable preservation. Reported WAN-to-Wi-Fi TCP improved from approximately 10 KB/s on the stock image to 103 Mbit/s with the patches.

I traced the patches against the pinned kernel source, neighbour state machine, flow-route ownership, OpenWrt firewall device selection, and migration callers/tests. I ran no builds or tests. End-to-end PPPoE and LAN/WAN IPv6, the actual IPv6 MAC-spoof scenario, and a clean image build remain unverified; the recorded bridge-hook enforcement test used an analogous IPv4 rule. CI's OpenWrt image build is skipped; automated tests, formatting/lockfiles, generated artifacts, and binary builds are still running. Prettier, conflict-marker, and dependency-license checks have passed.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested for base integration: git merge-tree --write-tree origin/master 20e89e5656b549c479808bdfb21fc90580e29f29 confirms a content conflict in projects/start-wrt/backend/ctrl/src/migrate.rs against master 9cef87c9b09ced9dc28a588a22b96e808357d34f.

The proposal merges that base while keeping its TurnOffRemoteAccess migration as entry 16 and appending RestoreFlowOffloading as entry 17. Keeping this order is necessary: routers with record 16 have already completed Remote Access migration and must still restore offloading. Both enum variants and their handlers remain. The conflicting legacy-offloading test keeps this PR's direct helper invocation, rather than running the full runner that now restores offloading afterward.

The proposed merge is conflict-free against that base. As reviewer, I have not run builds or tests and have not changed the PR branch. Please adopt the base integration, verify the resolved migration behavior, and re-request review. My earlier code approval does not cover this unresolved integration.

Proposed changes: 20e89e5...proposal/4691

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-white

helix-white commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Confirmed against master 878fd5b402760c3c8d889b28e2a62d5b713a163a: unchanged PR head 20e89e565 still conflicts in projects/start-wrt/backend/ctrl/src/migrate.rs; refreshed proposal/4691 at 5a297eaad merges cleanly. It preserves Remote Access migration at entry 16, automatic-transport splitting at entry 17, and appends flow-offloading restoration at entry 18. Author integration, verification, and renewed review remain outstanding. No builds or tests were run by this reviewer and the PR branch is untouched. Repeated implementer-style repair notices reaching this reviewer are tracked in https://github.com/Start9Labs/helix-startos-internal/issues/71.

helix-white added a commit that referenced this pull request Nov 14, 2026
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR still conflicts in projects/start-wrt/backend/ctrl/src/migrate.rs against master 4d58b935488b6699f8399f280ed0b343aec7a933. Master has now appended another migration, so the earlier proposal also needed updating.

Refreshed proposal/4691 at 5a297eaad merges current master, preserves TurnOffRemoteAccess as entry 16 and SplitAutomaticForwardTransports as entry 17, then appends RestoreFlowOffloading as entry 18. This keeps routers with migration record 17 from skipping restoration and retains master's transport-splitting migration and its regression coverage. No published migration is reordered.

The proposal merges cleanly with that base. It is a reviewer proposal only: no builds or tests were run and the PR branch remains untouched. Author integration, verification of the adopted resolution, and renewed review remain required.

Proposed changes: 20e89e5...proposal/4691

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants