libifupdown: interface: add support for automatic "use static" insertion
This commit is contained in:
parent
052156ac09
commit
987e6399de
3 changed files with 10 additions and 0 deletions
|
@ -115,6 +115,8 @@ lif_interface_file_parse(struct lif_dict *collection, const char *filename)
|
||||||
cur_iface->is_bridge = true;
|
cur_iface->is_bridge = true;
|
||||||
else if (!strcmp(executor, "bond"))
|
else if (!strcmp(executor, "bond"))
|
||||||
cur_iface->is_bond = true;
|
cur_iface->is_bond = true;
|
||||||
|
else if (!strcmp(executor, "static"))
|
||||||
|
cur_iface->is_static = true;
|
||||||
|
|
||||||
lif_dict_add(&cur_iface->vars, token, strdup(executor));
|
lif_dict_add(&cur_iface->vars, token, strdup(executor));
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,14 @@ lif_interface_address_add(struct lif_interface *interface, const char *address)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!interface->is_static)
|
||||||
|
{
|
||||||
|
lif_dict_add(&interface->vars, "use", strdup("static"));
|
||||||
|
interface->is_static = true;
|
||||||
|
}
|
||||||
|
|
||||||
lif_dict_add(&interface->vars, "address", addr);
|
lif_dict_add(&interface->vars, "address", addr);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ struct lif_interface {
|
||||||
bool is_auto;
|
bool is_auto;
|
||||||
bool is_bridge;
|
bool is_bridge;
|
||||||
bool is_bond;
|
bool is_bond;
|
||||||
|
bool is_static;
|
||||||
|
|
||||||
struct lif_dict vars;
|
struct lif_dict vars;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue