[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y0f/L9IT6dbwlZAg@shredder>
Date: Thu, 13 Oct 2022 15:06:07 +0300
From: Ido Schimmel <idosch@...dia.com>
To: "Hans J. Schultz" <netdev@...io-technology.com>
Cc: davem@...emloft.net, kuba@...nel.org, netdev@...r.kernel.org,
Florian Fainelli <f.fainelli@...il.com>,
Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
Kurt Kanzenbach <kurt@...utronix.de>,
Hauke Mehrtens <hauke@...ke-m.de>,
Woojung Huh <woojung.huh@...rochip.com>,
UNGLinuxDriver@...rochip.com, Sean Wang <sean.wang@...iatek.com>,
Landen Chao <Landen.Chao@...iatek.com>,
DENG Qingfang <dqfext@...il.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Claudiu Manoil <claudiu.manoil@....com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Jiri Pirko <jiri@...nulli.us>,
Ivan Vecera <ivecera@...hat.com>,
Roopa Prabhu <roopa@...dia.com>,
Nikolay Aleksandrov <razor@...ckwall.org>,
Shuah Khan <shuah@...nel.org>,
Russell King <linux@...linux.org.uk>,
Christian Marangi <ansuelsmth@...il.com>,
Daniel Borkmann <daniel@...earbox.net>,
Yuwei Wang <wangyuweihx@...il.com>,
Petr Machata <petrm@...dia.com>,
Florent Fourcot <florent.fourcot@...irst.fr>,
Hans Schultz <schultz.hans@...il.com>,
Joachim Wiberg <troglobit@...il.com>,
Amit Cohen <amcohen@...dia.com>, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
bridge@...ts.linux-foundation.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v7 net-next 9/9] selftests: forwarding: add test of
MAC-Auth Bypass to locked port tests
On Sun, Oct 09, 2022 at 07:40:52PM +0200, Hans J. Schultz wrote:
> +locked_port_mab()
> +{
> + RET=0
> + check_port_mab_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 mab on
> +
> + ping_do $h1 192.0.2.2
> + check_fail $? "MAB: Ping worked on mab enabled port without FDB entry"
> +
> + bridge fdb get `mac_get $h1` vlan 1 dev $swp1 | grep "dev $swp1 vlan 1" | grep -q "locked"
> + check_err $? "MAB: No locked FDB entry after ping on mab enabled 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 locked off mab off
> +
> + log_test "Locked port MAB"
> +}
> +
> +# Check that entries cannot roam from an unlocked port to a locked port.
> +locked_port_station_move()
> +{
> + local mac=a0:b0:c0:c0:b0:a0
> +
> + RET=0
> + check_locked_port_support || return 0
> +
> + bridge link set dev $swp1 locked on learning on
> +
> + $MZ $h1 -q -c 5 -d 100msec -t udp -a $mac -b rand
> + bridge fdb show dev $swp1 | grep -q $mac
> + check_fail $? "Locked port station move: FDB entry on first injection"
> +
> + $MZ $h2 -q -c 5 -d 100msec -t udp -a $mac -b rand
> + bridge fdb get $mac vlan 1 dev $swp2 | grep "dev $swp2 vlan 1" | grep -q "master br0"
> + check_err $? "Locked port station move: Entry not found on unlocked port"
> +
> + $MZ $h1 -q -c 5 -d 100msec -t udp -a $mac -b rand
> + bridge fdb get $mac vlan 1 dev $swp1 | grep "dev $swp1 vlan 1" | grep -q "master br0"
> + check_fail $? "Locked port station move: entry roamed to locked port"
> +
> + bridge fdb del $mac vlan 1 dev $swp2 master
> + bridge link set dev $swp1 locked off learning off
> +
> + log_test "Locked port station move"
> +}
> +
> +# Roaming to and from a MAB enabled port should work if blackhole flag is not set
> +locked_port_mab_station_move()
> +{
> + local mac=10:20:30:30:20:10
> +
> + RET=0
> + check_port_mab_support || return 0
> +
> + bridge link set dev $swp1 locked on mab on
> +
> + $MZ $h1 -q -c 5 -d 100 mesc -t udp -a $mac -b rand
> + if bridge fdb show dev $swp1 | grep "$mac vlan 1" | grep -q "blackhole"; then
> + echo "SKIP: Roaming not possible with blackhole flag, skipping test..."
> + bridge link set dev $swp1 locked off mab off
> + return $ksft_skip
> + fi
> +
> + bridge fdb show dev $swp1 | grep "$mac vlan 1" | grep -q "locked"
> + check_err $? "MAB station move: no locked entry on first injection"
> +
> + $MZ $h2 -q -c 5 -d 100msec -t udp -a $mac -b rand
> + bridge fdb get $mac vlan 1 dev $swp1 | grep "dev $swp1 vlan 1" | grep -q "locked"
> + check_fail $? "MAB station move: locked entry did not move"
> +
> + bridge fdb get $mac vlan 1 dev $swp2 | grep "dev $swp2 vlan 1" | grep -q "locked"
> + check_fail $? "MAB station move: roamed entry to unlocked port had locked flag on"
> +
> + bridge fdb get $mac vlan 1 dev $swp2 | grep "dev $swp2 vlan 1" | grep -q "master br0"
> + check_err $? "MAB station move: roamed entry not found"
> +
> + bridge fdb del $mac vlan 1 dev $swp2 master
> + bridge link set dev $swp1 locked off mab off
> +
> + log_test "Locked port MAB station move"
> +}
Looks OK to me. I made some change to make sure we are using "bridge fdb
get" in a consistent manner instead of relying on iproute2 dump output
too much. Please consider including them in the next version.
FYI, I ran your version and mine with veth pairs and both are OK.
diff --git a/tools/testing/selftests/net/forwarding/bridge_locked_port.sh b/tools/testing/selftests/net/forwarding/bridge_locked_port.sh
index fbe558f25e44..f0bc0bcbc246 100755
--- a/tools/testing/selftests/net/forwarding/bridge_locked_port.sh
+++ b/tools/testing/selftests/net/forwarding/bridge_locked_port.sh
@@ -187,7 +187,7 @@ locked_port_mab()
ping_do $h1 192.0.2.2
check_fail $? "MAB: Ping worked on mab enabled port without FDB entry"
- bridge fdb get `mac_get $h1` vlan 1 dev $swp1 | grep "dev $swp1 vlan 1" | grep -q "locked"
+ bridge fdb get `mac_get $h1` br br0 vlan 1 | grep "dev $swp1" | grep -q "locked"
check_err $? "MAB: No locked FDB entry after ping on mab enabled port"
bridge fdb replace `mac_get $h1` dev $swp1 master static
@@ -212,15 +212,15 @@ locked_port_station_move()
bridge link set dev $swp1 locked on learning on
$MZ $h1 -q -c 5 -d 100msec -t udp -a $mac -b rand
- bridge fdb show dev $swp1 | grep -q $mac
+ bridge fdb get $mac br br0 vlan 1 &> /dev/null
check_fail $? "Locked port station move: FDB entry on first injection"
$MZ $h2 -q -c 5 -d 100msec -t udp -a $mac -b rand
- bridge fdb get $mac vlan 1 dev $swp2 | grep "dev $swp2 vlan 1" | grep -q "master br0"
+ bridge fdb get $mac br br0 vlan 1 | grep -q "dev $swp2"
check_err $? "Locked port station move: Entry not found on unlocked port"
$MZ $h1 -q -c 5 -d 100msec -t udp -a $mac -b rand
- bridge fdb get $mac vlan 1 dev $swp1 | grep "dev $swp1 vlan 1" | grep -q "master br0"
+ bridge fdb get $mac br br0 vlan 1 | grep -q "dev $swp1"
check_fail $? "Locked port station move: entry roamed to locked port"
bridge fdb del $mac vlan 1 dev $swp2 master
@@ -229,7 +229,8 @@ locked_port_station_move()
log_test "Locked port station move"
}
-# Roaming to and from a MAB enabled port should work if blackhole flag is not set
+# Check that entries can roam from a locked port if blackhole FDB flag is not
+# set.
locked_port_mab_station_move()
{
local mac=10:20:30:30:20:10
@@ -246,19 +247,16 @@ locked_port_mab_station_move()
return $ksft_skip
fi
- bridge fdb show dev $swp1 | grep "$mac vlan 1" | grep -q "locked"
+ bridge fdb get $mac br br0 vlan 1 | grep "dev $swp1" | grep -q "locked"
check_err $? "MAB station move: no locked entry on first injection"
$MZ $h2 -q -c 5 -d 100msec -t udp -a $mac -b rand
- bridge fdb get $mac vlan 1 dev $swp1 | grep "dev $swp1 vlan 1" | grep -q "locked"
- check_fail $? "MAB station move: locked entry did not move"
+ bridge fdb get $mac br br0 vlan 1 | grep -q "dev $swp2"
+ check_err $? "MAB station move: roamed entry not found"
- bridge fdb get $mac vlan 1 dev $swp2 | grep "dev $swp2 vlan 1" | grep -q "locked"
+ bridge fdb get $mac br br0 vlan 1 | grep -q "locked"
check_fail $? "MAB station move: roamed entry to unlocked port had locked flag on"
- bridge fdb get $mac vlan 1 dev $swp2 | grep "dev $swp2 vlan 1" | grep -q "master br0"
- check_err $? "MAB station move: roamed entry not found"
-
bridge fdb del $mac vlan 1 dev $swp2 master
bridge link set dev $swp1 locked off mab off
Powered by blists - more mailing lists