interface-file: add some backwards compatibility hacks with use (ref #3)
This commit is contained in:
parent
8138ca8485
commit
a3c138b9b2
3 changed files with 26 additions and 0 deletions
|
@ -95,6 +95,22 @@ lif_interface_file_parse(struct lif_dict *collection, const char *filename)
|
||||||
else if (!strcmp(hint, "loopback"))
|
else if (!strcmp(hint, "loopback"))
|
||||||
cur_iface->is_loopback = true;
|
cur_iface->is_loopback = true;
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(token, "use"))
|
||||||
|
{
|
||||||
|
char *executor = lif_next_token(&bufp);
|
||||||
|
|
||||||
|
/* pass requires as compatibility env vars to appropriate executors (bridge, bond) */
|
||||||
|
if (!strcmp(executor, "dhcp"))
|
||||||
|
cur_iface->is_dhcp = true;
|
||||||
|
else if (!strcmp(executor, "loopback"))
|
||||||
|
cur_iface->is_loopback = true;
|
||||||
|
else if (!strcmp(executor, "bridge"))
|
||||||
|
cur_iface->is_bridge = true;
|
||||||
|
else if (!strcmp(executor, "bond"))
|
||||||
|
cur_iface->is_bond = true;
|
||||||
|
|
||||||
|
lif_dict_add(&cur_iface->vars, token, strdup(executor));
|
||||||
|
}
|
||||||
else if (!strcmp(token, "address"))
|
else if (!strcmp(token, "address"))
|
||||||
{
|
{
|
||||||
char *addr = lif_next_token(&bufp);
|
char *addr = lif_next_token(&bufp);
|
||||||
|
|
|
@ -50,6 +50,8 @@ struct lif_interface {
|
||||||
bool is_dhcp;
|
bool is_dhcp;
|
||||||
bool is_loopback;
|
bool is_loopback;
|
||||||
bool is_auto;
|
bool is_auto;
|
||||||
|
bool is_bridge;
|
||||||
|
bool is_bond;
|
||||||
|
|
||||||
struct lif_dict vars;
|
struct lif_dict vars;
|
||||||
|
|
||||||
|
|
|
@ -215,6 +215,14 @@ lif_lifecycle_run_phase(const struct lif_execute_opts *opts, struct lif_interfac
|
||||||
|
|
||||||
did_gateway = true;
|
did_gateway = true;
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(entry->key, "requires"))
|
||||||
|
{
|
||||||
|
if (iface->is_bridge)
|
||||||
|
lif_environment_push(&envp, "IF_BRIDGE_PORTS", (const char *) entry->data);
|
||||||
|
|
||||||
|
if (iface->is_bond)
|
||||||
|
lif_environment_push(&envp, "IF_BOND_SLAVES", (const char *) entry->data);
|
||||||
|
}
|
||||||
|
|
||||||
char envkey[4096] = "IF_";
|
char envkey[4096] = "IF_";
|
||||||
strlcat(envkey, entry->key, sizeof envkey);
|
strlcat(envkey, entry->key, sizeof envkey);
|
||||||
|
|
Loading…
Reference in a new issue