From 101db509c1d3a520dfa1574fbbfcb26a0f73625c Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Fri, 24 Jul 2020 03:51:31 -0600 Subject: [PATCH] lifecycle: note transient state changes when executing in verbose mode --- libifupdown/lifecycle.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libifupdown/lifecycle.c b/libifupdown/lifecycle.c index b25e0d3..13ec84d 100644 --- a/libifupdown/lifecycle.c +++ b/libifupdown/lifecycle.c @@ -291,20 +291,22 @@ handle_dependents(const struct lif_execute_opts *opts, struct lif_interface *par if (requires == NULL) return true; - char require_ifs[4096]; + char require_ifs[4096] = {}; strlcpy(require_ifs, requires->data, sizeof require_ifs); char *bufp = require_ifs; for (char *tokenp = next_token(&bufp); *tokenp; tokenp = next_token(&bufp)) { - fprintf(stderr, "next iface: %s\n", tokenp); - struct lif_interface *iface = lif_interface_collection_find(collection, tokenp); /* already up or down, skip */ if (up == iface->is_up) continue; + if (opts->verbose) + fprintf(stderr, "ifupdown: changing state of dependent interface %s (of %s) to %s\n", + iface->ifname, parent->ifname, up ? "up" : "down"); + if (!lif_lifecycle_run(opts, iface, collection, state, iface->ifname, up)) return false; }