diff --git a/doc/ifupdown-executor.scd b/doc/ifupdown-executor.scd index 2064b4b..05de8fa 100644 --- a/doc/ifupdown-executor.scd +++ b/doc/ifupdown-executor.scd @@ -12,7 +12,7 @@ protocol documented in this man page. # PHASES -Executors are run to react to seven different phases and are not +Executors are run to react to nine different phases and are not required to take any specific action. These phases are: *depend* @@ -24,6 +24,10 @@ required to take any specific action. These phases are: any dependencies, it may simply exit 0 without doing anything. +*create* + Called before *pre-up*, to explicitly allow for interface + creation if necessary. + *pre-up* Called before the interface is going to be brought up. @@ -42,6 +46,10 @@ required to take any specific action. These phases are: *post-down* Called after the interface was successfully taken down. +*destroy* + Called after *post-down* to allow for explicitly + destroying an interface if necessary. + # ENVIRONMENT Executors are guaranteed to run with a core set of environment diff --git a/libifupdown/lifecycle.c b/libifupdown/lifecycle.c index 681ab02..19982bb 100644 --- a/libifupdown/lifecycle.c +++ b/libifupdown/lifecycle.c @@ -352,6 +352,9 @@ lif_lifecycle_run(const struct lif_execute_opts *opts, struct lif_interface *ifa * but, right now neither debian ifupdown or busybox ifupdown do any recovery, * so we wont right now. */ + if (!lif_lifecycle_run_phase(opts, iface, "create", lifname, up)) + return false; + if (!lif_lifecycle_run_phase(opts, iface, "pre-up", lifname, up)) return false; @@ -376,6 +379,9 @@ lif_lifecycle_run(const struct lif_execute_opts *opts, struct lif_interface *ifa if (!lif_lifecycle_run_phase(opts, iface, "post-down", lifname, up)) return false; + if (!lif_lifecycle_run_phase(opts, iface, "destroy", lifname, up)) + return false; + /* when going up, dependents go down last. */ if (!handle_dependents(opts, iface, collection, state, up)) return false;