change: the service derives network facts itself #110

Merged
mysticalsoap merged 1 commit from change/service-derives-network into trunk 2026-08-20 22:17:33 -04:00
Owner

Problem

bypass() made the GUI the source of network facts the service could derive itself: default interface, gateways, and cgroup user/group arrived over the bus and lived only in self.net/self.gw/self.gw_6. A service restart silently discarded them → "no network info registered - skipping bypass rebuild" (the empty-table-11 breakage class), and the state could go stale between registration and use (#89).

Fix

  • bypass() is now a bare trigger (in_signature=''): routes come from utils.default_routes() — the v4+v6 main-table lookup moved out of monitor.py, which now delegates to it — and the owner is the kernel-reported sender uid (sys_bus.get_unix_user), the same derivation import_thread uses for the caller's homedir. The old payload's interface validation goes away with the payload.
  • cgroup_vpn() re-derives routes at every rebuild — point of use, not registration time — and takes the v6-preferred interface via the new utils.preferred_interface().
  • Owner recovery after restart: bypass.find_cgroup_uid() reads the uid out of the bypass cgroup path a previous service left on disk (user-<uid>.slice). The skip-rebuild guard survives only for a boot where no bypass has ever been built.
  • GUI's three call sites and the CLI's two shrink to bypass() with no argument; utils.get_user_group() is deleted (unused — and its env-spoofing concern is moot when the uid comes from the kernel). self.net/self.gw/self.gw_6 are gone.

Verification

New tests: default_routes (both stacks / one stack / no network), preferred_interface (v6-wins / v4-fallback / none), find_cgroup_uid (recovers uid / empty tree / slices without the leaf). Full suite: 206 passed.

Live verification that matters here: with main+bypass up, systemctl restart aqomui — the bypass should rebuild without the GUI's re-registration racing it, and journalctl should never show "no network info registered".

Closes #89

🤖 Generated with Claude Code

**Problem** `bypass()` made the GUI the source of network facts the service could derive itself: default interface, gateways, and cgroup user/group arrived over the bus and lived only in `self.net`/`self.gw`/`self.gw_6`. A service restart silently discarded them → "no network info registered - skipping bypass rebuild" (the empty-table-11 breakage class), and the state could go stale between registration and use (#89). **Fix** - **`bypass()` is now a bare trigger** (`in_signature=''`): routes come from `utils.default_routes()` — the v4+v6 main-table lookup moved out of `monitor.py`, which now delegates to it — and the owner is the kernel-reported sender uid (`sys_bus.get_unix_user`), the same derivation `import_thread` uses for the caller's homedir. The old payload's interface validation goes away with the payload. - **`cgroup_vpn()` re-derives routes at every rebuild** — point of use, not registration time — and takes the v6-preferred interface via the new `utils.preferred_interface()`. - **Owner recovery after restart**: `bypass.find_cgroup_uid()` reads the uid out of the bypass cgroup path a previous service left on disk (`user-<uid>.slice`). The skip-rebuild guard survives only for a boot where no bypass has ever been built. - GUI's three call sites and the CLI's two shrink to `bypass()` with no argument; `utils.get_user_group()` is deleted (unused — and its env-spoofing concern is moot when the uid comes from the kernel). `self.net`/`self.gw`/`self.gw_6` are gone. **Verification** New tests: `default_routes` (both stacks / one stack / no network), `preferred_interface` (v6-wins / v4-fallback / none), `find_cgroup_uid` (recovers uid / empty tree / slices without the leaf). Full suite: 206 passed. Live verification that matters here: with main+bypass up, `systemctl restart aqomui` — the bypass should rebuild without the GUI's re-registration racing it, and `journalctl` should never show "no network info registered". Closes #89 🤖 Generated with [Claude Code](https://claude.com/claude-code)
change: the service derives network facts itself (#89)
Some checks failed
ci / test (pull_request) Failing after 26s
233dbcc59a
bypass() made the gui the source of facts the service could read
directly: interface, gateways and cgroup owner arrived over the bus and
lived only on the service instance, so a restart discarded them and
every consumer hit 'no network info registered - skipping bypass
rebuild'.

- bypass() takes no payload: routes come from utils.default_routes()
  (the v4+v6 main-table lookup, moved out of monitor.py which now
  delegates to it) and the owner is the kernel-reported sender uid,
  the way import_thread already derives the caller's homedir.
- cgroup_vpn() re-derives routes at every rebuild, so the facts cannot
  go stale between registration and use either.
- After a restart with no call yet, the owner is recovered from the
  cgroup a previous service left on disk (bypass.find_cgroup_uid);
  the skip-rebuild guard survives only for the never-ran-this-boot
  case.
- The gui's three call sites and the cli's two shrink to a bare
  trigger; utils.get_user_group and the interface-validation on the
  old payload go away (the env-spoofing concern it documented is moot
  when the uid comes from the kernel).

Closes #89

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mysticalsoap force-pushed change/service-derives-network from 233dbcc59a
Some checks failed
ci / test (pull_request) Failing after 26s
to fdca29800c
All checks were successful
ci / test (pull_request) Successful in 35s
ci / test (push) Successful in 29s
2026-08-20 22:03:55 -04:00
Compare
mysticalsoap deleted branch change/service-derives-network 2026-08-20 22:17:33 -04:00
Sign in to join this conversation.
No description provided.