statd: skip container interfaces in status output, for now

This patch prevents statd from failing and logging errors on interfaces
currently in another network namespace.

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 8ca2d74566
commit b4690f3850
+10
View File
@@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <jansson.h>
#include <net/if.h>
#include <srx/common.h>
#include <srx/helpers.h>
@@ -36,6 +37,15 @@ int ip_link_check_group(const char *ifname, const char *group)
json_t *j_root;
json_t *j_val;
/* Check if it's a container interface */
if (fexistf("/etc/cni/net.d/%s.conflist", ifname)) {
/* Has it been handed over to another network namespace already? */
if (!if_nametoindex(ifname)) {
DEBUG("Interface %s currently in use by a container, skipping.", ifname);
return 0;
}
}
snprintf(cmd, sizeof(cmd), "ip -s -d -j link show dev %s 2>/dev/null", ifname);
j_root = json_get_output(cmd);