Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp14452184pxu; Tue, 5 Jan 2021 01:46:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2bnGeh1DtBNBWSwhVPDe6IHrgzVJFD4IbbZ8qo0xUrLMqjHLfuH33kN5pFJJlU6PjUM6q X-Received: by 2002:a17:906:3d62:: with SMTP id r2mr71632291ejf.295.1609839965877; Tue, 05 Jan 2021 01:46:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609839965; cv=none; d=google.com; s=arc-20160816; b=Llz2KrYql4+l7G5zVZae+I8ePY8RWTLTfTzBTa41+pnwQyZZ7g9mUVXo8b3bLK/WnW NONItQs4NOEd8oJc91flfnKMNR20kdlBepX9IDGdBzgBEM3DCZMJEI/Wmll62hm7mucL eqj5hqmCbOxg9qPwn4SDe+sEffPMLj55VUrVbHv8StdErvdDv2CKJwCTECnioWvZ4oK+ kI29l2NGjwGmCKRoVS9fVQHBLZ4Gkht5fvRgkbIn67ON+U8Gk5oz0M96H7Pxhu1hbA1w 6A5HJLYIObmBIKlIT1vpjTdgjpghDEZNDtzT0xAljqV+W4dpq0H6oEkSPvvuBlFter8X PLtQ== 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 :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=u/pf3MEGHy4BVUnm30O0L31xAu34MGBgOtsz0A/Rhcg=; b=l8oL5gbUTNE/089ub9/myNoyD7w11VR2KLECDREARKrFCLnrz8SpFbGJhZvvJWqsVV YeFJFdHCtr3/Y1V1ZvDAT4nldbTQL9phVjXV6LGxvUc6SOpyZ3y59Solksam+6dNjd+b M/rPslSCVp77S+tXYg4pcCCWMCUYQ+PDYlrzWCrzQtjBP+rHONpBvysKSpg35t/N1yG4 91UauZDOCZxmJFujdqGanIbb/z5GYxFTNxNcW4ZIaeOn9r77fCloI9Vfd7FEhpZ71EGd d5W5ayTCu1lJ3SRNLzj2dZ2tWmL1b7DffC5+1o+niLU3y2Kr2qtkOfickh30aAgwOMIL TiBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I9S5rONj; 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 n25si30974043edw.77.2021.01.05.01.45.41; Tue, 05 Jan 2021 01:46:05 -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=I9S5rONj; 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 S1728020AbhAEJow (ORCPT + 99 others); Tue, 5 Jan 2021 04:44:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34463 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727807AbhAEJov (ORCPT ); Tue, 5 Jan 2021 04:44:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609839805; 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: in-reply-to:in-reply-to:references:references; bh=u/pf3MEGHy4BVUnm30O0L31xAu34MGBgOtsz0A/Rhcg=; b=I9S5rONjo+1VTw6Kvhh4Vno1wNTtUlY1Ms9mWpyPagzILVwJ7BA+/eR7QThkZaQhmmNj+E QuedpZsMQUyGGzuTxOROLowlDZWE724GqPbTFqldqa+MyuyhkHg8SgDqvdChsE/5fG9Iy1 JszKO6CfJQrY3ub/Vz0DuReLRB0o8pA= 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-98-eV-NK1QRM5yLiP4y727A1Q-1; Tue, 05 Jan 2021 04:43:23 -0500 X-MC-Unique: eV-NK1QRM5yLiP4y727A1Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CA59310054FF; Tue, 5 Jan 2021 09:43:21 +0000 (UTC) Received: from yiche-home.usersys.redhat.com (ovpn-12-69.pek2.redhat.com [10.72.12.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id C307E62463; Tue, 5 Jan 2021 09:43:18 +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: [PATCHv2 net] selftests: netfilter: Pass the family parameter to conntrack tool Date: Tue, 5 Jan 2021 17:43:16 +0800 Message-Id: <20210105094316.23683-1-yiche@redhat.com> In-Reply-To: <20210104110723.43564-1-yiche@redhat.com> References: <20210104110723.43564-1-yiche@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: yiche 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 --- .../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