From 6d15f21073c969749dd1eae8f687abfe41cf6eca Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Thu, 20 Aug 2020 04:07:51 -0600 Subject: [PATCH] interface: handle is_bridge and is_bond hacks in a single place --- libifupdown/interface-file.c | 12 ------------ libifupdown/interface.c | 6 ++++++ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/libifupdown/interface-file.c b/libifupdown/interface-file.c index 7b2766e..06a3c66 100644 --- a/libifupdown/interface-file.c +++ b/libifupdown/interface-file.c @@ -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; } diff --git a/libifupdown/interface.c b/libifupdown/interface.c index fe9acea..b662199 100644 --- a/libifupdown/interface.c +++ b/libifupdown/interface.c @@ -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