Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp655832ioo; Thu, 26 May 2022 11:27:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWCD7Mavb+GDMBLBhz2P+E/86jxesdKdoNNWPXLWB88xtixdh6WubnFT1jSU5tFFDFNxok X-Received: by 2002:a17:90b:4b4b:b0:1dc:8724:3f75 with SMTP id mi11-20020a17090b4b4b00b001dc87243f75mr3929914pjb.178.1653589656165; Thu, 26 May 2022 11:27:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653589656; cv=none; d=google.com; s=arc-20160816; b=HpoyTGcVwW1kLQm8nsCjrlak+QHLBdJWxQBPpE0F+2l+erK9ChvwWSeT8sooWC4q9+ OP//cjvFUOTpFfa028L7TXYX+Ei/VSp7YnqMAeVLalvRMO2zRiiwjxig/3G3jPYbiDW+ 5Z88deTUYT+cp0VSb+abJQ8pHLrkHOq81YPqvStPbsy/S+twnRRCMWUbVNW01JTi5SuR cprpE3GYZ2RREZs1sacDv/PUEbnPN9a2Q7xs/1HUdwdE3rKthCLJLnt3PSdtPOi8sCrY AsapvghPiazVzR2QnUNS/Hxv0qX9LDblEtvgpRMrwg/ydwYUPE6evwn1FfERy1rHSfbR Jf1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature; bh=StrlpIYajUUCDicQmIv6vQpHKNJZsuJXBuDoYzce0XU=; b=KupULcr1T5BDEm6iy2BEHhy1g51cFo8+FaiEr5FriEMh6IbC0pFlnbHL258hPDD6Aj 9BVEpZm9qfYCynJBYEqI60i3ZQKFGX7/JXfqpL3IfBAvGfkB6AUQKO1CZ9eeUXBXOYa0 xeAhlao3GLe0orC2ZN1rP5EMP4uilcF0RHIZt++xsUUrh/Fn9I/DNXF0mVFCUrxwVgtp DmBAtXSrVegerU1lyB0++KtTIlxfLnUUNEVi2hhjpJwTjhP7sZhr/m5rfcxLbSg1yQdF m5DCH01DIKeNI8nqmtSw9V77G8tnsWRhbdHX8zMJt9Vls+3oG8yS7FVebLAs/806oZsl vgtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=mnurwjAc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g5-20020a056a001a0500b0050d5ecea3c2si2950912pfv.56.2022.05.26.11.27.21; Thu, 26 May 2022 11:27:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=mnurwjAc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345373AbiEZO14 (ORCPT + 99 others); Thu, 26 May 2022 10:27:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231149AbiEZO1z (ORCPT ); Thu, 26 May 2022 10:27:55 -0400 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AAB2C5E76; Thu, 26 May 2022 07:27:52 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id BBC6A3200258; Thu, 26 May 2022 10:27:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 26 May 2022 10:27:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1653575269; x=1653661669; bh=StrlpIYajUUCDicQmIv6vQpHKNJZ suJXBuDoYzce0XU=; b=mnurwjAcVnldsgZxi5JsRrqsPfBzzO+n+pBlmvIxIEGS kCvlFvVteXMu2KLrIDvuFFxLoIOYwZEkZQag4qZizXF1Z1w7TqZzqZnmjhkto+Cj NAQRgqf6yPtmOuTNvU8WpivNyc0eKwfhfWyvXlRnY5VyWzfAxN/0rpB7sAqH0DD/ C5sibS8yfugBPbOuVPNnwgH/hoSUawgsItougUcqFjjubuiGMTyj+DGgLNuF00Pp TjwtixybLl7hvTYO5a6tIOTnWwa1qaO8H71ToAicqxlrOAqa2TKMTSjNZjRlV/5d rvzxH+MHDNkGPcjUH2Ky9FZuUjs9Zh9KqTI4RvdOQw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrjeejgdejhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefkughoucfu tghhihhmmhgvlhcuoehiughoshgthhesihguohhstghhrdhorhhgqeenucggtffrrghtth gvrhhnpedvudefveekheeugeeftddvveefgfduieefudeifefgleekheegleegjeejgeeg hfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehiug hoshgthhesihguohhstghhrdhorhhg X-ME-Proxy: Feedback-ID: i494840e7:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 May 2022 10:27:47 -0400 (EDT) Date: Thu, 26 May 2022 17:27:44 +0300 From: Ido Schimmel To: Hans Schultz Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, Hans Schultz , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Eric Dumazet , Paolo Abeni , Jiri Pirko , Ivan Vecera , Roopa Prabhu , Nikolay Aleksandrov , Shuah Khan , Daniel Borkmann , Ido Schimmel , linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH V3 net-next 4/4] selftests: forwarding: add test of MAC-Auth Bypass to locked port tests Message-ID: References: <20220524152144.40527-1-schultz.hans+netdev@gmail.com> <20220524152144.40527-5-schultz.hans+netdev@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220524152144.40527-5-schultz.hans+netdev@gmail.com> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Tue, May 24, 2022 at 05:21:44PM +0200, Hans Schultz wrote: > Verify that the MAC-Auth mechanism works by adding a FDB entry with the > locked flag set. denying access until the FDB entry is replaced with a > FDB entry without the locked flag set. > > Signed-off-by: Hans Schultz > --- > .../net/forwarding/bridge_locked_port.sh | 42 ++++++++++++++++--- > 1 file changed, 36 insertions(+), 6 deletions(-) > > diff --git a/tools/testing/selftests/net/forwarding/bridge_locked_port.sh b/tools/testing/selftests/net/forwarding/bridge_locked_port.sh > index 5b02b6b60ce7..50b9048d044a 100755 > --- a/tools/testing/selftests/net/forwarding/bridge_locked_port.sh > +++ b/tools/testing/selftests/net/forwarding/bridge_locked_port.sh > @@ -1,7 +1,7 @@ > #!/bin/bash > # SPDX-License-Identifier: GPL-2.0 > > -ALL_TESTS="locked_port_ipv4 locked_port_ipv6 locked_port_vlan" > +ALL_TESTS="locked_port_ipv4 locked_port_ipv6 locked_port_vlan locked_port_mab" > NUM_NETIFS=4 > CHECK_TC="no" > source lib.sh > @@ -94,13 +94,13 @@ locked_port_ipv4() > ping_do $h1 192.0.2.2 > check_fail $? "Ping worked after locking port, but before adding FDB entry" > > - bridge fdb add `mac_get $h1` dev $swp1 master static > + bridge fdb replace `mac_get $h1` dev $swp1 master static > > ping_do $h1 192.0.2.2 > check_err $? "Ping did not work after locking port and adding FDB entry" > > bridge link set dev $swp1 locked off > - bridge fdb del `mac_get $h1` dev $swp1 master static > + bridge fdb del `mac_get $h1` dev $swp1 master > > ping_do $h1 192.0.2.2 > check_err $? "Ping did not work after unlocking port and removing FDB entry." > @@ -124,13 +124,13 @@ locked_port_vlan() > ping_do $h1.100 198.51.100.2 > check_fail $? "Ping through vlan worked after locking port, but before adding FDB entry" > > - bridge fdb add `mac_get $h1` dev $swp1 vlan 100 master static > + bridge fdb replace `mac_get $h1` dev $swp1 master static > > ping_do $h1.100 198.51.100.2 > check_err $? "Ping through vlan did not work after locking port and adding FDB entry" > > bridge link set dev $swp1 locked off > - bridge fdb del `mac_get $h1` dev $swp1 vlan 100 master static > + bridge fdb del `mac_get $h1` dev $swp1 vlan 100 master > > ping_do $h1.100 198.51.100.2 > check_err $? "Ping through vlan did not work after unlocking port and removing FDB entry" > @@ -153,7 +153,8 @@ locked_port_ipv6() > ping6_do $h1 2001:db8:1::2 > check_fail $? "Ping6 worked after locking port, but before adding FDB entry" > > - bridge fdb add `mac_get $h1` dev $swp1 master static > + bridge fdb replace `mac_get $h1` dev $swp1 master static > + > ping6_do $h1 2001:db8:1::2 > check_err $? "Ping6 did not work after locking port and adding FDB entry" > > @@ -166,6 +167,35 @@ locked_port_ipv6() > log_test "Locked port ipv6" > } Why did you change s/add/replace/? Also, from the subject and commit message I understand the patch is about adding a new test, not changing existing ones. > > +locked_port_mab() > +{ > + RET=0 > + check_locked_port_support || return 0 > + > + ping_do $h1 192.0.2.2 > + check_err $? "MAB: Ping did not work before locking port" > + > + bridge link set dev $swp1 locked on > + bridge link set dev $swp1 learning on > + > + bridge fdb del `mac_get $h1` dev $swp1 master Why the delete is needed? Aren't you getting errors on trying to delete a non-existing entry? In previous test cases learning is disabled and it seems the FDB entry is cleaned up. > + > + ping_do $h1 192.0.2.2 > + check_fail $? "MAB: Ping worked on locked port without FDB entry" > + > + bridge fdb show | grep `mac_get $h1` | grep -q "locked" > + check_err $? "MAB: No locked fdb entry after ping on locked port" > + > + bridge fdb replace `mac_get $h1` dev $swp1 master static > + > + ping_do $h1 192.0.2.2 > + check_err $? "MAB: Ping did not work with fdb entry without locked flag" > + > + bridge fdb del `mac_get $h1` dev $swp1 master bridge link set dev $swp1 learning off > + bridge link set dev $swp1 locked off > + > + log_test "Locked port MAB" > +} > trap cleanup EXIT > > setup_prepare > -- > 2.30.2 >