fix: look up the default interface lazily instead of at import time #77
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/lazy-default-interface"
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?
Closes #66
Problem
aqomui_service.pyresolved the default gateway interface with netifaces in the class body, at import time. Two problems stack: any lookup failure prevents the service from starting at all, and netifaces (archived upstream since 2021) returns an empty'default'dict when a second routing table also holds a default route — exactly the state bypass leaves behind in table 11. Net effect: after any bypass run,systemctl restart aqomuicrash-loops (KeyError: 2) untilip route del default table 11is run by hand.Fix
utils.default_interface()parsesip -j route show default(iproute2 is already a hard dependency). It reads only the main table, so a default parked in another table can't shadow the answer, and it returns"None"on any failure instead of raising.bypass()) still wins when present; otherwise the lookup happens at the point of use. Import no longer touches the routing table.bypass()) checks/sys/class/net/<name>directly.import netifacesis gone, andpython-netifacesis dropped from the PKGBUILD and ci.yml.Verification
default_interface()(route present / no default route /ipfailing /ipmissing); suite at 93 passing, CI lint + syntax checks clean."None"; with a real table it resolvesenp5s0. Setter round-trip (gui registration) confirmed.systemctl restart aqomui— service came backactive (running)with no crash-loop and no manual table-11 cleanup. The same sequence crash-looped reliably on the previous build.🤖 Generated with Claude Code