From da4484847fc21b2fa3f4c1d738e8862758970280 Mon Sep 17 00:00:00 2001 From: Wen Gu Date: Tue, 23 Sep 2025 19:16:31 +0800 Subject: [PATCH] anolis: selftests: netfilter: xt_string.sh: fix pipe symbol issue ANBZ: #25258 Fix pipe symbol issue, pass complete content to nc. Signed-off-by: Wen Gu --- tools/testing/selftests/netfilter/xt_string.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/netfilter/xt_string.sh b/tools/testing/selftests/netfilter/xt_string.sh index 1802653a4728..8c5749603853 100755 --- a/tools/testing/selftests/netfilter/xt_string.sh +++ b/tools/testing/selftests/netfilter/xt_string.sh @@ -47,11 +47,15 @@ countrule() { # (pattern) showrules | grep -c -- "$*" } send() { # (offset) + infile=$(mktemp) ( for ((i = 0; i < $1 - $hdrlen; i++)); do - printf " " + echo -n " " done - printf "$pattern" - ) | ip netns exec "$ns" nc -w 1 -u 10.1.2.2 27374 + echo -n "$pattern" + ) > "$infile" + + ip netns exec "$ns" nc -w 1 -u 10.1.2.2 27374 < "$infile" + rm -f "$infile" } add_rule bm 1000 1500 -- Gitee