mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-06 15:43:02 +02:00
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:
committed by
Tobias Waldekranz
parent
8ca2d74566
commit
b4690f3850
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user