Dry-run preflight doesn't check exit_on_bootup() for --reconcile #20
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
eric/10-wancarp#20
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Summary
--reconcileskips during boot throughexit_on_bootup(), but only if the function exists:(around line 599). If OPNsense ever renames or removes it, reconcile silently loses its boot guard and races
rc.bootupbringing interfaces up. The dry-run preflight, which is supposed to catch exactly this ("every OPNsense PHP API it calls exists on this build"), doesn't check it.It exists today:
src/etc/inc/util.incin opnsense/core,function exit_on_bootup($callback = null, $arguments = []), which callsexit(0)whenproduct::getInstance()->booting().Fix
In
preflight()(around lines 529–534), addexit_on_bootupto$apiswhen--reconcileis in effect, the same waysystem_routing_configureis added when$remove_backup_routeis set.preflight()doesn't currently receive$reconcile, so add a parameter (or use the global, matching howwlog/werrread$dryrun). Update the call site (around line 641). The existing "MISSING — a LIVE run would fatal" wording is wrong for this one: a missingexit_on_bootupdoesn't fatal, it silently skips the boot guard. Give it its own message.Optionally, also log a
werron a live reconcile when the function is missing, so the gap shows up in the log and not only in dry-run.Update the README Dry-run preflight bullet list if it names the APIs, and add a CHANGELOG
[Unreleased]entry.Acceptance
--dryrun --reconcileprintsAPI exit_on_bootup() present.;--dryrun 1@x MASTERdoesn't list it.Follow-up audit: a missing exit_on_bootup() would flood the log
Fixed in
222180a. Low impact: current core hasexit_on_bootup()(util.inc), so this only affects old builds.Finding. On a build without
exit_on_bootup(), a live reconcile logged the gap withwerr(). That sets$had_error, and a quiet reconcile flushes its buffered log whenever$had_erroris set, so every once-a-minute reconcile would have written its whole log to the system log, defeating the quiet-reconcile design.Fix.
exit_on_bootup(), a live reconcile now makes the same check itself (product::booting()) and exits during boot, silently.productis missing too does it noteno boot guard on this build ..., and that note goes throughwlog(), so it only appears in a run that is logged anyway (one that changed something or hit a real error).exit_on_bootup() missing; a LIVE reconcile uses product::booting() as its boot guard., and is an error only when neither is available.Harness: the old
logs a missing exit_on_bootup()cases were replaced by six covering the fallback during boot and after boot, the quiet no-guard reconcile, the no-guard note on a run that fixes something, and the two dry-run messages. No change to the live test plan: OPNsense builds that the script supports all haveexit_on_bootup().