interface: handle is_bridge and is_bond hacks in a single place

This commit is contained in:
Ariadne Conill 2020-08-20 04:07:51 -06:00
parent aba140a977
commit 6d15f21073
2 changed files with 6 additions and 12 deletions

View file

@ -156,12 +156,6 @@ handle_generic(struct lif_dict *collection, const char *filename, size_t lineno,
char *addon = strndup(token, word_end - token);
lif_interface_use_executor(cur_iface, addon);
free(addon);
/* pass requires as compatibility env vars to appropriate executors (bridge, bond) */
if (!strcmp(addon, "bridge"))
cur_iface->is_bridge = true;
else if (!strcmp(addon, "bond"))
cur_iface->is_bond = true;
}
return true;
@ -270,12 +264,6 @@ handle_use(struct lif_dict *collection, const char *filename, size_t lineno, cha
return false;
}
/* pass requires as compatibility env vars to appropriate executors (bridge, bond) */
if (!strcmp(executor, "bridge"))
cur_iface->is_bridge = true;
else if (!strcmp(executor, "bond"))
cur_iface->is_bond = true;
lif_interface_use_executor(cur_iface, executor);
return true;
}

View file

@ -137,6 +137,12 @@ lif_interface_use_executor(struct lif_interface *interface, const char *executor
if (lif_dict_add_once(&interface->vars, "use", exec_addon, (lif_dict_cmp_t) strcmp) == NULL)
free(exec_addon);
/* pass requires as compatibility env vars to appropriate executors (bridge, bond) */
if (!strcmp(executor, "bridge"))
interface->is_bridge = true;
else if (!strcmp(executor, "bond"))
interface->is_bond = true;
}
void