From: Yi Chen <yiche@redhat.com>
To: Chen Yi <yiche@redhat.com>, Shuah Khan <shuah@kernel.org>,
Florian Westphal <fw@strlen.de>,
Pablo Neira Ayuso <pablo@netfilter.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, Leo <liuhangbin@gmail.com>
Subject: [PATCH net] selftests: netfilter: Pass the family parameter to conntrack tool
Date: Mon, 4 Jan 2021 19:07:23 +0800 [thread overview]
Message-ID: <20210104110723.43564-1-yiche@redhat.com> (raw)
From: yiche <yiche@redhat.com>
Fix nft_conntrack_helper.sh fake fail:
conntrack tool need "-f ipv6" parameter to show out ipv6 traffic items.
sleep 1 second after background nc send packet, to make sure check
result after this statement is executed.
Signed-off-by: yiche <yiche@redhat.com>
---
.../selftests/netfilter/nft_conntrack_helper.sh | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/netfilter/nft_conntrack_helper.sh b/tools/testing/selftests/netfilter/nft_conntrack_helper.sh
index edf0a48da6bf..ebdf2b23c8e3 100755
--- a/tools/testing/selftests/netfilter/nft_conntrack_helper.sh
+++ b/tools/testing/selftests/netfilter/nft_conntrack_helper.sh
@@ -94,7 +94,13 @@ check_for_helper()
local message=$2
local port=$3
- ip netns exec ${netns} conntrack -L -p tcp --dport $port 2> /dev/null |grep -q 'helper=ftp'
+ if [[ "$2" =~ "ipv6" ]];then
+ local family=ipv6
+ else
+ local family=ipv4
+ fi
+
+ ip netns exec ${netns} conntrack -L -f $family -p tcp --dport $port 2> /dev/null |grep -q 'helper=ftp'
if [ $? -ne 0 ] ; then
echo "FAIL: ${netns} did not show attached helper $message" 1>&2
ret=1
@@ -111,8 +117,8 @@ test_helper()
sleep 3 | ip netns exec ${ns2} nc -w 2 -l -p $port > /dev/null &
- sleep 1
sleep 1 | ip netns exec ${ns1} nc -w 2 10.0.1.2 $port > /dev/null &
+ sleep 1
check_for_helper "$ns1" "ip $msg" $port
check_for_helper "$ns2" "ip $msg" $port
@@ -128,8 +134,8 @@ test_helper()
sleep 3 | ip netns exec ${ns2} nc -w 2 -6 -l -p $port > /dev/null &
- sleep 1
sleep 1 | ip netns exec ${ns1} nc -w 2 -6 dead:1::2 $port > /dev/null &
+ sleep 1
check_for_helper "$ns1" "ipv6 $msg" $port
check_for_helper "$ns2" "ipv6 $msg" $port
--
2.26.2
next reply other threads:[~2021-01-04 11:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-04 11:07 Yi Chen [this message]
2021-01-04 12:01 ` [PATCH net] selftests: netfilter: Pass the family parameter to conntrack tool Pablo Neira Ayuso
2021-01-05 9:43 ` [PATCHv2 " Yi Chen
2021-01-05 12:02 ` Hangbin Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210104110723.43564-1-yiche@redhat.com \
--to=yiche@redhat.com \
--cc=fw@strlen.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox