Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13739724pxu; Mon, 4 Jan 2021 03:10:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzdR/YO1YLcXDNzJr1uKFX9s17EBHRdBIPj9qVGKmD4O9swzaPAZ5MNoEZheG43rCJJDK0M X-Received: by 2002:a50:f404:: with SMTP id r4mr70257728edm.62.1609758638864; Mon, 04 Jan 2021 03:10:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609758638; cv=none; d=google.com; s=arc-20160816; b=uJxaL46Ha0awqLuh67H5kIpF8YhQv1OJJVLZWCujwylYe5nYRL6o0kJ2o41UC5MQk+ hxheLSnMKYv+VwfP/fwHr3UY6I3lhPcesaudNS7csRZW9TNh1WYGXaT2SGchAEh8508u Zw2+Bjmj54QOr9wDVdDJHuNtHR+oUqyiPqb7IjT3qrnWYejjM4/NSVFPdZUsBscpSJd7 rNd7c8VDKB1YHSsoVl6P4WzCKIyVhEQZ8QrzlWwvyIYhdpSyjmSuPfrlopicir8N4I31 A/YlKseUkgEsgqX9NxDU9dWL9ixd3bGn9Iu0DS0S71Yo2GiOdo4xbmA+jGakPk+Ro6RW 2gWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=aXmF7ZM6uSdCYSkS1zeIpIK77fT10Oniy+NfDbS/Gjs=; b=ou2XXrpxQhsNT0ZZgCFIjM+uFpBQ668tyJLf8rqugIa2LSUB3cJYaVRqgnM9IsJvbI OLvbF3QKZ4iMoWSrbznMMSfPGoD5O/2pLYdIMIT11QTXEbNgz5TFelNmM3qtHTR8ty4n S3Eo+aNHRA76NZ1fu2OyyNWlV42sGN1HI6o4yAs15sMeKKgyu7li1rv1+NxCFQXjbmv4 dHRw9bNiS3xscITM8K8WGdb0y5ld0TZNja6LU50OVJYAk50vF+xkLMnlAUwN90EQdhSS 419Q850X/9xzb5rc6NVd31hejy4EMwgDxB33zcO0NDs8PaaATDNK0nIx8aLZ3B4NirtL 0Vxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bB4Dtakx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v24si22938098eda.114.2021.01.04.03.10.15; Mon, 04 Jan 2021 03:10:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bB4Dtakx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726664AbhADLJA (ORCPT + 99 others); Mon, 4 Jan 2021 06:09:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60861 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726289AbhADLJA (ORCPT ); Mon, 4 Jan 2021 06:09:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609758453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=aXmF7ZM6uSdCYSkS1zeIpIK77fT10Oniy+NfDbS/Gjs=; b=bB4Dtakx95STsVyXIPgywyVWFjBAUExtAfLLpJkosa/Ja7tyZGmvA5DwhsjLVeEPweRcQ8 lylKCCgYAeYwF4Z+9tqEOqkzQn0oliJXtYG2j4AY2tR2jjckpVq10tWD6ne82XmehVyqmR T53a57OSMwcVdlXEVCZ2bfkI5Yacvd0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-213-0Zznn-W8Mtaoj7kuGBl8xA-1; Mon, 04 Jan 2021 06:07:29 -0500 X-MC-Unique: 0Zznn-W8Mtaoj7kuGBl8xA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1042C59; Mon, 4 Jan 2021 11:07:28 +0000 (UTC) Received: from yiche-home.usersys.redhat.com (ovpn-12-222.pek2.redhat.com [10.72.12.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DA8B5D9C6; Mon, 4 Jan 2021 11:07:24 +0000 (UTC) From: Yi Chen To: Chen Yi , Shuah Khan , Florian Westphal , Pablo Neira Ayuso , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Leo Subject: [PATCH net] selftests: netfilter: Pass the family parameter to conntrack tool Date: Mon, 4 Jan 2021 19:07:23 +0800 Message-Id: <20210104110723.43564-1-yiche@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: yiche 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 --- .../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