From patchwork Wed Oct 11 19:49:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 151534 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp777041vqb; Wed, 11 Oct 2023 12:51:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFkNp6YzHRDLRFElciBIsDh6tKxoFT3n76IMMyaZG7U9n6i14uq+dl2uGnwxCaXHzK8hMkw X-Received: by 2002:a05:6a00:2e92:b0:692:b3d4:e6c3 with SMTP id fd18-20020a056a002e9200b00692b3d4e6c3mr24045286pfb.0.1697053896966; Wed, 11 Oct 2023 12:51:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697053896; cv=none; d=google.com; s=arc-20160816; b=xehnGgHvLaJSpl4mkxv9gNdlTqn4hLBBQ23diCmVfi3VK/PgZlzrbo5NxAf3WOdP0V cfVoM9RpVolpy9ER3BlaY9Dhvdac8oZpaMxRI8xnvmvWhmRIjMaIINgCP1wCzkwiNoGR ZmicDHWoEUDQNBAbyS8sCQu/V2EM06MqUkCUgnvO1mQO+YawL6Z42CYcAfxdgSj5AKRZ iP7mFGqgDMWUMEDNLgzCajB6//4SFJWYlTxKl8K8tMP6QMCv6Sc2fuVUvfoFwAG/RaJp yt+7lO5s4RKz2fhVoMnzh3mL+tY3N+INYyxozW52AL/nLjfBHvmMgtBUVijchW6iAhPk xyvg== 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:cc:to:from :dkim-signature; bh=rbzsF8kc6hKEZwL8kF947pxRM0gGlgmaq8q3Uc1AlKE=; fh=88nBSjTOrhHvyQS3Sgn//fCA45rCHSUCvyWdnfpu45A=; b=AlkTDqwoHD3Q9PCRe4TfoR4Vu0Fub9Pt1I/9VG+Aqmws2PyfbcTE+j5SH1GTWmlplV AZ5oIOPsG+d+c51mEvmmS/9W6RnFY/iKfJXvCGPKkmLHUS+hmJRp4huphqQHjqEltaMy aHQKIN/XDNbhedu0PLbnyunspKK6gbe5Zn6QgV3wVs20Nx3oISBEYv+FcmwMaD6ohCO+ aFt3OBGWc/CRcWmjorW/6l4HQ4JqVHGvONBxCCPPW5+cTja34toAAmfydOXh6i+zv5Mk yPGbq5tojSJz+KZTl68E5BlRaOGBK/qAJNVn7q0BobFdQ1YMVC2x8wqXEVa+jHkW2H6s mIQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YARqPrFb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id fj33-20020a056a003a2100b006910070695fsi12806183pfb.31.2023.10.11.12.51.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 12:51:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YARqPrFb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id DDD238021ED8; Wed, 11 Oct 2023 12:51:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345948AbjJKTvW (ORCPT + 18 others); Wed, 11 Oct 2023 15:51:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234840AbjJKTvU (ORCPT ); Wed, 11 Oct 2023 15:51:20 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB684AF for ; Wed, 11 Oct 2023 12:49:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697053785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rbzsF8kc6hKEZwL8kF947pxRM0gGlgmaq8q3Uc1AlKE=; b=YARqPrFbl/qRWZwq8r8M5sZfojXsuHNoHRmOfpkaFsbIc+swjPL02gw46uQ7MwFI99bzBN +ZvA4jz+9E2A/essDhjEuePVz34YNdp8L1fJtcFHqdkgpBPkOLV7gPt2jj9vSJd18s6Tmn 5d/UBjqvUC5HC4sZOmbeQh+NEYlAS8U= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-479-mw5gTCvCM8241slRsYM_Hg-1; Wed, 11 Oct 2023 15:49:42 -0400 X-MC-Unique: mw5gTCvCM8241slRsYM_Hg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6755D803497; Wed, 11 Oct 2023 19:49:41 +0000 (UTC) Received: from RHTPC1VM0NT.lan (unknown [10.22.34.140]) by smtp.corp.redhat.com (Postfix) with ESMTP id 927441C060B5; Wed, 11 Oct 2023 19:49:40 +0000 (UTC) From: Aaron Conole To: netdev@vger.kernel.org Cc: dev@openvswitch.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Pravin B Shelar , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Adrian Moreno , Eelco Chaudron , shuah@kernel.org Subject: [PATCH net v2 1/4] selftests: openvswitch: Add version check for pyroute2 Date: Wed, 11 Oct 2023 15:49:36 -0400 Message-ID: <20231011194939.704565-2-aconole@redhat.com> In-Reply-To: <20231011194939.704565-1-aconole@redhat.com> References: <20231011194939.704565-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 11 Oct 2023 12:51:30 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779489987143359996 X-GMAIL-MSGID: 1779489987143359996 Paolo Abeni reports that on some systems the pyroute2 version isn't new enough to run the test suite. Ensure that we support a minimum version of 0.6 for all cases (which does include the existing ones). The 0.6.1 version was released in May of 2021, so should be propagated to most installations at this point. The alternative that Paolo proposed was to only skip when the add-flow is being run. This would be okay for most cases, except if a future test case is added that needs to do flow dump without an associated add (just guessing). In that case, it could also be broken and we would need additional skip logic anyway. Just draw a line in the sand now. Fixes: 25f16c873fb1 ("selftests: add openvswitch selftest suite") Reported-by: Paolo Abeni Closes: https://lore.kernel.org/lkml/8470c431e0930d2ea204a9363a60937289b7fdbe.camel@redhat.com/ Signed-off-by: Aaron Conole --- v2: Include version information tools/testing/selftests/net/openvswitch/openvswitch.sh | 2 +- tools/testing/selftests/net/openvswitch/ovs-dpctl.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh index 9c2012d70b08e..220c3356901ef 100755 --- a/tools/testing/selftests/net/openvswitch/openvswitch.sh +++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh @@ -525,7 +525,7 @@ run_test() { fi if python3 ovs-dpctl.py -h 2>&1 | \ - grep "Need to install the python" >/dev/null 2>&1; then + grep -E "Need to (install|upgrade) the python" >/dev/null 2>&1; then stdbuf -o0 printf "TEST: %-60s [PYLIB]\n" "${tdesc}" return $ksft_skip fi diff --git a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py b/tools/testing/selftests/net/openvswitch/ovs-dpctl.py index 912dc8c490858..e4c24d5edf20c 100644 --- a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py +++ b/tools/testing/selftests/net/openvswitch/ovs-dpctl.py @@ -28,8 +28,10 @@ try: from pyroute2.netlink import nlmsg_atoms from pyroute2.netlink.exceptions import NetlinkError from pyroute2.netlink.generic import GenericNetlinkSocket + import pyroute2 + except ModuleNotFoundError: - print("Need to install the python pyroute2 package.") + print("Need to install the python pyroute2 package >= 0.6.") sys.exit(0) @@ -1998,6 +2000,12 @@ def main(argv): nlmsg_atoms.ovskey = ovskey nlmsg_atoms.ovsactions = ovsactions + # version check for pyroute2 + prverscheck = pyroute2.__version__.split(".") + if int(prverscheck[0]) == 0 and int(prverscheck[1]) < 6: + print("Need to upgrade the python pyroute2 package to >= 0.6.") + sys.exit(0) + parser = argparse.ArgumentParser() parser.add_argument( "-v", From patchwork Wed Oct 11 19:49:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 151533 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp776621vqb; Wed, 11 Oct 2023 12:50:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNAYulFBeC8DEGViB+aYhmJk/DjpGNup/95a82fzTGMVrxWm3Ghl0fy1vSK1zrw1EYrJ15 X-Received: by 2002:a17:902:a40e:b0:1c9:bd60:72a6 with SMTP id p14-20020a170902a40e00b001c9bd6072a6mr5224122plq.4.1697053848381; Wed, 11 Oct 2023 12:50:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697053848; cv=none; d=google.com; s=arc-20160816; b=ErzKjd+Gk6v2vGcLeWeb6KBlzZR7R0BVvPwdMB0frJgZIbM0Xb7vG2TOXzan6C824L GgwcMXKy8cNaU6mpdGCUDljw4GqEfuKVXBhTQvIq3ghsIfSzQP1OT544VJp9/I/7ag7I T4yUmQIonuISU3PMrkw7qEz7Y+QXMlnagxV84qHGf3KNlJ/Zdkc+YGAPYOt+2ePNXt61 esSSDR0Est/icyyIk2pTZcU7sR77n8OhPo4rAJ43bh+BA5Ei4KpfC7H1k9fRF3+fyGYc yY2WXrd90DEQJ2Ei1cOkx4KLpop5aJdS8cYe9TxPIr4l3+sj8MxEaXKl5MZZYrTF+3Pj E01w== 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:cc:to:from :dkim-signature; bh=91TzyC8lAiMG2w2YCIi0bUrneGmE9j31gOJx7+kZs/U=; fh=88nBSjTOrhHvyQS3Sgn//fCA45rCHSUCvyWdnfpu45A=; b=HFw4Fq9fzLlRj8pXDzNz0a5IwbcjSyZLKXD4XI+/o9KGecBbRtyALK8RN+puhF6POR r/NjfQir94D8dTlnhSYOieqqnTb/v67K7tiKlGLJZSbphib8IN1TNq0jif/t6ov+oPS8 pajExu6v4CyxYcppaPY1+4WWmzvvkoOymoaSjlhupnaheUsEuGevmWycQ06TfjfJtnsn m4fcTOy8t0JRjv8T5HnE5Hp/Xyq6+wWwpVn67yNlFy9KoMqlJJCzz1LJtTNskM6kFpyz 2xBtZD5o5qs3bJ5wj1bHQUzKatgdQYeXfDTtH2KN5nujtJ/KzNu1CCMMx5Fj7fS1HIUO Hxgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=D8SghRhg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id g13-20020a170902c38d00b001c62ca6d540si423038plg.77.2023.10.11.12.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 12:50:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=D8SghRhg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7AFCF80EE0EE; Wed, 11 Oct 2023 12:50:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234878AbjJKTuj (ORCPT + 18 others); Wed, 11 Oct 2023 15:50:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233467AbjJKTue (ORCPT ); Wed, 11 Oct 2023 15:50:34 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A021BA for ; Wed, 11 Oct 2023 12:49:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697053787; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=91TzyC8lAiMG2w2YCIi0bUrneGmE9j31gOJx7+kZs/U=; b=D8SghRhg9aTdvw8Cn6XNqTxx5963L5jgIjjJEuhvgxkqPn4wVDsY1VEF8/GGpvY2f8qMiu nTGbdoShtBn3Lle2uj0wuydxdLR5BX6bgy3FiKnbqVP3YJLknSByFtcCzzdiU83RSuiNOm ty+R3zu7AsR/65GFzTdsKPvaX70AT5U= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-652-vX6TnARzM2up3P1Duj4RCQ-1; Wed, 11 Oct 2023 15:49:43 -0400 X-MC-Unique: vX6TnARzM2up3P1Duj4RCQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3228A832D6D; Wed, 11 Oct 2023 19:49:42 +0000 (UTC) Received: from RHTPC1VM0NT.lan (unknown [10.22.34.140]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A2DC1C060B5; Wed, 11 Oct 2023 19:49:41 +0000 (UTC) From: Aaron Conole To: netdev@vger.kernel.org Cc: dev@openvswitch.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Pravin B Shelar , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Adrian Moreno , Eelco Chaudron , shuah@kernel.org Subject: [PATCH net v2 2/4] selftests: openvswitch: Catch cases where the tests are killed Date: Wed, 11 Oct 2023 15:49:37 -0400 Message-ID: <20231011194939.704565-3-aconole@redhat.com> In-Reply-To: <20231011194939.704565-1-aconole@redhat.com> References: <20231011194939.704565-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 11 Oct 2023 12:50:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779489936182342477 X-GMAIL-MSGID: 1779489936182342477 In case of fatal signal, or early abort at least cleanup the current test case. Fixes: 25f16c873fb1 ("selftests: add openvswitch selftest suite") Signed-off-by: Aaron Conole --- tools/testing/selftests/net/openvswitch/openvswitch.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh index 220c3356901ef..2a0112be7ead5 100755 --- a/tools/testing/selftests/net/openvswitch/openvswitch.sh +++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh @@ -3,6 +3,8 @@ # # OVS kernel module self tests +trap ovs_exit_sig EXIT TERM INT ERR + # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 From patchwork Wed Oct 11 19:49:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 151536 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp777153vqb; Wed, 11 Oct 2023 12:51:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2HqPCWcLJ15k1umUaHXg0yVk+HPtvgOWD19ZZSQMyJOkEaO9mXwNOQubZW7Y0GIPTRUhi X-Received: by 2002:a17:902:f686:b0:1c7:5581:f9c with SMTP id l6-20020a170902f68600b001c755810f9cmr24199628plg.0.1697053918113; Wed, 11 Oct 2023 12:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697053918; cv=none; d=google.com; s=arc-20160816; b=0nqsuSc2gDHXTjYNy1NGytjpcJ7pvI2IbzQpcknnMt9/cbv8WxV2WSl8vrdpk2xdNk fi0ao5czknZdAdELI6Ur/7gReOai1/tCdpzEflM/NlKInvevIYXRBq0TDXQtfAzE/L3O fiywymcas3ZJ9tF/q/SkafpDLdyYKmRfy1wZgvcDHyihHd3SZsqI5RPmk8zHNSjJ3ciL qiij5l7Ct82ASQkn3ktqdk215DRTt4Hzt3wBxX08vLw2bwkWQUQQiJPxYb1xvcRdXQWF YSMSXJsP7kvKngpazfmcG33spN4xmTA/l7ixdWpg9J+yhD74585L96cKS6pOgKt0FURZ uLjw== 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:cc:to:from :dkim-signature; bh=Iw1db1f9U7DoYdHPvbNT3gp9obI4+XkIvnwgO5EvR7c=; fh=88nBSjTOrhHvyQS3Sgn//fCA45rCHSUCvyWdnfpu45A=; b=Ejmn/lg74XMI2OEMM2vwOAUe4Rl9cikShEhQ02Jq6sBK4mnmyTFY0qEsmPubCoojf9 1wU4II56fBUxbsUD/0szPq3POneCAuEsX4uWOx5LqiUd4oeynyXSsI8Ge8RlngO0/RQ8 5a/CEQrIH7gGgz+CL13GGUbeePxZQfxIXqIKh8ddOm1krVwZ1VtJ9l6ReOYuTiarOcoA ZQodI5rwbPeNurcpZ36gTrhID536sY3ticDlDszl4JEpgcuTE7AZnevaD2iPuqwpWtIH vxRXyN+Qxxp5IrC0+CByNdNTAapjbSBubOaqchwOFGPm2X97SF3nBgLpCKsr1f1sfO11 TMEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BBWDv44l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id f12-20020a170902ce8c00b001bc5a4f56fcsi417629plg.554.2023.10.11.12.51.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 12:51:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BBWDv44l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 4CA418215AD6; Wed, 11 Oct 2023 12:51:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235165AbjJKTv3 (ORCPT + 18 others); Wed, 11 Oct 2023 15:51:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233360AbjJKTvW (ORCPT ); Wed, 11 Oct 2023 15:51:22 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5F81C4 for ; Wed, 11 Oct 2023 12:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697053787; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Iw1db1f9U7DoYdHPvbNT3gp9obI4+XkIvnwgO5EvR7c=; b=BBWDv44lrWVLKNZQi5h8/W3/5dJZaXXjZ7Udv3OY8RdEMKlsfVZQdMEc0rT1ziRxuWKgf8 ZwNHJveWtirvHsHnXtoPoSVNKYkYfymAiyKD7hq8QDQ9lrje3+QwW+2n7jIe6wcQ2yZntI mHu8tU4tzavVQ9MEVGpGEALNskRnqYs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-115-7XB-f4rcMai1ZDVvhylk9A-1; Wed, 11 Oct 2023 15:49:44 -0400 X-MC-Unique: 7XB-f4rcMai1ZDVvhylk9A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DAAD6185A79C; Wed, 11 Oct 2023 19:49:43 +0000 (UTC) Received: from RHTPC1VM0NT.lan (unknown [10.22.34.140]) by smtp.corp.redhat.com (Postfix) with ESMTP id 433551C060B5; Wed, 11 Oct 2023 19:49:42 +0000 (UTC) From: Aaron Conole To: netdev@vger.kernel.org Cc: dev@openvswitch.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Pravin B Shelar , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Adrian Moreno , Eelco Chaudron , shuah@kernel.org Subject: [PATCH net v2 3/4] selftests: openvswitch: Skip drop testing on older kernels Date: Wed, 11 Oct 2023 15:49:38 -0400 Message-ID: <20231011194939.704565-4-aconole@redhat.com> In-Reply-To: <20231011194939.704565-1-aconole@redhat.com> References: <20231011194939.704565-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 11 Oct 2023 12:51:55 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779490008837319470 X-GMAIL-MSGID: 1779490008837319470 Kernels that don't have support for openvswitch drop reasons also won't have the drop counter reasons, so we should skip the test completely. It previously wasn't possible to build a test case for this without polluting the datapath, so we introduce a mechanism to clear all the flows from a datapath allowing us to test for explicit drop actions, and then clear the flows to build the original test case. Fixes: 4242029164d6 ("selftests: openvswitch: add explicit drop testcase") Signed-off-by: Aaron Conole --- v2: Address intermingled tabs vs. spaces .../selftests/net/openvswitch/openvswitch.sh | 17 ++++++++++ .../selftests/net/openvswitch/ovs-dpctl.py | 34 +++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh index 2a0112be7ead5..f8499d4c87f3f 100755 --- a/tools/testing/selftests/net/openvswitch/openvswitch.sh +++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh @@ -144,6 +144,12 @@ ovs_add_flow () { return 0 } +ovs_del_flows () { + info "Deleting all flows from DP: sbx:$1 br:$2" + ovs_sbx "$1" python3 $ovs_base/ovs-dpctl.py del-flows "$2" + return 0 +} + ovs_drop_record_and_run () { local sbx=$1 shift @@ -200,6 +206,17 @@ test_drop_reason() { ip netns exec server ip addr add 172.31.110.20/24 dev s1 ip netns exec server ip link set s1 up + # Check if drop reasons can be sent + ovs_add_flow "test_drop_reason" dropreason \ + 'in_port(1),eth(),eth_type(0x0806),arp()' 'drop(10)' 2>/dev/null + if [ $? == 1 ]; then + info "no support for drop reasons - skipping" + ovs_exit_sig + return $ksft_skip + fi + + ovs_del_flows "test_drop_reason" dropreason + # Allow ARP ovs_add_flow "test_drop_reason" dropreason \ 'in_port(1),eth(),eth_type(0x0806),arp()' '2' || return 1 diff --git a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py b/tools/testing/selftests/net/openvswitch/ovs-dpctl.py index e4c24d5edf20c..10b8f31548f84 100644 --- a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py +++ b/tools/testing/selftests/net/openvswitch/ovs-dpctl.py @@ -1906,6 +1906,32 @@ class OvsFlow(GenericNetlinkSocket): raise ne return reply + def del_flows(self, dpifindex): + """ + Send a del message to the kernel that will drop all flows. + + dpifindex should be a valid datapath obtained by calling + into the OvsDatapath lookup + """ + + flowmsg = OvsFlow.ovs_flow_msg() + flowmsg["cmd"] = OVS_FLOW_CMD_DEL + flowmsg["version"] = OVS_DATAPATH_VERSION + flowmsg["reserved"] = 0 + flowmsg["dpifindex"] = dpifindex + + try: + reply = self.nlm_request( + flowmsg, + msg_type=self.prid, + msg_flags=NLM_F_REQUEST | NLM_F_ACK, + ) + reply = reply[0] + except NetlinkError as ne: + print(flowmsg) + raise ne + return reply + def dump(self, dpifindex, flowspec=None): """ Returns a list of messages containing flows. @@ -2068,6 +2094,9 @@ def main(argv): addflcmd.add_argument("flow", help="Flow specification") addflcmd.add_argument("acts", help="Flow actions") + delfscmd = subparsers.add_parser("del-flows") + delfscmd.add_argument("flsbr", help="Datapath name") + args = parser.parse_args() if args.verbose > 0: @@ -2151,6 +2180,11 @@ def main(argv): flow = OvsFlow.ovs_flow_msg() flow.parse(args.flow, args.acts, rep["dpifindex"]) ovsflow.add_flow(rep["dpifindex"], flow) + elif hasattr(args, "flsbr"): + rep = ovsdp.info(args.flsbr, 0) + if rep is None: + print("DP '%s' not found." % args.flsbr) + ovsflow.del_flows(rep["dpifindex"]) return 0 From patchwork Wed Oct 11 19:49:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 151535 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp777082vqb; Wed, 11 Oct 2023 12:51:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfaIqfFm1P/1ssa7rcXMAhJpLB4zAprYRFWX5EJyh4BXN3xkSI37ZMNH58DPMp6EQyIOWJ X-Received: by 2002:a17:903:22ce:b0:1bb:83ec:832 with SMTP id y14-20020a17090322ce00b001bb83ec0832mr24881947plg.2.1697053904458; Wed, 11 Oct 2023 12:51:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697053904; cv=none; d=google.com; s=arc-20160816; b=qfMH+clyxw7fPNOlpm2a8DBU+q9YV6hwMVuO0hMx/Hr+MTRpVdIRcjL5f0dNPG6EZM bhpshyC5GuoiSWzK/4GbIm3ZnQH9oG0QZhYBkKkWRB9cjP9kWai64ZdsS1RPp8NxF8E5 sd6L1WZzV2gArdAuJt4OqM7CRLppYecpfFPVJg+bv6N5ZH43CT4+47G9eFDypDTIZ1Jx yYhHpfdvWrKXoyy2fD+m9Rf5zSf47qN9WLdXVsZvG3eabhK392CV9eu/MyB4fr7JIsel hS6uzcWaWdp9Qy4rI/Y/B2wSgKPKST/iwXXQ1usu46GrVbqE7al2H0yWNIClKA/ERjuX TX6A== 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:cc:to:from :dkim-signature; bh=KKHk9hX32NvUAjpB6c62OJCCjOws1Nm9GPb/DcDj7CQ=; fh=88nBSjTOrhHvyQS3Sgn//fCA45rCHSUCvyWdnfpu45A=; b=iXuqojkK+6zSjrYox9hMpFL/nGpGMFfNMIm1fFiV4qjwz7S7v5g3H9csLC7c9ZJatc PUM6tGiz46jD28FUhwIqTRbGbSLAicsoKAHCgiFAhaUxBRBvN16iTCSPtZi1rw+PjyL7 jv3hJB94JImUM4F07knmtjzuYphnVJVsTfHkk1Er3QKHjf7BrETsTseuHwb96V8phD6P b+RlL58m3BPUO6RMtN3Gz58f72xVQI67AoLvuRYB66buL2mP4E6xor5aJVN9yIlYIgP2 LLitNpm1D/Ctgy9D04mAejECrOE/7T26cTc4fjot81PAGOd1fnzOAsWY+yD0dPAk54qL xuuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=euZaLyA0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id w8-20020a170902d70800b001bbd83490efsi429742ply.138.2023.10.11.12.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 12:51:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=euZaLyA0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 247038022B4D; Wed, 11 Oct 2023 12:51:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346890AbjJKTvZ (ORCPT + 18 others); Wed, 11 Oct 2023 15:51:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235036AbjJKTvW (ORCPT ); Wed, 11 Oct 2023 15:51:22 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6F81CC for ; Wed, 11 Oct 2023 12:49:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697053790; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KKHk9hX32NvUAjpB6c62OJCCjOws1Nm9GPb/DcDj7CQ=; b=euZaLyA0dbx04Nlm9P8T5YliyslssAVzOPPhXxemHnN5Yo06TAbPwF4b7d7ONPwq8BV/wY 11RtFT3OENdcJZSY9rQ18wjs9EZ5oGAA7FFrdf1L5PGoMp4zFkVc6U11Nj035NSgXy8Hjm eYzxvASp/SFPWyeqKlugXVd8sx8/DsY= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-690-8gTFy7U0MGaSpUNUzKimcQ-1; Wed, 11 Oct 2023 15:49:45 -0400 X-MC-Unique: 8gTFy7U0MGaSpUNUzKimcQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E0BC41C0BB40; Wed, 11 Oct 2023 19:49:44 +0000 (UTC) Received: from RHTPC1VM0NT.lan (unknown [10.22.34.140]) by smtp.corp.redhat.com (Postfix) with ESMTP id 284E01C060B5; Wed, 11 Oct 2023 19:49:44 +0000 (UTC) From: Aaron Conole To: netdev@vger.kernel.org Cc: dev@openvswitch.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Pravin B Shelar , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Adrian Moreno , Eelco Chaudron , shuah@kernel.org Subject: [PATCH net v2 4/4] selftests: openvswitch: Fix the ct_tuple for v4 Date: Wed, 11 Oct 2023 15:49:39 -0400 Message-ID: <20231011194939.704565-5-aconole@redhat.com> In-Reply-To: <20231011194939.704565-1-aconole@redhat.com> References: <20231011194939.704565-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 11 Oct 2023 12:51:42 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779489995051560263 X-GMAIL-MSGID: 1779489995051560263 The ct_tuple v4 data structure decode / encode routines were using the v6 IP address decode and relying on default encode. This could cause exceptions during encode / decode depending on how a ct4 tuple would appear in a netlink message. Caught during code review. Fixes: e52b07aa1a54 ("selftests: openvswitch: add flow dump support") Signed-off-by: Aaron Conole --- v2: More detailed explanation for fix. tools/testing/selftests/net/openvswitch/ovs-dpctl.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py b/tools/testing/selftests/net/openvswitch/ovs-dpctl.py index 10b8f31548f84..b97e621face95 100644 --- a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py +++ b/tools/testing/selftests/net/openvswitch/ovs-dpctl.py @@ -1119,12 +1119,14 @@ class ovskey(nla): "src", lambda x: str(ipaddress.IPv4Address(x)), int, + convert_ipv4, ), ( "dst", "dst", - lambda x: str(ipaddress.IPv6Address(x)), + lambda x: str(ipaddress.IPv4Address(x)), int, + convert_ipv4, ), ("tp_src", "tp_src", "%d", int), ("tp_dst", "tp_dst", "%d", int),