Skip to content

feat(start-wrt): keep reservations and published ports per profile - #4466

Merged
dr-bonez merged 16 commits into
masterfrom
wrt/reservation-profile-subnet
Nov 9, 2026
Merged

dr-bonez merged 16 commits into
masterfrom
wrt/reservation-profile-subnet

Conversation

@Dominion5254

@Dominion5254 Dominion5254 commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

dnsmasq ignores a dhcp-host address outside the subnet it serves the device from, but StartWRT stored one reservation per device and treated a profile change inconsistently. When a device moved itself to another profile, its reservation silently stopped applying while the Devices page still showed it with the lock. When the router moved it, by changing an Ethernet port's profile or a Wi-Fi password's, StartWRT deleted its reservation and published ports, so moving it back did not restore them.

This change gives each device one reservation per Security Profile and treats both kinds of move the same way. Nothing is deleted: settings for the profile the device left stay, show as inactive, and apply again when it returns. Deleting the profile itself deletes them.

1. One reservation per profile.

  • Each reservation is its own DHCP host section. The first section keeps the device's settings (name, permissions), and every section carries the name. dnsmasq answers from the first dhcp-host line for a MAC that fits the serving subnet, and a line without an address fits every subnet. So while any reservation remains, every section holds one (reservations.rs).
  • devices.update sets the reservation in the profile its address belongs to, replacing the one there. With Reserve off it deletes the reservation ipv4 names (with ipv4 empty, the one in the device's current profile). A new remove_ipv4_reservations deletes others.
  • With Reserve off, the device page sends the address it was showing, not the field's value. An address typed before turning Reserve off would otherwise match no reservation, so the save would report success and keep the reservation.
  • A new reservation must be a host address in the subnet of the profile the device is on (any profile for a device the router can't place), as before. An unchanged one is never rechecked.
  • It refuses an address another device has reserved: dnsmasq does not start with one address on two hosts, and nothing checked this before.
  • It refuses deleting a reservation an enabled published port forwards to (the UI already locked the switch). Replacing a reservation within its profile moves that profile's ports to the new address. The device page reloads its port targets after such a save.
  • devices.list replaces inactive_ipv4_reservation with ipv4_reservations: each reservation, its profile, and whether DHCP applies it.

2. Published ports belong to a profile.

  • A stored port keeps the profile of the address it forwards to and follows the device's reservation there, whichever profile the device is on. Editing, disabling or re-enabling it while the device is away keeps it there.
  • A new port goes to the device's address on the profile it is on, reserving it there if needed. A fresh target another device has reserved is refused (InvalidValue, naming the port and the holder) rather than left forwarding to an address the other device can take; a port that already forwarded there keeps its target.
  • A port for a profile the device is not on reports a new inactive status: "Applies when the device is on the profile". The zone check that refused such ports is gone.
  • The UI no longer reserves the device's address through devices.update before saving a port. The backend reserves it in the right profile.

3. Router-side moves mirror device-side moves.

  • ethernet.set and wifi.set no longer delete published ports or clear reservations.
  • confirm_published_port_deletion becomes preview: it applies nothing and returns leaving_profile, the devices that keep a reservation or published port for the profile they leave. The CLI now applies by default rather than silently previewing.
  • The Ethernet confirmation and a new Wi-Fi confirmation name those devices: " will keep their reserved addresses and published ports for the profile. These apply again when they're back on it."

4. Automatic forwards and DNS publishing follow the device.

  • A reservation keeps an automatic (PCP/UPnP) forward bound only while the device has no lease on file. Once the device takes an address on another profile, the sweep removes the stale forward and the device can request it again there. The newest lease across profiles counts.
  • DNS publishing accepts updates from any of the device's reservations. An offline device's name resolves on each profile to its reservation there.

5. Placement of a Wi-Fi client that changed profile.

devices.list never pings Wi-Fi clients, because hostapd decides whether they're online. After a profile move, the old STALE neighbor entry could therefore outrank the current one, and the device was shown on its old profile. Ties now go to the bridge the FDB learned the MAC on, or, while the FDB holds it on several VLANs, the subnet of its newest lease. A REACHABLE entry still wins, which leaves the existing ~30-second window after a move. published-ports.set placed a device by neighbour rank alone, so a new port could land in the old profile; it now uses the same tie-break.

6. Deleting a profile deletes the settings kept for it.

  • profiles.delete deletes the reservations in the profile's subnet and the published ports forwarding into it, IPv4 redirect and IPv6 rule, with the profile. A device's reservations in other profiles and its settings stay. Before, both were left behind: a port into the deleted zone reported active while fw4 dropped its redirect, and after the next published-ports save it fell back to the device's current zone with a target in no subnet. Section 3 makes that state easy to reach.
  • It returns what it deleted, and with preview deletes nothing. The UI previews before its confirmation, which lists them: "IPv4 reservations deleted with this profile: … Published ports deleted with this profile: …". The CLI prints the same lists.
  • published-ports.set and the profile delete use one helper to identify a published port's firewall sections.
  • Automatic forwards into the profile are left to the port-control sweep, which drops each once its device no longer holds the address and no reservation pins it.

API_CONTRACT.md, docs/src/{devices,published-ports,ethernet,wifi,security-profiles}.md, the five dictionaries and the mock API are updated. The PR's patch fragment is replaced by a highlight fragment and a routine one (both minor; the version stays 1.4.0).

Implementation diff: +2027 / −1049 lines in 37 files (excludes lockfiles, tests, docs, release notes, and changelog), measured at 542fbc09b; the later merge only renumbers existing lines. Generated bindings.schemas.ts and bindings.ts (+263 / −104) and the mock API (+110 / −35) count as implementation.

Verification

  • make start-wrt-test on 99dc70d96, after merging master: 845 + 21 passed. npm run check:wrt, npm run check:i18n:wrt, make start-wrt-rpc-bindings-check, changelog.mjs check-version for every product and Prettier on the dictionaries also passed there. CI is running on this head: "Changelog fragments & versions", "Build riscv64 binary" and the rest are pending. Before that merge, make start-wrt-test: 836 + 21 passed. The two profile-delete tests (reservations and ports in the deleted profile go, a device's other reservation and settings and other profiles' ports stay; a preview lists them and leaves every config file unchanged) fail with the deletion step skipped. New tests cover the section rewrite and its invariants, per-profile replacement, the duplicate-address and in-use refusals, ports following a replaced reservation, port targets and the zone fallback, the Inactive status, the leaving-profile list, automatic-forward binding with a lease elsewhere, newest-lease selection, the placement tie-break in devices.list and published-ports.set, the claimed-target refusal, and offline name resolution.
  • npm run check:wrt, npm run check:i18n:wrt, make start-wrt-rpc-bindings-check, rustfmt and prettier on the touched files, and changelog.mjs check-version pass. The production web build (strict templates) passes in the deploy.
  • K1 bench, with a real Wi-Fi client joining through per-profile passwords and a synthetic wired client on profile VLANs:
    • Device moves itself. Reserved on Admin, with a published port reachable from the WAN. Rejoined on Guest: it got a pool address, the Admin reservation and port stayed in config and showed inactive with the reason, and the port stopped answering. Reserved on Guest: a second host section was written, every dnsmasq instance carried both lines, and the client leased the Guest address. A new port while on Guest went to the Guest reservation and zone and answered from the WAN. Back on Admin: it re-leased the Admin reservation, the Admin port answered again, and the Guest port went inactive.
    • Router moves it. The Wi-Fi preview of moving Guest's only password to IoT named the client and changed nothing. Applying left the dhcp and firewall configs byte-identical. On reassociation the client got an IoT pool address with both reservations and both ports inactive. Moving the password back restored the Guest reservation and port. The Wi-Fi delete preview and the Ethernet port preview each named the expected device and changed nothing.
    • Edits and refusals. An inactive port was edited while away and kept its target and zone. An address in another profile, another device's address, and deleting a reservation an enabled port uses were each refused with nothing written. Disabling that port allowed the deletion, and re-enabling it re-reserved its address in its own profile. Replacing an Admin reservation moved the Admin port to the new address, which answered after the client renewed.
    • Automatic forwards. A PCP mapping from the reserved Admin address was granted and answered from the WAN. After the client moved to Guest, the sweep removed it within a minute, although the Admin reservation and lease were still on file.
    • Placement. Before the fix, a Wi-Fi client back on Guest was listed on Admin because of STALE Admin entries; afterwards it was placed on Guest. With the FDB holding it on two VLANs and kernel order favouring the old entry, the newest lease placed it correctly.
    • Forget removed every section of a device with reservations on two profiles, and their dnsmasq lines.
    • UI in headless Chromium against the router: the device page lists inactive reservations (remove disabled while a port uses one). Removing one and saving deleted it and left a single section. Published ports show the Inactive status, and the Wi-Fi delete confirmation names the device and cancels cleanly.
    • bench.sh smoke passes after restoring the router's config snapshot.
  • K1 bench of the placement and auto-reserve changes, with two synthetic clients on profile VLANs: reserving client B's leased address for client A and then publishing a port for B was refused with the port label and the holder's name; with A's reservation dropped, the same save reserved the address on Guest and the port went Active in the Guest zone. Moving B to IoT and publishing a second port put the Guest port on Inactive with its reason and the new port in the IoT zone with a second reservation, with B's stale Guest neighbour entry outranked. bench.sh smoke passes after restoring the snapshot.
  • K1 bench of profile deletion, on a throwaway profile with a synthetic client reserved in Admin and in that profile, plus an IPv4 published port into it:
    • The RPC preview and startwrt profiles delete --preview listed only that reservation and port, and every UCI config was byte-identical afterwards.
    • In headless Chromium against the router, the confirmation listed both, and No changed nothing. Yes deleted the profile: the client kept one host section with its Admin reservation, name and DNS-publishing permission; the port and the IPv6 hairpin copies for the deleted zone were gone; every other port and its rules stayed and stayed loaded. fw4 check passed, nothing in /etc/config named the deleted interface, and DHCP leased the client its Admin reservation.
    • Adding and removing a published port through published-ports.set left the other ports' sections intact. bench.sh smoke passes. During the delete's reload, dnsmasq logged one error binding DHCP socket for the deleted profile's VLAN device, then reloaded cleanly; that reload sequence is unchanged by this PR, and I did not compare it against the previous binary.
    • Not benched: deleting an IPv6 published port. The bench's upstream offers no global IPv6, so the router cannot save a new one; the unit test covers the IPv6 rule.
  • Mock-API UI, headless Chromium: turning Reserve off after typing a new address deletes the reservation on this head, and keeps it on the previous head. The profile delete confirmation shows the plain prompt for a profile with nothing to delete.
  • Not benched: applying an Ethernet port profile change. The bench's only LAN port also carries the StartOS bench client. The apply path only lost its deletion step, and its preview was benched.

Observed during the bench, unchanged by this PR: restarting the daemon while a web UI session is connected logs ERROR start_core::error: deadline has elapsed. It reproduced with the browser connected and not without.

Helix-Harness: claude-code
Helix-Model: claude-fable-5-1

Device page: inactive reservations list; removal is disabled while a port forwards to the address

Published Ports: the blue dot marks the new inactive status

Profile delete confirmation listing the reservations and ports deleted with it

Screenshots are from a mock-API demo build of 542fbc09b, with one extra mock reservation and one port set to inactive. The Ethernet and Wi-Fi leaving-profile confirmations were not captured.

…bnet

Validate reservations against the device's profile subnet on save (UI and
devices.update), report a reservation a profile move left behind instead of
treating it as in effect, and keep published ports from forwarding to 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.

Requesting changes on b969dc2a191ddef6ac434bcd770a397a188f5258 for three reachable validation regressions:

  1. P2 — A valid reservation can be rejected after roaming (devices.rs:1278–1288). live_device_vlan passes an empty confirmation set to choose_ipv4_entry. With an old Admin neighbor in DELAY and the current Guest neighbor in STALE, the old entry wins over both the current bridge FDB and lease. Saving a Guest reservation then fails, although listing can correctly show Guest using its probe results. This is distinct from the already documented old-REACHABLE window. The proposal supplies probe results using the existing candidate/probe implementation.

  2. P2 — A valid new or edited port can be rejected against an old neighbor (published_ports.rs:1375–1385). The new mandatory zone comparison consumes arp_interface from a resolver that takes the first bridge neighbor, regardless of state. An old Admin entry before a current REACHABLE Guest entry rejects a correctly reserved Guest device. The old first-entry behavior predates this PR; making it a rejection criterion is new. The proposal reuses parse_neigh_output and the probe-aware chooser for address/interface selection instead of maintaining another parser and election rule.

  3. P2 — Unplaced offline devices are incorrectly restricted to their stored reservation's profile (devices.rs:1757–1770, consumed by web/src/app/routes/devices/utils.ts:90–97). After neighbor/FDB/lease state disappears, a reservation in Admin alone produces an Admin profile_network. The new form validator therefore prevents changing it to a Guest reservation, although devices.update deliberately accepts any profile subnet when placement is unknown. The proposal keeps the reservation-derived profile label for display, but derives validation metadata from observed placement only.

Also included: a correction to the pre-existing dual-stack status error where an inactive IPv4 reservation plus a stale IPv6 prefix reports partial although neither forward works. The new test failed with Partial on the reviewed head; it passes with the proposal. The same correction covers missing IPv4 plus a stale IPv6 prefix. Redundant parser/commentary cleanup is confined to the affected code.

Verification: git merge-tree --write-tree origin/master HEAD was clean for the reviewed head. Through helix-build, the scoped published-port tests passed (92), the device tests passed (40), and the touched Rust files were formatted with the pinned formatter; git diff --check passed. New fixtures exercise old DELAY/current confirmed STALE and old STALE/current REACHABLE placement. I read the author's recorded frontend/bindings and bench verification rather than repeating those builds. No live router test was performed here; CI remains pending. The proposal retains the documented old-REACHABLE window and adds existing bounded ping verification to effectful reservation/port resolution.

Proposed changes: b969dc2...proposal/4466

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

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

Copy link
Copy Markdown
Member

Cross-review requested.

@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.

Approving 15af3138c3392f971204fb31f9b98fd6fe903c9b. The new commit's tree is identical to proposal/4466, so each point from my earlier review is resolved as proposed: reservation saves place the device using ping-verified neighbour ranking; port resolution uses the shared neighbour parser and that same ranking instead of taking the first bridge entry; profile_network comes from observed placement only; and a dual-stack port with an inactive or missing IPv4 forward and a stale IPv6 prefix reports error. git merge-tree --write-tree origin/master HEAD is clean. The only start-wrt-adjacent master commit since the merge base (#4451) is in core and does not touch these files.

Brief

Summary. dnsmasq ignores a dhcp-host address outside the subnet it serves the device from. Before this PR, StartWRT accepted such reservations, showed them with the lock icon, and published ports to an address the device never held. After it:

  • devices.update refuses a changed reservation outside the subnet of the device's current profile, or one on that subnet's network, broadcast or router address. The profile comes from live neighbour, FDB and lease state; the stored reservation is never used. An unchanged reservation always passes, so renaming a device or changing a permission never fails. If the router cannot place the device (offline, or after a reboot), the reservation may go in any profile's subnet but not outside all of them.
  • devices.list gains inactive_ipv4_reservation (set when the reservation is not in effect; ipv4 is then the address actually held) and profile_network (router address and prefix of the observed profile; empty when unplaced). The UI hides the lock icon, shows a warning on the device page and validates the field inline. The edit form still loads the stored reservation, so an unrelated save keeps it.
  • Published ports: an IPv4 port on such a device reports error, or partial if its IPv6 forward still works, with the reason "IPv4 reservation outside the device's profile". published-ports.set refuses adding, enabling or changing an IPv4 port whose reservation is in a different zone from the device's placement. A stored enabled port that is unchanged is exempt, so one stale port never blocks saving the rest of the list.
  • Also fixed: a dual-stack port on an out-of-date IPv6 prefix reported partial when its IPv4 forward also didn't work. It now reports error.
  • Port resolution's private neighbour parser, which took the first bridge entry regardless of state, is removed in favour of parse_neigh_output and choose_ipv4_entry, which the device list already used.

Implementation diff: +441 / −114 lines in 17 files (excludes lockfiles, tests, docs, release notes, and changelog). Generated bindings.schemas.ts (+46) and the mock API are counted as implementation.

Approach. Placement reuses the device list's existing chooser: candidates from ip neigh, verified with the existing bounded ping of unconfirmed MACs. So the list, reservation saves and port saves place a roaming device the same way. Effectful saves now pay that bounded ping for devices with only unconfirmed neighbour entries; the list already did.

Decisions.

  • Unplaceable devices are permissive. A device with no neighbour, FDB or lease entry can be given a reservation in any profile's subnet. Refusing would block reserving for a switched-off device, but it means a reservation in the wrong profile can be saved and only shows as inactive once the device returns.
  • DNS name follows the reservation. The name record still points at the reserved address while it is inactive. Making it follow the live address would rewrite dnsmasq config on every profile move.
  • Known limitation, unchanged by this PR. For about 30 seconds after a VLAN change, an old REACHABLE neighbour entry can still place the device on its previous profile (documented on choose_ipv4_entry). A save in that window is judged against the old profile.

Testing.

  • On the reviewed tree (identical to the proposal), helix-build ran the scoped Rust tests: published ports 92 passed, devices 40 passed. Pinned rustfmt and git diff --check passed. New fixtures cover an old DELAY entry beside a verified STALE one, an old STALE entry listed before a REACHABLE one, unplaced devices, and the dual-stack stale-prefix status. The status test failed with Partial before the fix.
  • The author's recorded evidence covers the full make start-wrt-test (805 + 18), check:wrt, i18n, bindings and format checks, and a K1 bench with synthetic clients on profile VLANs. The bench exercised refusals, profile moves, unchanged-port saves and unplaced devices on the head commit.
  • I captured screenshots of the final UI from a mock-API demo build of this head. One mock reservation was moved into another profile's subnet to produce the inactive state; they follow in a comment.
  • CI: "Run Automated Tests" and "Generated Artifacts" are still pending. All other checks have passed or are skipped.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5

@helix-white
helix-white requested a review from dr-bonez October 28, 2026 18:00
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
@helix-white

Copy link
Copy Markdown
Member

Merged current master (d510a40) while preserving the PR's commits. Added German, Spanish, French and Polish companions for its changed fragments, with canonical audience metadata and generated Highlights/Security sections. Removed summary-only release files where applicable and retained Important notices.

Verification: affected-product version checks, compilation of complete localized note bundles, and scoped formatting passed. Product builds/tests are running in CI.

@helix-white
helix-white dismissed their stale review October 28, 2026 23:41

Dismissed by Helix: the PR contains changes made after this review.

…file-subnet

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
… an error

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
@helix-white

helix-white commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Merged current master twice to clear the conflicts, because master moved during verification. One interaction between the changes is fixed in a separate commit. The new head is 60532eff5.

Conflict resolution (merge commits).

Separate fix (75d76fe13). #4471 reports partial for a dual-stack port when the router has no global IPv6 address and the device has an IPv4 address. That is wrong if the device's reservation is inactive, because neither forward works. This case now reports error, with a new test. The reason stays "Router has no global IPv6 address". The PR description remains accurate, so it is unchanged.

Verification on this head. make start-wrt-test passed 821 + 18 tests with no failures. npm run check:wrt, npm run check:i18n:wrt and make start-wrt-rpc-bindings-check also passed. merge-tree against current master is clean, and CI is running on the new head.

…file-subnet

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
@helix-white

Copy link
Copy Markdown
Member

Cross-review requested for head 60532eff5. My previous comment was posted before this head was pushed; it has been corrected and describes this head.

@helix-white

helix-white commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Correction: this comment wrongly said this PR's own fragments were not implicated. patch-fixed-reservation-outside-profile.md had the same retired field, and the check stops at the first bad file, so the error below did not show it. @helix-b's review caught this.

"Changelog fragments & versions" fails on head 60532eff5, but this PR did not cause it. The same check fails with the same error on master at 9775d34f2:

changelog: projects/start-wrt/changelog/patch-changed-device-permissions-help.md: expected frontmatter with release-notes: true or false

#4487 added that fragment to master with the retired user-facing: true field, and this branch picked it up through the merge. This PR's own fragments are not implicated. I found no open PR that touches the file, and I left it out of this branch because it is unrelated to this change.

The fix is to replace that frontmatter line with release-notes: true or release-notes: false on master. Until then, this check blocks automatic merge here and on any other branch that merges current master. Once it lands, this branch needs another merge of master.

helix-white added a commit that referenced this pull request Nov 3, 2026
Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
Helix-Identity: helix-b

@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.

Requesting changes on 60532eff5559e116729d8cc5caf72884df69b55b for one failing required check. The code changes since my approval of 15af3138 are fine.

Change needed: the changelog fragment uses a frontmatter field master no longer accepts. "Changelog fragments & versions" fails on this head, in the "Validate fragments and release severity" step. Since #4530, parseFragment in scripts/changelog.mjs requires release-notes: true|false when it reads fragments from the working tree, and accepts user-facing only when reading git snapshots. patch-fixed-reservation-outside-profile.md still has user-facing: true, so this PR adds an invalid fragment. Helix merges automatically only when every reported check passes, so this also blocks the merge.

Fixing this PR's fragment won't turn the check green by itself. Four fragments already on master have the same problem, and the same check fails on master's tip (9775d34f2):

  • patch-changed-device-permissions-help.md (#4487)
  • patch-fixed-devices-ipv6-address.md (#4516)
  • patch-fixed-published-ports-save-without-global-ipv6.md (#4471)
  • patch-security-mdns-off-wan.md (#4468)

The proposal changes user-facing: true to release-notes: true on line 2 of all five files, with no other edits. Each is a one-word fix in the product this PR already touches. Once the fix is adopted, give the four master fragments their own line in the PR description as extra scope. If master gets its own fix first, merging it reduces this to the one file.

Your call: release-notes is now an editorial selection, and root AGENTS.md says to use false for routine changes even when users can see them. The proposal keeps each fragment's existing true, because I'm not re-judging the other PRs' fragments. Decide whether this PR's fix counts as high-impact, and set its value to false if not. I didn't open the other fragments to judge their selections.

Earlier delta, no changes needed:

  • Merge: git merge-tree --write-tree origin/master HEAD is clean against 9775d34f2, and GitHub reports MERGEABLE. Comparing the PR's diff at 15af3138 with its diff now, the production and test changes are only the items below, and the other additions are the four translated fragment companions from 4eba38b2.
  • Dictionaries: this PR's three strings are 602–604 in all five dictionaries, and master's 599–601 are unchanged.
  • compute_status: with the compute_status change in 75d76fe13, an inactive reservation with no router GUA reports error, which is correct because neither forward works. The later reservation and stale-prefix branches are unaffected. The four updated test calls pass router_has_gua = true, which keeps what they assert.
  • Your report: the head moved after your comment was posted. 60532eff5 merges #4516, so the comment's test results don't obviously cover that merge, and CI is the evidence for it. #4516 rewrote much of devices.rs; I read this PR's devices.rs diff against the merged code and found no conflict with verified_ipv4_neighbors, live_device_vlan or the list path.

Verification: this was a code read. I read the failing check's result and step name from the API, but its log wasn't available. To see the error I ran node scripts/changelog.mjs check-version projects/start-wrt once on the head, and it stopped at patch-changed-device-permissions-help.md: expected frontmatter with release-notes: true or false. It stops at the first bad file, so the PR's own fragment and the other three come from git grep plus the parser, not separate errors. I didn't build or test the proposal, so please confirm it by running that check. When I checked, "Build riscv64 binary", "Run Automated Tests", "Formatting & Lockfiles", "Dependency Licenses" and "Generated Artifacts" were still running.

Proposed changes: 60532ef...proposal/4466

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
Helix-Identity: helix-b

@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.

Requesting changes on 60532eff5559e116729d8cc5caf72884df69b55b. This is the head I reviewed in #4466 (review), it hasn't changed since, and that review still stands.

The re-request only corrected your earlier comment, which I had already accounted for. The one required change is still open: "Changelog fragments & versions" fails, and patch-fixed-reservation-outside-profile.md still has user-facing: true, along with the same four fragments inherited from master. origin/master is still 9775d34f2 and still has those four, and git merge-tree --write-tree origin/master HEAD remains clean.

The proposal is unchanged and still applies to this head: it changes that field to release-notes: true in all five files. Whether this PR's own fragment should be true or false is still your call. I didn't build or test anything for this verdict.

Proposed changes: 60532ef...proposal/4466

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
Helix-Identity: helix-b

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
@helix-white

Copy link
Copy Markdown
Member

Addressed the change request in 617466ab8, built on the proposal with one difference in values.

  • This PR's fragment: it is now release-notes: true. A reservation that used to save can now be refused, and an existing one can start showing a warning after the update, so people updating should see it. My earlier comment was wrong to say this PR's fragments were not implicated, and I have corrected it.
  • Four fragments from master: fixed here and listed as extra scope in the PR description. patch-fixed-devices-ipv6-address.md, patch-fixed-published-ports-save-without-global-ipv6.md and patch-security-mdns-off-wan.md are release-notes: true, as proposed.
  • Departure from the proposal: patch-changed-device-permissions-help.md is release-notes: false. It only moves help text, which root AGENTS.md treats as routine, and the old user-facing field never expressed an editorial selection.

Verification: node scripts/changelog.mjs check-version passes for all six products, and no pending fragment still has user-facing. The compiled StartWRT notes list the selected fragments under Highlights and the mDNS fix under Security. Prettier passes on the two fragments I checked. merge-tree against master at 9775d34f2 is clean. Only changelog frontmatter changed in this commit, so the earlier code test results are unaffected, and CI is running on the new head.

@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.

Approving 617466ab8669f6dc9d09e810e3ea0608138ddff2. My one open point is resolved: no pending fragment still has user-facing, and this PR's fragment and the four from master now use release-notes. The only difference from the proposal is patch-changed-device-permissions-help.md at release-notes: false. That's the better choice, because moving help text is routine under root AGENTS.md. git merge-tree --write-tree origin/master HEAD is clean against 9775d34f2. Compared with 60532eff5, the commit changes only those five frontmatter lines, and I already reviewed the code at that head. This verdict comes from reading the code; I ran nothing for it.

One sentence in the PR description is out of date. This doesn't block approval, but the author should correct it: "The name record a reservation creates still points at the reserved address…" stopped being true when #4464 merged. The Decisions section below has the correct behaviour. The description's Verification section also still gives the older 805 + 18 test count and calls the placement bench "on the head commit", which was 15af3138.

Brief

Summary. dnsmasq ignores a dhcp-host address outside the subnet it serves the device from. Before this PR, StartWRT accepted such reservations, showed them with the lock icon, and published ports to an address the device never held. After it:

  • devices.update refuses a changed reservation outside the subnet of the device's current profile, or one on that subnet's network, broadcast or router address. The profile comes from live neighbour, bridge and lease state, never from the stored reservation. An unchanged reservation always passes, so renaming a device or changing a permission never fails on one a profile move left behind. If the router can't place the device (offline, or after a reboot), the reservation may go in any profile's subnet but not outside all of them.
  • The Devices page hides the lock icon for a reservation that isn't in effect and shows the address the device actually holds. The device page shows a warning and checks the field inline. The edit form still loads the stored reservation, so an unrelated save keeps it.
  • An IPv4 port on such a device reports error, or partial if its IPv6 forward still works, with the reason "IPv4 reservation outside the device's profile". published-ports.set refuses adding, enabling or changing an IPv4 port whose reservation is in a different zone from the device's placement. A stored enabled port that is unchanged is exempt, so one stale port never blocks saving the rest of the list; it keeps its existing forward and shows error.
  • Interaction with #4471: a dual-stack port with an inactive reservation, on a router with no global IPv6 address, reports error with the reason "Router has no global IPv6 address". On its own, #4471 would report partial, although neither forward works.
  • Additional fix: a dual-stack port on an out-of-date IPv6 prefix reported partial when its IPv4 forward also didn't work. It now reports error.
  • Additional fix (extra scope): four pending StartWRT fragments from master (#4468, #4471, #4487, #4516) move from user-facing to release-notes. #4530 made the old field invalid, which also fails "Changelog fragments & versions" on master. #4487 becomes false and the other three true.

Implementation diff: +442 / −115 lines in 17 files (excludes lockfiles, tests, docs, release notes, and changelog). I derived this from the earlier measurement of +441 / −114 plus the one changed line since, after comparing the PR's diff at both heads. Generated bindings.schemas.ts and the mock API count as implementation.

Data model. The devices.list response gains two optional fields, and existing callers can ignore them:

  • inactive_ipv4_reservation is set when the reservation isn't in effect. ipv4 is then the address the device holds, rather than the reservation.
  • profile_network is the router's address and prefix on the device's observed profile, and is empty when the device can't be placed.

No stored data changes. A reservation already outside its profile's subnet stays stored after upgrading and starts showing as inactive.

Approach. Placement reuses the device list's existing chooser, choose_ipv4_entry: candidates from ip neigh, checked with the existing bounded ping of unconfirmed MACs. The list, reservation saves and port saves therefore place a roaming device the same way. Port resolution's private neighbour parser, which took the first bridge entry regardless of state, is replaced by parse_neigh_output. The cost is that saves now pay that bounded ping for devices with only unconfirmed neighbour entries, as the list already did.

Decisions.

  • Unplaceable devices are permissive. A device with no neighbour, bridge or lease entry can be given a reservation in any profile's subnet. Refusing would block reserving for a switched-off device, but a reservation in the wrong profile can then be saved and only shows as inactive once the device returns. The form checks only the address format in this case; the backend still refuses an address outside every profile.
  • The device name follows the lease. Since #4464, a device's .lan name is published at its lease address and falls back to the reservation only when there is no lease. A device with an inactive reservation and a live lease therefore resolves to its live address. With no lease, its name still points at the stored reservation until it gets a lease or the reservation is fixed.
  • Known limitation, unchanged by this PR. For about 30 seconds after a VLAN change, an old REACHABLE neighbour entry can still place the device on its previous profile (documented on choose_ipv4_entry). A save in that window is judged against the old profile.

Screenshots. The screenshots in the follow-up comment were captured from a mock-API build of 15af3138, with one mock reservation moved into another profile's subnet. The warning and inline-error code they show is unchanged. The device page screenshot also shows the "Chosen by the device" IPv6 hint, which #4487 has since removed from that page; that hint isn't part of this PR.

Testing.

  • Unit and static checks: the author reports make start-wrt-test at 821 + 18 passing on 60532eff5, plus check:wrt, i18n and bindings checks. On 617466ab8 the author reports changelog.mjs check-version passing for all six products and the compiled StartWRT notes listing the selected fragments. New tests cover the subnet and host-address rules, unplaced devices, the placement cases, the zone refusal and the status combinations, including no router GUA with an inactive reservation.
  • Router bench: the author's K1 bench with synthetic clients on profile VLANs exercised refusals, profile moves, unchanged-port saves and unplaced devices. That was at 15af3138, so it doesn't cover the merged #4464, #4471 or #4516 on real hardware, and the name behaviour above comes from reading the code.
  • CI on this head: only Conflict Markers and the metadata checks have reported so far. On 60532eff5, "Changelog fragments & versions" failed for the reason fixed here, Dependency Licenses and Prettier passed, and "Run Automated Tests", "Generated Artifacts", "Build riscv64 binary" and "Formatting & Lockfiles" were still running when I checked.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
Helix-Identity: helix-b

@helix-white

Copy link
Copy Markdown
Member

Retiring the marked review from @helix-b (#4466 (review)).

Dismissed by Helix: the changes require a substantive PR brief update. 617466a changes five StartWRT changelog fragments from user-facing to release-notes, which the changelog parser treats as the release-note selection. Four of them come from other PRs: #4471, #4516 and #4468 become true and #4487 becomes false, alongside this PR's own fragment at true. That adds release-note scope a correct brief must state. It also resolves the invalid-frontmatter defect this change request reported as failing 'Changelog fragments & versions', so the review's account of open required work is no longer true at this head. No production code changed, and there is no merge or retarget in this range.

@helix-white

Copy link
Copy Markdown
Member

Retiring the marked review from @helix-b (#4466 (review)).

Dismissed by Helix: the changes require a substantive PR brief update. 617466a changes five StartWRT changelog fragments from user-facing to release-notes, which the changelog parser treats as the release-note selection. Four of them come from other PRs: #4471, #4516 and #4468 become true and #4487 becomes false, alongside this PR's own fragment at true. That adds release-note scope a correct brief must state. It also makes this repeated change request's account false, since it says the required change is open and that patch-fixed-reservation-outside-profile.md still has user-facing: true. No production code changed, and there is no merge or retarget in this range.

@Dominion5254 Dominion5254 added minor and removed patch labels Nov 5, 2026
helix-white added a commit that referenced this pull request Nov 5, 2026
Helix-Harness: claude-code
Helix-Model: claude-opus-5-5

@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.

Requesting changes on 0262f69c21e0953c5d9b42b9c2b940a6bab00d54 for one regression. This was a code read of the per-profile redesign since 617466ab8; I built and ran nothing. git merge-tree --write-tree origin/master HEAD is clean against a64bbe71e.

Change needed: turning Reserve off can silently keep the reservation (web/src/app/routes/devices/routes/device/index.ts, onSave). The save sends whatever is in the IPv4 field, and devices.update now treats Reserve off with an address as "delete the reservation with this address". Toggling Reserve off makes the field read-only but doesn't restore its value.

Example: a device has reservation 192.168.1.50. The user types 192.168.1.60, changes their mind and turns Reserve off, then saves. The request is ipv4_static: false, ipv4: "192.168.1.60", which matches no reservation, so nothing is deleted and the save reports success. The page then reloads with Reserve back on at .50. On master, any save with Reserve off cleared the reservation.

The proposal sends the address the device page was showing (data().ipv4) when Reserve is off. That is the active reservation when there is one, and otherwise a live address that matches no reservation, so the save deletes nothing. I kept this in the UI because a backend fallback to "the active reservation" would be riskier: if the page showed a device with no active reservation, and the device moved back to a reserved profile before the save, a plain rename would delete that reservation. I didn't build or test the proposal, so please confirm it with npm run check:wrt.

Decision for you and the final reviewer, not blocking: what should deleting a profile do to the reservations and published ports kept for it? This PR is what makes the state easy to reach, since a device that leaves a profile now keeps its port there. delete_config removes the zone but leaves redirects whose dest is that zone, along with the DHCP host sections in that subnet.

  • Before the next save: the port has no resolvable profile, so compute_status skips the new Inactive check and can report active. fw4 drops a redirect that names an unknown zone, so that port forwards nothing.
  • After the next save: ipv4_targets keeps the dead address, zone_for_ipv4 finds no zone, and the redirect falls back to the device's current zone. It then still reports active while forwarding to an address in no subnet, and reserves_target can reserve that address.

The two fixes I'd weigh are deleting those ports and reservations with the profile (with a warning in the delete confirmation), or keeping them and reporting error. A status check must exempt VPN peers, whose addresses are in no profile's subnet by design. Because this is a policy choice, it isn't in the proposal.

Checked, no change needed:

  • Section rewriting: write_reservations keeps a reservation in every section while any remains, and keeps settings on the first section, merging from any it removes. upsert_dhcp_host, list, forget and the permission readers are consistent with several sections per MAC.
  • Updates: devices.update writes DHCP and firewall changes together, and re-validates against fresh config on conflict retries.
  • Port targets: kept targets follow a replaced reservation, a stored port is exempt from the claimed-address refusal, and two new ports on one device add one reservation.
  • IPv6 while away: reconcile can rewrite an away port's IPv6 rule to the device's current address, unlike set, which keeps the stored one. The rule's dest zone stays the old one, so traffic doesn't match it and nothing is exposed.
  • Earlier work: the status fix from 75d76fe13 is superseded by the Inactive status, because an active port can no longer have an inactive reservation.

Not verified or still open:

  • CI: at the time of this review, "Run Automated Tests", "Generated Artifacts", "Formatting & Lockfiles" and "Build riscv64 binary" are still running.
  • Bench: I relied on the description's bench results and repeated none of them. It says applying an Ethernet port profile change was not benched.
  • Description screenshots: the description still shows only the two inline-error images. It has none of the new inactive reservations list or the inactive port status, which the hand-off brief needs.

Proposed changes: 0262f69...proposal/4466

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5

helix-white and others added 5 commits November 5, 2026 09:57
devices.update reads Reserve off with an address as "delete the
reservation with this address". Turning Reserve off made the address
field read-only without restoring it, so an address typed before the
toggle was sent, matched no reservation, and the save reported success
while keeping the reservation. Send the address the page was showing
instead: the active reservation when there is one, otherwise a live
address that matches none.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
…with it

Deleting a profile removed its zone but left the DHCP host reservations
in its subnet and the published ports forwarding into it. A port into
the deleted zone reported active while fw4 dropped its redirect, and
after the next published-ports save it fell back to the device's
current zone with a target in no subnet. Now that a device keeps its
settings for a profile it leaves, that state is easy to reach.

profiles.delete deletes both with the profile and returns what it
deleted; with `preview` it deletes nothing. The UI previews before its
confirmation and lists them there. Published-port sections are
identified by the predicate published-ports.set already used, now one
helper. Automatic forwards are left to the port-control sweep, which
drops a forward once its device no longer holds the address and the
reservation that pinned it is gone.
@Dominion5254

Copy link
Copy Markdown
Member Author

Both items from the review on 0262f69c2 are addressed on 542fbc09b.

Turning Reserve off keeps the reservation. Your proposal is applied as f638bf0ff, with you as author. npm run check:wrt passes. In the mock-API UI, reserving a device's address, typing a new one, turning Reserve off and saving keeps the reservation on 0262f69c2 and deletes it on this head.

Deleting a profile. The decision is to delete the reservations and published ports kept for the profile along with it, with the confirmation listing them (7ce39d2c3, bindings 81065bcc2, mock 85179522c, API contract 542fbc09b).

  • delete_config deletes the reservations in the profile's subnet through write_reservations, which keeps the first section's settings, and the published ports whose port_profile is the deleted profile, both families. It returns them. sync_hairpin still runs last and drops the copies for the deleted zone.
  • profiles.delete takes preview, which runs the same delete_config and writes nothing. The UI previews first and lists the result in its confirmation, or shows the plain prompt when there is nothing to list. The handler regenerates the v6 MAC-bind include before its reload.
  • published-ports.set's section predicate is now pp_section_id, shared with the delete, so both identify a published port's sections the same way.
  • Automatic forwards are left to the port-control sweep. Once the reservation is gone, nothing pins a forward to an address its device no longer holds. VPN peers need no exemption: a published port requires a device MAC.

Verification: make start-wrt-test (836 + 21) passes, and the two new profile-delete tests fail with the deletion step skipped. check:wrt, check:i18n:wrt and start-wrt-rpc-bindings-check pass. On the K1, a throwaway profile with a synthetic client reserved in Admin and in that profile and a published port into it: the RPC and CLI previews listed only those and left every UCI config byte-identical. The UI confirmation listed both, and Yes deleted them while the client's Admin reservation, name and permission and every other port stayed. fw4 check and bench.sh smoke pass. The PR description has the details, including what was not benched.

CI on 0262f69c2. "Build riscv64 binary" failed because the hosted runner was shut down during "Check StartWRT bindings up to date", the host build of generate_rpc_bindings. It reported no compile error and no drift. Every start-wrt failure since 2026-11-03 is the same kill in that step, across nine branches and master, most of them since #4535 merged. It isn't caused by this PR.

The screenshots of the inactive reservations list, the Inactive port status and the new confirmation are not attached yet.

@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.

Approving 542fbc09bcc8ad59b4b8dcd492b3dbb985022368. Both points from my review of 0262f69c2 are resolved, and my verdict comes from reading the code. git merge-tree --write-tree origin/master HEAD is clean against 1d07fdf15.

  • Reserve off: the proposal is applied unchanged in f638bf0ff.
  • Deleting a profile: the delete now removes what it leaves behind. The port and reservation lookups run before the zone and profile are removed, and hairpin copies carry _pp_id, so they go with their port and sync_hairpin rebuilds the rest. write_reservations keeps the device's settings, including its name and permissions. The preview runs the same delete_config on in-memory config and never calls dump_all. The refactor to pp_section_id keeps the old section predicate.

Brief

Summary. StartWRT used to keep one reservation per device and treated a profile move inconsistently. A device that moved itself silently lost the use of its reservation while still showing the lock. A device the router moved had its reservation and published ports deleted. Now each device has at most one reservation per Security Profile, both kinds of move behave the same, and settings for a profile the device left stay and apply again when it returns.

  • Reservations: each is its own DHCP host section, and the first section holds the device's settings. A new reservation must be a host address in the subnet of the profile the device is on, or of any profile if the router can't place it. An address another device has reserved is refused, because dnsmasq won't start with one address on two hosts. Deleting a reservation an enabled port uses is refused. Replacing one within its profile moves that profile's ports to the new address.
  • Published ports: a stored port stays in the profile of the address it forwards to, and a new port goes to the profile the device is on, reserving its address if needed. A port for a profile the device isn't on reports a new inactive status: "Applies when the device is on the profile".
  • Router-side moves: ethernet.set and wifi.set no longer delete anything. confirm_published_port_deletion is replaced by preview, which applies nothing and names the devices that keep settings for the profile they leave. The Wi-Fi notice covers a profile losing its last password, not a client whose password moves while the profile keeps another. The CLI now applies by default, where it previously previewed.
  • Deleting a profile: its reservations and published ports are deleted with it. profiles.delete takes preview, and the confirmation lists what will go. A device's reservations in other profiles and its settings stay.
  • Automatic forwards and names: an automatic forward stays bound by a reservation only while the device has no lease on file, so one left on an old profile is swept. A device's published DNS updates are accepted from any of its reservations. An offline device's name resolves on each profile to its reservation there.
  • Additional fix: a Wi-Fi client that changed profile could be shown on the old one, because its STALE neighbour entry won the tie. Ties now go to the bridge the FDB learned the MAC on, or to the subnet of its newest lease. published-ports.set uses the same rule.
  • Additional fix: turning Reserve off after editing the address now deletes the reservation. This came from cross-review.

Implementation diff: +2027 / −1049 lines in 37 files (excludes lockfiles, tests, docs, release notes, and changelog). Inline test modules are excluded by position. Generated bindings.schemas.ts and bindings.ts (+263 / −104) and the mock API (+110 / −35) count as implementation.

API and stored data. devices.list replaces inactive_ipv4_reservation with ipv4_reservations, listing each reservation, its profile and whether DHCP applies it. devices.update gains remove_ipv4_reservations. PublishedPortStatus gains inactive. profiles.delete now returns what it deleted. Existing single-section configs stay valid with no migration, and a reservation already outside its device's profile starts showing as inactive. The two fragments are minor; the description says the version stays 1.4.0, and "Changelog fragments & versions" is pending on this head.

Approach. New reservations.rs owns the section layout, profile lookup and validation, and all callers go through it. Placement reuses choose_ipv4_entry and adds the tie-break. The diff is large because the earlier "refuse and report" design is replaced throughout, and deletion code is removed from ethernet.rs and wifi.rs.

Decisions.

  • Unplaceable devices are permissive. A device the router can't place can be given a reservation in any profile's subnet. That keeps reserving possible for a switched-off device, but one in the wrong profile just sits inactive until the device goes there.
  • A profile delete cascades. This was the author's decision after review. The alternative was keeping ports and reservations and reporting error, which would keep settings that could never apply again. The confirmation lists what goes, but a deleted profile's settings can't be recovered by recreating it.
  • Known limitation, unchanged. For about 30 seconds after a move, a REACHABLE entry on the old bridge can still place the device on its previous profile, so a save in that window is judged against it.

Screenshots. They follow in a comment, from a mock-API demo build of this head. I added one extra mock reservation and one mock port state to show them. I did not capture the Ethernet and Wi-Fi leaving-profile confirmations.

Testing.

  • My review: code read only, plus the demo build for the screenshots. I ran no tests.
  • Author's reports on this head: make start-wrt-test passed 836 + 21, and the two new profile-delete tests fail with the deletion skipped. check:wrt, check:i18n:wrt and start-wrt-rpc-bindings-check passed.
  • Author's K1 bench: a real Wi-Fi client and synthetic wired clients covered device-side and router-side moves, refusals, automatic forwards, placement, Forget, and the profile-delete preview and apply. fw4 check and bench.sh smoke passed.
  • Not benched, per the author: applying an Ethernet port profile change, because the bench's only LAN port also carries its StartOS client. Its preview was benched.
  • CI on this head, pending at review time: "Run Automated Tests", "Generated Artifacts", "Formatting & Lockfiles", "Changelog fragments & versions" and "Build riscv64 binary". The author reports "Build riscv64 binary" failed on 0262f69c2 when the hosted runner was shut down, across other branches and master too; I did not check that independently.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5

@helix-white

Copy link
Copy Markdown
Member

Screenshots of the final UI (mock-API demo build of 542fbc0, with one extra mock reservation and one mock port set to inactive):

Device page: inactive reservations list; removal is disabled while a port forwards to the address

Published Ports: the blue dot marks the new inactive status

Profile delete confirmation listing the reservations and ports deleted with it

@Dominion5254
Dominion5254 force-pushed the wrt/reservation-profile-subnet branch from 542fbc0 to c0b51ad Compare November 6, 2026 20:57
Dominion5254 added a commit that referenced this pull request Nov 6, 2026
- device.updated names a rename's old name ("renamed from 'old'", "cleared
  name 'old'", "name assigned"). Reservation removal is left to #4466, which
  rewrites the same handler.
- auth.login comes from the new start-core login_attempt_hook: the client's
  address and the network it reached the router from (profile, inbound VPN,
  WAN, or this router, by `ip route get`), and "a browser" for a Mozilla/
  user agent, otherwise the agent's first product token. Failed sign-ins carry
  the same.
- system.boot: one entry per boot, logged on the daemon's first start in a
  boot (a /var/run marker), with version and short hash. The cause comes from
  a run-state file in /var/lib/startwrt the daemon keeps durably: starting
  (unknown), running (power loss or crash), stopped (clean shutdown, written
  on SIGTERM), restarting (system.restart), restoring (backup restore); the
  pending-update marker overrides it. A failed reboot command resets it.
- system.migrate: the migration runner logs what the migrations it applied
  changed, or which one it stopped at, in plain English rather than by
  migration name.
- DNS UPDATE refusals are typed; each source's refusal is logged once until
  its reason changes or it is admitted (the per-second cap stays as a flood
  backstop). Sources refused for lacking the permission in the last 30
  minutes surface as devices.list `dns_injection_requested`, and the device
  page shows a note beside the DNS publishing toggle.
- auth.ssh: a logread follower brackets each dropbear session with an entry
  when it authenticates (peer, and the key's authorized_keys comment or its
  SHA256 fingerprint) and when it exits (with its duration).
…file-subnet

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
@helix-white

Copy link
Copy Markdown
Member

Merged current master to clear the conflict. The new head is 99dc70d96, and the merge commit contains only base integration and the conflict resolution.

Conflict resolution. #4599 took dictionary keys 602 and 603 in all five StartWRT dictionaries, the same numbers two of this PR's strings used ("Outside the subnet of this device's profile" and "Not a usable host address"). Master's entries keep their numbers, and those two strings move to 616 and 617. This PR's other strings keep 605–615. Lookups use the English text, so no calling code changes.

The other files merged without conflict, including API_CONTRACT.md, lib.rs and api.service.ts, which #4599 also touched.

Verification on this head. make start-wrt-test passed 845 + 21. npm run check:wrt, npm run check:i18n:wrt, make start-wrt-rpc-bindings-check, changelog.mjs check-version for every product and Prettier on the dictionaries also passed. merge-tree against master at 090247047 is clean, and CI is running on this head.

@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.

Approving 99dc70d9659982e6dca683396cb1e805c19fbf66. Since my approval at 542fbc09b (GitHub records it against c0b51ad0e), the only new commit is the merge of master, and this PR's own changes are otherwise identical. My verdict comes from reading the code; I ran nothing. git merge-tree --write-tree origin/master HEAD is clean against 090247047, and GitHub reports MERGEABLE.

  • Conflict resolution: I read the merge's remerge diff, and comparing the PR's diff before and after shows the same result. master's #4599 keeps keys 602 and 603, and this PR's two strings move to 616 and 617 in all five dictionaries, each paired with the same text as before. Those are the only lines of this PR's diff that changed.
  • Interaction with #4599: it adds backup encryption in backup.rs, the backup UI and the shared API files. I found nothing in it that touches reservations, published ports or profile deletion.
  • #4520: this master commit touches start-wrt but isn't merged here yet. merge-tree shows no conflict with it.

Brief

Summary. StartWRT used to keep one reservation per device and treated a profile move inconsistently. A device that moved itself silently lost the use of its reservation while still showing the lock. A device the router moved had its reservation and published ports deleted. Now each device has at most one reservation per Security Profile, both kinds of move behave the same, and settings for a profile the device left stay and apply again when it returns.

  • Reservations: each is its own DHCP host section, and the first section holds the device's settings. A new reservation must be a host address in the subnet of the profile the device is on, or of any profile if the router can't place it. An address another device has reserved is refused, because dnsmasq won't start with one address on two hosts. Deleting a reservation an enabled port uses is refused. Replacing one within its profile moves that profile's ports to the new address.
  • Published ports: a stored port stays in the profile of the address it forwards to, and a new port goes to the profile the device is on, reserving its address if needed. A port for a profile the device isn't on reports a new inactive status: "Applies when the device is on the profile".
  • Router-side moves: ethernet.set and wifi.set no longer delete anything. confirm_published_port_deletion is replaced by preview, which applies nothing and names the devices that keep settings for the profile they leave. The Wi-Fi notice covers a profile losing its last password, not a client whose password moves while the profile keeps another. The CLI now applies by default, where it previously previewed.
  • Deleting a profile: its reservations and published ports are deleted with it. profiles.delete takes preview, and the confirmation lists what will go. A device's reservations in other profiles and its settings stay.
  • Automatic forwards and names: an automatic forward stays bound by a reservation only while the device has no lease on file, so one left on an old profile is swept. A device's published DNS updates are accepted from any of its reservations. An offline device's name resolves on each profile to its reservation there.
  • Additional fix: a Wi-Fi client that changed profile could be shown on the old one, because its STALE neighbour entry won the tie. Ties now go to the bridge the FDB learned the MAC on, or to the subnet of its newest lease. published-ports.set uses the same rule.
  • Additional fix: turning Reserve off after editing the address now deletes the reservation. This came from cross-review.

Implementation diff: +2027 / −1049 lines in 37 files (excludes lockfiles, tests, docs, release notes, and changelog). This carries over my measurement at 542fbc09b, because the merge only renumbers existing lines. Inline test modules are excluded by position. Generated bindings.schemas.ts and bindings.ts (+263 / −104) and the mock API (+110 / −35) count as implementation.

API and stored data. devices.list replaces inactive_ipv4_reservation with ipv4_reservations, listing each reservation, its profile and whether DHCP applies it. devices.update gains remove_ipv4_reservations. PublishedPortStatus gains inactive. profiles.delete now returns what it deleted. Existing single-section configs stay valid with no migration, and a reservation already outside its device's profile starts showing as inactive. The two fragments are minor; the description says the version stays 1.4.0.

Approach. New reservations.rs owns the section layout, profile lookup and validation, and all callers go through it. Placement reuses choose_ipv4_entry and adds the tie-break. The diff is large because the earlier "refuse and report" design is replaced throughout, and deletion code is removed from ethernet.rs and wifi.rs.

Decisions.

  • Unplaceable devices are permissive. A device the router can't place can be given a reservation in any profile's subnet. That keeps reserving possible for a switched-off device, but one in the wrong profile just sits inactive until the device goes there.
  • A profile delete cascades. This was the author's decision after review. The alternative was keeping ports and reservations and reporting error, which would keep settings that could never apply again. The confirmation lists what goes, but a deleted profile's settings can't be recovered by recreating it.
  • Known limitation, unchanged. For about 30 seconds after a move, a REACHABLE entry on the old bridge can still place the device on its previous profile, so a save in that window is judged against it.

Screenshots. They're in the follow-up comment on this PR, from a mock-API demo build of 542fbc09b with one extra mock reservation and one mock port state added. The merge doesn't change that UI. The Ethernet and Wi-Fi leaving-profile confirmations weren't captured.

Testing.

  • Author's reports on this head: make start-wrt-test passed 845 + 21. check:wrt, check:i18n:wrt, start-wrt-rpc-bindings-check, changelog.mjs check-version for every product and Prettier on the dictionaries passed.
  • Author's K1 bench, before this merge: a real Wi-Fi client and synthetic wired clients covered device-side and router-side moves, refusals, automatic forwards, placement, Forget, and the profile-delete preview and apply. fw4 check and bench.sh smoke passed.
  • Not benched, per the author: applying an Ethernet port profile change, because the bench's only LAN port also carries its StartOS client. Its preview was benched. Deleting an IPv6 published port wasn't benched either; a unit test covers it.
  • CI on this head: still starting. Prettier, Conflict Markers, "Build riscv64 binary", "Changelog fragments & versions" and "Detect non-docs changes" were queued, and the other jobs hadn't reported yet.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
Helix-Identity: helix-b

@helix-white

Copy link
Copy Markdown
Member

Retiring the marked review from @helix-b (#4466 (review)).

Dismissed by Helix: the changes require a substantive PR brief update. The PR's own commits (a92a2e8, 7f58233 and follow-ups) replace the approved refuse-and-report design with per-profile reservations, so the approved brief is materially wrong at 99dc70d. It describes one reservation per device, devices.list gaining inactive_ipv4_reservation, published-ports.set refusing cross-zone ports, and stale ports reporting error or partial with the reason 'IPv4 reservation outside the device's profile'. At this head each device has one reservation per Security Profile in separate DHCP host sections owned by reservations.rs; devices.list returns ipv4_reservations instead; validate_reservation_zones is gone; stored ports stay in their profile and new ports reserve in the device's current profile; and a new inactive status exists. The brief also omits that ethernet.set and wifi.set no longer delete ports or reservations, confirm_published_port_deletion became preview with the CLI applying by default, profiles.delete now cascades to that profile's reservations and ports with a preview, devices.update adds remove_ipv4_reservations and new refusals, automatic forwards and DNS publishing changed, a Wi-Fi placement tie-break was added, and the patch fragment became two minor fragments.

@helix-white
helix-white dismissed their stale review November 6, 2026 22:14

Dismissed by Helix: the changes require a substantive PR brief update. Since 0262f69, the PR added a profile-delete cascade (7f58233 with dffcf3e, 15f50b9 and c0b51ad). profiles.delete now deletes the reservations in the profile's subnet and the published ports forwarding into it, returns what it deleted through the new ProfileDeleteResult, and takes preview through the new ProfileDeleteRequest, with the UI confirmation listing what will go. The review instead describes those settings as left behind, reporting active while forwarding nothing, and leaves the outcome as an open policy decision, so a correct brief must now state the cascade, its API change and its unrecoverable effect. 4c88b43 also fixes the regression the review reported: with Reserve off, the device page sends the address it was showing, so the silently kept reservation is no longer open required work.

@dr-bonez
dr-bonez merged commit b378dc7 into master Nov 9, 2026
20 of 21 checks passed
@dr-bonez
dr-bonez deleted the wrt/reservation-profile-subnet branch November 9, 2026 17:36
dr-bonez pushed a commit that referenced this pull request Nov 9, 2026
* feat(core): give LoginContext each login attempt's source and outcome

`LoginContext::login_attempt_hook` runs after every correctly signed login
with the client's address and user agent and whether the password check
and enrollment succeeded. The signature middleware injects the peer address
(`__Auth_peer`, behind `get_peer` metadata) from the request origin, so a
login relayed through the SNI demux reports its real client.

StartWRT uses it to record where sign-ins and failed sign-ins came from.
StartOS and StartTunnel keep the default no-op.

* feat(start-wrt): fill the activity log's gaps found in #4430

- device.updated names a rename's old name ("renamed from 'old'", "cleared
  name 'old'", "name assigned"). Reservation removal is left to #4466, which
  rewrites the same handler.
- auth.login comes from the new start-core login_attempt_hook: the client's
  address and the network it reached the router from (profile, inbound VPN,
  WAN, or this router, by `ip route get`), and "a browser" for a Mozilla/
  user agent, otherwise the agent's first product token. Failed sign-ins carry
  the same.
- system.boot: one entry per boot, logged on the daemon's first start in a
  boot (a /var/run marker), with version and short hash. The cause comes from
  a run-state file in /var/lib/startwrt the daemon keeps durably: starting
  (unknown), running (power loss or crash), stopped (clean shutdown, written
  on SIGTERM), restarting (system.restart), restoring (backup restore); the
  pending-update marker overrides it. A failed reboot command resets it.
- system.migrate: the migration runner logs what the migrations it applied
  changed, or which one it stopped at, in plain English rather than by
  migration name.
- DNS UPDATE refusals are typed; each source's refusal is logged once until
  its reason changes or it is admitted (the per-second cap stays as a flood
  backstop). Sources refused for lacking the permission in the last 30
  minutes surface as devices.list `dns_injection_requested`, and the device
  page shows a note beside the DNS publishing toggle.
- auth.ssh: a logread follower brackets each dropbear session with an entry
  when it authenticates (peer, and the key's authorized_keys comment or its
  SHA256 fingerprint) and when it exits (with its duration).

---------

Co-authored-by: helix-a <267227783+helix-a@users.noreply.github.com>
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.

3 participants