Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3859016imw; Thu, 7 Jul 2022 08:39:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vdBL9DdwY+VJ0OBsqM+VZxkB9eIxezl9m/LOr4tVGnxi/G15TGKF9wXpVPNfIrA98jsrh/ X-Received: by 2002:a17:906:4ccc:b0:6fe:9155:47ae with SMTP id q12-20020a1709064ccc00b006fe915547aemr44219243ejt.246.1657208347522; Thu, 07 Jul 2022 08:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657208347; cv=none; d=google.com; s=arc-20160816; b=XvZqxepjqJfjYN4m1cDha+MJ6Ao5G0+PaPNRMMt7QxeF5Qxz8XeORno/H2QkLGu4di 3ATG/9pck8RULeyZSofTD7ohx9yzMQxvddwMoXxHkkvfDBv7U3Eq3d5n4kC8CU6A6jSO ZIKSw2gaBgLkQnF+4tKD2O+vwmgq1yc3Qv4gywywW9lVWnR6uFcgYfdyxYmtKjWNsntg fRenNmLXKfhgx4NID8hqBHzoo6UU1WVY4AA/2uAzqbpZ4vVis+B3qrEzdnww+b/l88Bm /s9HjwR9pU6/sbiJNGAf9F8hYvgUkr/haSgF6k2ECDoZ/f6iJ82kkOCZ+rhzKMICpybZ pIyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=8Rtn9CwIaf23b0M/f3b1WSkxtA4JOGSJFEKvWTcu1W8=; b=lDp32Rn+9T5+MtsZxbL4W7TBjuQvIwb4aRrRCIasmvfWSrgUtBQQY4oEMna2oIjteK iqWKor8ggu3eP+TKR8VD2zJ5zAVw1/i8Ok88jRP7sj8hm9I7wCumRzngSmw6HK88U9MV uqujY1FWgIfmO5XYRnySoDCbyM4Ki7Ndk21VECS2Q42fILIBfBrfKo4QcIwtc5byEiUy d008DSzNhwFVCmaA1q6ll/DW2+x5itGbSLPGzndmgiTVOAqCuz0PidjabPAQjzZKQeOG v9BtT/k5X7vEeevIBigrwP0/Ss2Vh9Hx3v/7QZGD2F1MhB1dRzR6DqVMv12EbKVb7/hh mOfw== ARC-Authentication-Results: i=1; mx.google.com; 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 i16-20020a170906091000b00722f396c33esi1217145ejd.415.2022.07.07.08.38.42; Thu, 07 Jul 2022 08:39:07 -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; 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 S236193AbiGGPa1 (ORCPT + 99 others); Thu, 7 Jul 2022 11:30:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236171AbiGGPaL (ORCPT ); Thu, 7 Jul 2022 11:30:11 -0400 Received: from mailout-taastrup.gigahost.dk (mailout-taastrup.gigahost.dk [46.183.139.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CCD62E9EF; Thu, 7 Jul 2022 08:29:59 -0700 (PDT) Received: from mailout.gigahost.dk (mailout.gigahost.dk [89.186.169.112]) by mailout-taastrup.gigahost.dk (Postfix) with ESMTP id AE4091886E7B; Thu, 7 Jul 2022 15:29:57 +0000 (UTC) Received: from smtp.gigahost.dk (smtp.gigahost.dk [89.186.169.109]) by mailout.gigahost.dk (Postfix) with ESMTP id A0CA025032B7; Thu, 7 Jul 2022 15:29:57 +0000 (UTC) Received: by smtp.gigahost.dk (Postfix, from userid 1000) id 842CFA1E00B8; Thu, 7 Jul 2022 15:29:57 +0000 (UTC) X-Screener-Id: 413d8c6ce5bf6eab4824d0abaab02863e8e3f662 Received: from wse-c0127.vestervang (unknown [208.127.141.28]) by smtp.gigahost.dk (Postfix) with ESMTPSA id D38979120FED; Thu, 7 Jul 2022 15:29:55 +0000 (UTC) From: Hans Schultz To: davem@davemloft.net, kuba@kernel.org Cc: 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: [PATCH v4 net-next 6/6] selftests: forwarding: add test of MAC-Auth Bypass to locked port tests Date: Thu, 7 Jul 2022 17:29:30 +0200 Message-Id: <20220707152930.1789437-7-netdev@kapio-technology.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220707152930.1789437-1-netdev@kapio-technology.com> References: <20220707152930.1789437-1-netdev@kapio-technology.com> MIME-Version: 1.0 Organization: Westermo Network Technologies AB Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,FROM_FMBLA_NEWDOM, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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 | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_locked_port.sh b/tools/testing/selftests/net/forwarding/bridge_locked_port.sh index 5b02b6b60ce7..1ee12d7b5c8b 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 @@ -166,6 +166,34 @@ locked_port_ipv6() log_test "Locked port ipv6" } +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 + + 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