From b88348145c6dceedbfad8b2221963c6f97a43358 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 29 Jun 2023 17:38:23 +0200 Subject: [PATCH] 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 --- src/confd/src/confd/ietf-interfaces.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/confd/src/confd/ietf-interfaces.c b/src/confd/src/confd/ietf-interfaces.c index d0613263..7299eded 100644 --- a/src/confd/src/confd/ietf-interfaces.c +++ b/src/confd/src/confd/ietf-interfaces.c @@ -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,