libifupdown: interface-file: do not process use directives unless in an interface context

This commit is contained in:
Ariadne Conill 2020-07-25 08:49:37 -06:00
parent 4e452c5fec
commit 690190a0b9

View file

@ -100,6 +100,12 @@ lif_interface_file_parse(struct lif_dict *collection, const char *filename)
{ {
char *executor = lif_next_token(&bufp); 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) */ /* pass requires as compatibility env vars to appropriate executors (bridge, bond) */
if (!strcmp(executor, "dhcp")) if (!strcmp(executor, "dhcp"))
cur_iface->is_dhcp = true; cur_iface->is_dhcp = true;