From 8ca2d74566cc4dfd9c077bf025fc7d04ac09e91d Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Tue, 12 Mar 2024 07:42:40 +0100 Subject: [PATCH] confd: ensure we always return cni status This patch fixes a runtime error triggered by modifying an interface currently used by a container. The CNI code must always return the CNI status (reserved for container or not). How to trigger: - Create veth pair - Make one end container-network and add to container - Leave - Return to configure and set an IP address on container interface - Leave - BOOM Signed-off-by: Joachim Wiberg --- src/confd/src/cni.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/confd/src/cni.c b/src/confd/src/cni.c index 80d3a53d..3d09162a 100644 --- a/src/confd/src/cni.c +++ b/src/confd/src/cni.c @@ -361,10 +361,10 @@ static int iface_gen_cni(const char *ifname, struct lyd_node *cif) } if (!strcmp(type, "host")) - return cni_host(net, ifname); + return cni_host(net, ifname) ?: 1; if (!strcmp(type, "bridge")) - return cni_bridge(net, ifname); + return cni_bridge(net, ifname) ?: 1; ERROR("Unknown container network type %s, skipping.", type); return 0;