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 <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2024-03-12 09:26:23 +01:00
committed by Tobias Waldekranz
parent 8ea9dd2c55
commit 8ca2d74566
+2 -2
View File
@@ -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;