From 19f0db37399fb2f49ac49776a30c0b8fda7ed994 Mon Sep 17 00:00:00 2001 From: Wang Sen Di Date: Tue, 16 Dec 2025 10:36:10 +0800 Subject: [PATCH] - --- netflow/iptables.sh | 4 ++-- netflow/test.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/netflow/iptables.sh b/netflow/iptables.sh index 81f62f1..b201ff6 100644 --- a/netflow/iptables.sh +++ b/netflow/iptables.sh @@ -6,7 +6,7 @@ if [[ -d "/host/proc/1/" ]]; then source /apps/gitrce/hook/singleton.sh "$0"; fi __get_mount_paths_cgroup_id() { docker ps -q --no-trunc | while read -r cid; do _path=$(docker inspect "$cid" --format '{{range .Mounts}}{{.Source}}{{"\n"}}{{end}}' 2>/dev/null) - if grep -q "$CACHE/$FILE_PATH_START" <<<"$_path"; then + if grep -qE "$CACHE/$FILE_PATH_START|writable" <<<"$_path"; then _cmd="find /sys/fs/cgroup/ -maxdepth 2 -type d -name $cid | grep net_cls 2>/dev/null" _cgroup_path=$(nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c "$_cmd") _cmd_classid="cat $_cgroup_path/net_cls.classid 2>/dev/null" @@ -15,7 +15,7 @@ __get_mount_paths_cgroup_id() { fi done } -__get_mount_paths_cgroup_id +# __get_mount_paths_cgroup_id __get_in_cgroup_ids() { awk '$0 != 0 && $0 != 1' /sys/fs/cgroup/net_cls,net_prio/*/net_cls.classid diff --git a/netflow/test.sh b/netflow/test.sh index 8190a12..5a25317 100644 --- a/netflow/test.sh +++ b/netflow/test.sh @@ -4,7 +4,7 @@ __get_mount_paths_cgroup_id() { docker ps -q --no-trunc | while read -r cid; do _path=$(docker inspect "$cid" --format '{{range .Mounts}}{{.Source}}{{"\n"}}{{end}}' 2>/dev/null) if grep -q "$CACHE/$FILE_PATH_START" <<<"$_path"; then - _cmd="find /sys/fs/cgroup/ -maxdepth 2 -type d -name $cid | grep net_cls 2>/dev/null" + _cmd="find /sys/fs/cgroup/ -type d -name $cid | grep net_cls 2>/dev/null" _cgroup_path=$(nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c "$_cmd") _cmd_classid="cat $_cgroup_path/net_cls.classid 2>/dev/null" _cgroup_id=$(nsenter --mount=/host/proc/1/ns/mnt --net=/host/proc/1/ns/net sh -c "$_cmd_classid")