From 690190a0b98b577ed7d1db22f6b7fb0882e34114 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sat, 25 Jul 2020 08:49:37 -0600 Subject: [PATCH] libifupdown: interface-file: do not process use directives unless in an interface context --- libifupdown/interface-file.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libifupdown/interface-file.c b/libifupdown/interface-file.c index f1dcbad..d7c2835 100644 --- a/libifupdown/interface-file.c +++ b/libifupdown/interface-file.c @@ -100,6 +100,12 @@ lif_interface_file_parse(struct lif_dict *collection, const char *filename) { char *executor = lif_next_token(&bufp); + if (cur_iface == NULL) + { + fprintf(stderr, "%s: use '%s' without interface\n", filename, executor); + goto parse_error; + } + /* pass requires as compatibility env vars to appropriate executors (bridge, bond) */ if (!strcmp(executor, "dhcp")) cur_iface->is_dhcp = true;