lifecyle: Use lif_address_format_cidr() for IF_ADDRESSES
Previously IF_ADDRESSES would not contain a prefix length if the address entry in the configuration did not was in CIDR format but had a netmask set seperately. This commit fixes that behaviour and computes a CIDR netmask if necessary. Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
parent
365461a6f6
commit
de207a5950
1 changed files with 2 additions and 3 deletions
|
@ -174,14 +174,13 @@ build_environment(char **envp[], const struct lif_execute_opts *opts, const stru
|
|||
|
||||
LIF_DICT_FOREACH(iter, &iface->vars)
|
||||
{
|
||||
const struct lif_dict_entry *entry = iter->data;
|
||||
struct lif_dict_entry *entry = iter->data;
|
||||
|
||||
if (!strcmp(entry->key, "address"))
|
||||
{
|
||||
struct lif_address *addr = entry->data;
|
||||
char addrbuf[4096];
|
||||
|
||||
if (!lif_address_unparse(addr, addrbuf, sizeof addrbuf, true))
|
||||
if (!lif_address_format_cidr(iface, entry, addrbuf, sizeof(addrbuf)))
|
||||
continue;
|
||||
|
||||
/* Append address to buffer */
|
||||
|
|
Loading…
Reference in a new issue