From 304e65e2985f4011ab622d9c0cbd99ea8d3a3e82 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Mon, 15 May 2023 11:56:35 +0200 Subject: [PATCH] confd: ietf-interfaces: Handle attribute deletions properly When deleting a value, the old value is in nd.val, so use the absence of a new value to catch deletions. --- src/confd/src/ietf-interfaces.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/confd/src/ietf-interfaces.c b/src/confd/src/ietf-interfaces.c index 895192f1..7ff7987f 100644 --- a/src/confd/src/ietf-interfaces.c +++ b/src/confd/src/ietf-interfaces.c @@ -284,7 +284,7 @@ static int netdag_gen_ipv4_autoconf(struct dagger *net, if (!lydx_get_diff(node, &nd)) return 0; - if (!strcmp(nd.val, "true")) { + if (nd.new && !strcmp(nd.val, "true")) { initctl = dagger_fopen_next(net, "init", ifname, 60, "zeroconf-up.sh"); if (!initctl) @@ -330,7 +330,7 @@ static int netdag_gen_sysctl_bool(struct dagger *net, va_start(ap, fmt); vfprintf(*fpp, fmt, ap); va_end(ap); - fprintf(*fpp, " = %u\n", !strcmp(nd.val, "true") ? 1 : 0); + fprintf(*fpp, " = %u\n", (nd.new && !strcmp(nd.val, "true")) ? 1 : 0); return 0; } static int netdag_gen_sysctl(struct dagger *net,