Skip to content

Add bounded nftables client pause lease - #76

Draft
pjeweb wants to merge 1 commit into
osb/pr/heat-link-boxfrom
osb/pr/heat-client-lease
Draft

pjeweb wants to merge 1 commit into
osb/pr/heat-link-boxfrom
osb/pr/heat-client-lease

Conversation

@pjeweb

@pjeweb pjeweb commented Nov 13, 2026 •

Copy link
Copy Markdown

Why

The heat plan in #71 ends, at critical temperature, with pausing other devices on the box's hotspot. But the box has no safe, reversible way to pause one device's traffic, so that step can't be wired up yet. Any such pause also has to undo itself if the box software crashes, or a guest could be left offline for no reason.

What

  • An internal building block that pauses one verified IPv4-only device's forwarded traffic in both directions. The box's own DHCP, DNS and management traffic keep working.
  • Every pause is a five-second lease that has to be renewed. If the owner crashes or stops renewing, the kernel lifts the pause by itself.
  • After a restart the box clears pauses it recognises, and it refuses to touch a firewall table it doesn't own.
  • Nothing uses it yet: automatic pausing and link lending aren't registered, and there's no writable RPC.

How: the pause is one marked nftables table (the Linux kernel firewall), replaced in a single atomic transaction, with the client in a set whose entries expire. Updates run one at a time and recheck admission right before they apply, and once stopped the owner can't be re-armed. Devices with both IPv4 and IPv6 addresses are left alone until complete address bindings exist. docs/HEAT-CLIENT-LEASE.md explains it.

Automatic use has to wait for a session owner that can prove which path is the phone's and how much room the other links have; today's transport statistics can't. Missing evidence stays unknown and leaves traffic alone.

Sits on #71 (heat planning while carrying a phone's traffic).

How to verify

Run apps/backend/src/tests/heat-client-pause.test.ts. Its namespace fixture uses two virtual clients and the real kernel: the phone keeps forwarding, the paused guest is blocked both ways, local traffic still works, the pause clears on restart and expires after SIGKILL, unrelated rules survive, and a foreign table is refused.

Testing and limits
  • The focused suite including the kernel fixture passes, as do shellcheck and the full backend, frontend, rpc, i18n and sender suites, lint and type checks.
  • Not tried in a browser end to end or on hardware. This stays a draft until a real owner exists.

Risks

None for running boxes: nothing calls it yet. If a later owner misidentifies a device, the five-second lease limits the damage to as long as it keeps renewing.


Checklist

  • Docs updated if behavior or structure changed (Rule A: AGENTS.md within budget, README, docs/, versions.yaml)
  • User docs (Rule G): no user-visible change, OR ceralive-docs PR updates English and Spanish, plus ceralive-website PR if a landing claim changed
  • Started from updated main; branch rebased on latest canonical branch (Rule B)
  • Rule D local-scratch reference check passes for tracked files
  • Tests pass; QA evidence attached or linked

@pjeweb
pjeweb force-pushed the osb/pr/heat-link-box branch from 8b3e3a1 to fa3142e Compare November 13, 2026 21:24
@pjeweb
pjeweb force-pushed the osb/pr/heat-client-lease branch from 5f30f3d to ed725df Compare November 13, 2026 21:48
@pjeweb
pjeweb force-pushed the osb/pr/heat-client-lease branch from ed725df to 68c91d4 Compare November 14, 2026 00:45
@pjeweb pjeweb added stacked Depends on another pull request; review and integrate parents first. upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal. parked Parked or held for now; not planned for a train until picked up again. labels Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parked Parked or held for now; not planned for a train until picked up again. stacked Depends on another pull request; review and integrate parents first. upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal.

Development

Successfully merging this pull request may close these issues.

1 participant