* [PATCH net] selftests: netfilter: Pass the family parameter to conntrack tool
@ 2021-01-04 11:07 Yi Chen
2021-01-04 12:01 ` Pablo Neira Ayuso
2021-01-05 9:43 ` [PATCHv2 " Yi Chen
0 siblings, 2 replies; 4+ messages in thread
From: Yi Chen @ 2021-01-04 11:07 UTC (permalink / raw)
To: Chen Yi, Shuah Khan, Florian Westphal, Pablo Neira Ayuso,
linux-kselftest, linux-kernel, netdev, Leo
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] selftests: netfilter: Pass the family parameter to conntrack tool
2021-01-04 11:07 [PATCH net] selftests: netfilter: Pass the family parameter to conntrack tool Yi Chen
@ 2021-01-04 12:01 ` Pablo Neira Ayuso
2021-01-05 9:43 ` [PATCHv2 " Yi Chen
1 sibling, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2021-01-04 12:01 UTC (permalink / raw)
To: Yi Chen
Cc: Shuah Khan, Florian Westphal, linux-kselftest, linux-kernel, netdev, Leo
Please, Cc netfilter-devel@vger.kernel.org, and a more few comments
below.
On Mon, Jan 04, 2021 at 07:07:23PM +0800, Yi Chen wrote:
> 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.
Missing Fixes: tag ?
> 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
This branch coding style diverges from the existing code.
> + fi
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCHv2 net] selftests: netfilter: Pass the family parameter to conntrack tool
2021-01-04 11:07 [PATCH net] selftests: netfilter: Pass the family parameter to conntrack tool Yi Chen
2021-01-04 12:01 ` Pablo Neira Ayuso
@ 2021-01-05 9:43 ` Yi Chen
2021-01-05 12:02 ` Hangbin Liu
1 sibling, 1 reply; 4+ messages in thread
From: Yi Chen @ 2021-01-05 9:43 UTC (permalink / raw)
To: Chen Yi, Shuah Khan, Florian Westphal, Pablo Neira Ayuso,
linux-kselftest, linux-kernel, netdev, Leo
From: yiche <yiche@redhat.com>
Fixes: 619ae8e0697a6 ("selftests: netfilter: add test case for conntrack helper assignment")
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
is after this statement 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..bf6b9626c7dd 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 echo $message |grep -q '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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCHv2 net] selftests: netfilter: Pass the family parameter to conntrack tool
2021-01-05 9:43 ` [PATCHv2 " Yi Chen
@ 2021-01-05 12:02 ` Hangbin Liu
0 siblings, 0 replies; 4+ messages in thread
From: Hangbin Liu @ 2021-01-05 12:02 UTC (permalink / raw)
To: Yi Chen
Cc: Shuah Khan, Florian Westphal, Pablo Neira Ayuso, linux-kselftest,
linux-kernel, netdev
On Tue, Jan 05, 2021 at 05:43:16PM +0800, Yi Chen wrote:
> From: yiche <yiche@redhat.com>
>
> Fixes: 619ae8e0697a6 ("selftests: netfilter: add test case for conntrack helper assignment")
>
> 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
> is after this statement executed.
The Fixes tag should be above your signoff tag
Fixes: 619ae8e0697a6 ("selftests: netfilter: add test case for conntrack helper assignment")
> 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..bf6b9626c7dd 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 echo $message |grep -q '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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-01-05 12:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-04 11:07 [PATCH net] selftests: netfilter: Pass the family parameter to conntrack tool Yi Chen
2021-01-04 12:01 ` Pablo Neira Ayuso
2021-01-05 9:43 ` [PATCHv2 " Yi Chen
2021-01-05 12:02 ` Hangbin Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).