Exception on one interface aborts remaining interfaces and route handling #19
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#19
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
All the action logic sits in one top-level
try { ... } catch (\Throwable $e). If an exception orErroris thrown while handling one interface, the rest of the run is skipped:$iface_aliasesare not handled, and$remove_backup_routedefault-route handling for that role never runs.With the default
['wan']and no route handling this hardly matters. With e.g.['wan', 'opt2'], a fault onwanleavesopt2in the wrong state until the next event or reconcile, and the next run may hit the same fault.Where
10-wancarp:legacy_interface_flags(),interface_configure()interface_reset(),interface_configure(),run_cmd()result=exception,exit(1)Suggested fix
Wrap the per-interface body of each loop in its own
try/catch (\Throwable $e). On error:werr("{$ev}: '{$ifkey}' ({$realif}) failed: " . get_class($e) . ': ' . $e->getMessage() . ' @ file:line'), set$failed = true, andcontinueto the next interface. The route block then still runs, and the END banner reportsresult=partial. Keep the outer try/catch as the last-resort handler.Decide whether the MASTER route restore should still run if every interface failed to come up. Restoring OPNsense's route while WAN is down is no worse than the current "route deleted, gateway not ready yet" path, so it's probably fine.
Acceptance
interface_configure()for the first alias only: the second alias is still handled, route handling runs, END saysresult=partial.[Unreleased]entry.