Skip to content

net: relay SLAAC IPv6 /64 to LAN without PD - #160

Merged
Cd1s merged 6 commits into
mainfrom
feat/ipv6-relay
Oct 18, 2026
Merged

Cd1s merged 6 commits into
mainfrom
feat/ipv6-relay

Conversation

@Cd1s

@Cd1s Cd1s commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

What

  • Add opt-in wan[].ipv6_relay (default false) for an upstream SLAAC /64 without DHCPv6-PD.
  • Track WAN /64 addresses and LAN IPv6 neighbours from existing dhcpcd hooks plus a crond minute task; assign a stable EUI-64 based address on br-lan, maintain bounded per-host NDP proxy entries, and clean prefixes, routes, proxies, and deprecated RA state on WAN or configuration changes.
  • Keep PD precedence, filter unusable/self/WAN neighbours, support VLAN WAN proxy_ndp through /proc, and keep IPv6 inbound traffic under the existing default drop plus explicit firewall.ipv6_allow rules.
  • Preserve byte-for-byte baseline rendering when relay is disabled; add validation, docs, lab configuration, a DHCP+SLAAC ISP simulator mode, and scenario 08 covering enable, ping6, and disable cleanup.

The design comparison is documented in docs/modules/net.md: raw Linux proxy_ndp requires one entry per dynamic host; a resident prefix proxy would add a process and runtime memory; the existing hook + crond scan meets the router's no-idle-daemon policy and remains disabled by default.

Why

A modem in router mode may advertise only a SLAAC /64 on the WAN. The router can reach the uplink, but LAN clients previously received no global IPv6 because only DHCPv6-PD populated br-lan.

Verification

  • cd mr && gofmt -l . && go vet ./...
  • cd mr && go test -count=1 ./...
  • sh tools/ci.sh — ALL CHECKS PASSED
  • tools/lab/lab.sh status 3 confirmed idle before use; tools/lab/lab.sh run 3 08-dhcp-slaac-relay — 4/4 passed. The LAN client received the relayed prefix, reached the ISP-side IPv6 endpoint, and observed a deprecated LAN prefix after disabling relay.
  • Disabled baseline render hashes for dhcpcd.conf, dnsmasq.conf, nftables, and crontab match origin/main.

Closes #159

Cd1s and others added 6 commits October 18, 2026 08:05
… address is proxied

Review round 4 of #160:
- Q1: probe verdicts (free / occupied, time, 10 min TTL) per WAN device and address live in
  /run/mini-router/ipv6-relay-probe.json; the cron run writes them, every reconcile (dhcpcd / ppp
  hooks, apply, cron) reads the same file and proxies only addresses with an unexpired free verdict.
  No verdict, a timeout or an unknown probe result means no proxy until cron decides.
- P2: a probe is ping6 -I <WAN> followed by the WAN neighbour state of the address: echo reply or
  REACHABLE/STALE/DELAY/PROBE/PERMANENT = occupied (also an upstream host that ignores echo),
  FAILED = free, anything else (ping6 cannot run, INCOMPLETE that never resolves) = no verdict.
- P3: a proxied address that loses its free verdict, becomes occupied, appears in the WAN neighbour
  table or becomes a router address is removed in the same scan; the 3-scan grace is only for a host
  that dropped out of the LAN neighbour table.
- Discover: filter before the cap of 64, already proxied addresses first (then no verdict, then past
  half TTL), at most 8 probes at once, no probe starts after 8 s (a run is bounded by ~14 s), a run
  that finds another one probing skips; the cron reconcile skips a busy state lock (A1). The cap keeps
  existing proxies first. The legacy-state branch is gone. Disabling relay removes the verdict file.
- Q2: tests for the verdict classification, cross-process verdicts (sync never probes), immediate
  removal vs grace, bounded/parallel discover with the verdict file and both locks in a temp dir,
  skipped runs, and the cap; two mutations (no verdict = ok, grace for every removal) fail them.
- lab 08 (no planted neighbours): the client is discovered from its own traffic, gets a free verdict
  and is proxied; the ISP reaches it through the proxy; inbound TCP stays default-deny; LAN hosts
  claiming an upstream address (answering ping, or ignoring it) get an occupied verdict and no proxy;
  disabling removes every proxy entry and relay host route.
- docs/modules/net.md describes the verdicts, who acts on them and the on-link limitation (LAN hosts
  cannot reach upstream hosts inside the relayed /64).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Cd1s
Cd1s merged commit 656ca62 into main Oct 18, 2026
2 checks passed
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.

net: relay an upstream SLAAC /64 to LAN without DHCPv6-PD

1 participant