confd: fix regression in enabling ipv4 zeroconf address

To reproduce regression, before fix, in CLI from factory-default:

  > configure
  > set interfaces interface e0 ipv4 autoconf enable true
  > leave
  > shell
  $ ps; ip -br a

Turns out, for some reason I cannot figure out, that we cannot use the
same pattern as for ipv6 with lydx_get_descendant().  Manually fetching
the node works though.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2023-06-30 14:13:09 +02:00
committed by Tobias Waldekranz
parent d6eca354b3
commit b88348145c
+4 -3
View File
@@ -474,7 +474,7 @@ static int netdag_gen_ipv4_autoconf(struct dagger *net, struct lyd_node *cif,
struct lyd_node *ipconf = lydx_get_child(cif, "ipv4");
struct lyd_node *ipdiff = lydx_get_child(dif, "ipv4");
const char *ifname = lydx_get_cattr(dif, "name");
struct lyd_node *node;
struct lyd_node *node, *zcip;
struct lydx_diff nd;
FILE *initctl;
int err = 0;
@@ -489,10 +489,11 @@ static int netdag_gen_ipv4_autoconf(struct dagger *net, struct lyd_node *cif,
goto disable;
}
node = lydx_get_descendant(lydx_get_child(ipdiff, "autoconf"), "enabled", NULL);
if (!node || !lydx_get_diff(node, &nd))
zcip = lydx_get_child(ipdiff, "autoconf");
if (!zcip || !(node = lydx_get_child(zcip, "enabled")))
return 0;
lydx_get_diff(node, &nd);
if (nd.new && !strcmp(nd.val, "true")) {
enable:
initctl = dagger_fopen_next(net, "init", ifname,