change: the service derives network facts itself #110
Loading…
Reference in a new issue
No description provided.
Delete branch "change/service-derives-network"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 inself.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 fromutils.default_routes()— the v4+v6 main-table lookup moved out ofmonitor.py, which now delegates to it — and the owner is the kernel-reported sender uid (sys_bus.get_unix_user), the same derivationimport_threaduses 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 newutils.preferred_interface().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.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_6are 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, andjournalctlshould never show "no network info registered".Closes #89
🤖 Generated with Claude Code
233dbcc59afdca29800c