Skip to content

fix: keep LAN renumbering reachable - #153

Merged
Cd1s merged 5 commits into
mainfrom
fix/lan-renumber
Oct 17, 2026
Merged

Cd1s merged 5 commits into
mainfrom
fix/lan-renumber

Conversation

@Cd1s

@Cd1s Cd1s commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Problem

Changing lan.ipv4 could leave old addresses on bridges, reject dependent LAN references, and strand the web confirmation window when the panel moved to its new origin. Reviews also identified overly broad UI request timeouts and incomplete guard handling for router rules.

Changes

  • Add a LAN renumber picker in net.js covering DHCP hosts, devices, port-forward sources/targets, firewall rules, policy routes, DNS A records, DHCP options, static routes, bypass gateway, HTTPS routes, and API-token source ranges. Selected values preserve host bits in the new subnet and the baseline advances after each edit.
  • Record the previous addresses written by mini-router under /run/mini-router/net-addresses. The renderer enables promote_secondaries=1, removes only those recorded addresses, preserves addresses owned by other tools, and flaps wired LAN ports only when the recorded address changes.
  • Bind mr-panel on 0.0.0.0, ordered after mr-firewall; if the nft input chain is absent, init falls back to the LAN address so an operator can repair the firewall without a WAN listener.
  • Add a 256-bit, one-time LAN confirmation handoff. Web apply and browser rollbacks return the new address and token; the old page redirects to /#confirm=.... Only job/confirm handoff calls use short fetch timeouts; other API calls retain their original behavior. Token failures stop immediately and token files are read only by Web UI/rollback jobs.
  • Guard router rules now checks enabled TCP/TCP+UDP accepts, including empty destination ports (any port), while ignoring disabled and UDP/ICMP-only rules.

Validation

  • Merged latest origin/main (fd8fd50) before the fix commits.
  • go test ./...
  • node --check rootfs/www/ui/net.js rootfs/www/ui/core.js
  • node tools/mock/lan-shift.test.js
  • python3 tools/i18n.py check
  • ./tools/ci.sh — ALL CHECKS PASSED
  • Netns checks cover same-subnet .6 -> .1, subnet change, /24 -> /16 with promote_secondaries=0, external secondary address preservation, and panel port 80 rejection from PPPoE/WAN IPv4+IPv6, WAN2, and guest.
  • Lab 5: applied .6/24 -> .1/24, confirmed from the new LAN origin, then applied .1/24 -> .2/24; bridge addresses remained present, clients renewed to 192.168.1.x and 192.168.2.124/24, both token confirmations succeeded, pending cleared, and the lab was torn down.

@Cd1s
Cd1s merged commit 255a964 into main Oct 17, 2026
2 checks passed
Cd1s added a commit that referenced this pull request Oct 18, 2026
…arios 06 LAN renumber, 07 require_public_ip (Closes #152) (#155)

* tools/lab: change follows a LAN renumber (#153 one-time token on the new address); scenarios 06 LAN renumber, 07 require_public_ip behind CGNAT

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* tools/lab: host-wide lab id lock (Closes #152)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* tools/lab: review fixes for #155 — LAN move recorded only once confirmed, reset takes the id first, lock records written once and only under the flock

- change: lan.ip / cookies switch to the new address only after a "confirmed":true answer (or, with
  --no-confirm, once the router answers there); a failure leaves the lab on the old address
- reset takes the id lock before teardown, so two resets of a free id cannot destroy each other's lab
- the holder writes its record with one printf (timestamp first); a held lock with an empty record or
  a dead PID is a takeover in progress: id_guard, status and id_acquire wait for the new record
- stale records are emptied only under a short flock (MRLAB_FORCE takeover, MRLAB_FORCE down of
  another checkout's lab, own stale down)
- 07: sessions() prints one number when nothing matches; 06: unused helpers removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* tools/lab: change bounds the LAN-move wait by the clock (a failing renew no longer stretches it)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@Cd1s Cd1s mentioned this pull request Oct 18, 2026
52 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant