All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/3] Fix bridge_vlan_aware.sh and bridge_vlan_unaware.sh with IFF_UNICAST_FLT
@ 2022-07-03  7:36 Vladimir Oltean
  2022-07-03  7:36 ` [PATCH net 1/3] selftests: forwarding: fix flood_unicast_test when h2 supports IFF_UNICAST_FLT Vladimir Oltean
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Vladimir Oltean @ 2022-07-03  7:36 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Shuah Khan, Petr Machata, Ido Schimmel, linux-kselftest

Make sure that h1 and h2 don't drop packets with a random MAC DA, which
otherwise confuses these selftests. Also, fix an incorrect error message
found during those failures.

Vladimir Oltean (3):
  selftests: forwarding: fix flood_unicast_test when h2 supports
    IFF_UNICAST_FLT
  selftests: forwarding: fix learning_test when h1 supports
    IFF_UNICAST_FLT
  selftests: forwarding: fix error message in learning_test

 tools/testing/selftests/net/forwarding/lib.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net 1/3] selftests: forwarding: fix flood_unicast_test when h2 supports IFF_UNICAST_FLT
  2022-07-03  7:36 [PATCH net 0/3] Fix bridge_vlan_aware.sh and bridge_vlan_unaware.sh with IFF_UNICAST_FLT Vladimir Oltean
@ 2022-07-03  7:36 ` Vladimir Oltean
  2022-07-03 10:02   ` Ido Schimmel
  2022-07-03  7:36 ` [PATCH net 2/3] selftests: forwarding: fix learning_test when h1 " Vladimir Oltean
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Vladimir Oltean @ 2022-07-03  7:36 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Shuah Khan, Petr Machata, Ido Schimmel, linux-kselftest

As mentioned in the blamed commit, flood_unicast_test() works by
checking the match count on a tc filter placed on the receiving
interface.

But the second host interface (host2_if) has no interest in receiving a
packet with MAC DA de:ad:be:ef:13:37, so its RX filter drops it even
before the ingress tc filter gets to be executed. So we will incorrectly
get the message "Packet was not flooded when should", when in fact, the
packet was flooded as expected but dropped due to an unrelated reason,
at some other layer on the receiving side.

Force h2 to accept this packet by temporarily placing it in promiscuous
mode. Alternatively we could either deliver to its MAC address or use
tcpdump_start, but this has the fewest complications.

This fixes the "flooding" test from bridge_vlan_aware.sh and
bridge_vlan_unaware.sh, which calls flood_test from the lib.

Fixes: 236dd50bf67a ("selftests: forwarding: Add a test for flooded traffic")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 tools/testing/selftests/net/forwarding/lib.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 37ae49d47853..4e69497f021f 100755
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -1306,6 +1306,7 @@ flood_test_do()
 
 	# Add an ACL on `host2_if` which will tell us whether the packet
 	# was flooded to it or not.
+	ip link set $host2_if promisc on
 	tc qdisc add dev $host2_if ingress
 	tc filter add dev $host2_if ingress protocol ip pref 1 handle 101 \
 		flower dst_mac $mac action drop
@@ -1323,6 +1324,7 @@ flood_test_do()
 
 	tc filter del dev $host2_if ingress protocol ip pref 1 handle 101 flower
 	tc qdisc del dev $host2_if ingress
+	ip link set $host2_if promisc off
 
 	return $err
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net 2/3] selftests: forwarding: fix learning_test when h1 supports IFF_UNICAST_FLT
  2022-07-03  7:36 [PATCH net 0/3] Fix bridge_vlan_aware.sh and bridge_vlan_unaware.sh with IFF_UNICAST_FLT Vladimir Oltean
  2022-07-03  7:36 ` [PATCH net 1/3] selftests: forwarding: fix flood_unicast_test when h2 supports IFF_UNICAST_FLT Vladimir Oltean
@ 2022-07-03  7:36 ` Vladimir Oltean
  2022-07-03 10:03   ` Ido Schimmel
  2022-07-03  7:36 ` [PATCH net 3/3] selftests: forwarding: fix error message in learning_test Vladimir Oltean
  2022-07-05 10:00 ` [PATCH net 0/3] Fix bridge_vlan_aware.sh and bridge_vlan_unaware.sh with IFF_UNICAST_FLT patchwork-bot+netdevbpf
  3 siblings, 1 reply; 8+ messages in thread
From: Vladimir Oltean @ 2022-07-03  7:36 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Shuah Khan, Petr Machata, Ido Schimmel, linux-kselftest

The first host interface has by default no interest in receiving packets
MAC DA de:ad:be:ef:13:37, so it might drop them before they hit the tc
filter and this might confuse the selftest.

Enable promiscuous mode such that the filter properly counts received
packets.

Fixes: d4deb01467ec ("selftests: forwarding: Add a test for FDB learning")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 tools/testing/selftests/net/forwarding/lib.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 4e69497f021f..26ba8b5d264a 100755
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -1240,6 +1240,7 @@ learning_test()
 	# FDB entry was installed.
 	bridge link set dev $br_port1 flood off
 
+	ip link set $host1_if promisc on
 	tc qdisc add dev $host1_if ingress
 	tc filter add dev $host1_if ingress protocol ip pref 1 handle 101 \
 		flower dst_mac $mac action drop
@@ -1289,6 +1290,7 @@ learning_test()
 
 	tc filter del dev $host1_if ingress protocol ip pref 1 handle 101 flower
 	tc qdisc del dev $host1_if ingress
+	ip link set $host1_if promisc off
 
 	bridge link set dev $br_port1 flood on
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net 3/3] selftests: forwarding: fix error message in learning_test
  2022-07-03  7:36 [PATCH net 0/3] Fix bridge_vlan_aware.sh and bridge_vlan_unaware.sh with IFF_UNICAST_FLT Vladimir Oltean
  2022-07-03  7:36 ` [PATCH net 1/3] selftests: forwarding: fix flood_unicast_test when h2 supports IFF_UNICAST_FLT Vladimir Oltean
  2022-07-03  7:36 ` [PATCH net 2/3] selftests: forwarding: fix learning_test when h1 " Vladimir Oltean
@ 2022-07-03  7:36 ` Vladimir Oltean
  2022-07-03 10:03   ` Ido Schimmel
  2022-07-05 10:00 ` [PATCH net 0/3] Fix bridge_vlan_aware.sh and bridge_vlan_unaware.sh with IFF_UNICAST_FLT patchwork-bot+netdevbpf
  3 siblings, 1 reply; 8+ messages in thread
From: Vladimir Oltean @ 2022-07-03  7:36 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Shuah Khan, Petr Machata, Ido Schimmel, linux-kselftest

When packets are not received, they aren't received on $host1_if, so the
message talking about the second host not receiving them is incorrect.
Fix it.

Fixes: d4deb01467ec ("selftests: forwarding: Add a test for FDB learning")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 tools/testing/selftests/net/forwarding/lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 26ba8b5d264a..3ffb9d6c0950 100755
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -1251,7 +1251,7 @@ learning_test()
 	tc -j -s filter show dev $host1_if ingress \
 		| jq -e ".[] | select(.options.handle == 101) \
 		| select(.options.actions[0].stats.packets == 1)" &> /dev/null
-	check_fail $? "Packet reached second host when should not"
+	check_fail $? "Packet reached first host when should not"
 
 	$MZ $host1_if -c 1 -p 64 -a $mac -t ip -q
 	sleep 1
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH net 1/3] selftests: forwarding: fix flood_unicast_test when h2 supports IFF_UNICAST_FLT
  2022-07-03  7:36 ` [PATCH net 1/3] selftests: forwarding: fix flood_unicast_test when h2 supports IFF_UNICAST_FLT Vladimir Oltean
@ 2022-07-03 10:02   ` Ido Schimmel
  0 siblings, 0 replies; 8+ messages in thread
From: Ido Schimmel @ 2022-07-03 10:02 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Shuah Khan, Petr Machata, linux-kselftest

On Sun, Jul 03, 2022 at 10:36:24AM +0300, Vladimir Oltean wrote:
> As mentioned in the blamed commit, flood_unicast_test() works by
> checking the match count on a tc filter placed on the receiving
> interface.
> 
> But the second host interface (host2_if) has no interest in receiving a
> packet with MAC DA de:ad:be:ef:13:37, so its RX filter drops it even
> before the ingress tc filter gets to be executed. So we will incorrectly
> get the message "Packet was not flooded when should", when in fact, the
> packet was flooded as expected but dropped due to an unrelated reason,
> at some other layer on the receiving side.
> 
> Force h2 to accept this packet by temporarily placing it in promiscuous
> mode. Alternatively we could either deliver to its MAC address or use
> tcpdump_start, but this has the fewest complications.
> 
> This fixes the "flooding" test from bridge_vlan_aware.sh and
> bridge_vlan_unaware.sh, which calls flood_test from the lib.
> 
> Fixes: 236dd50bf67a ("selftests: forwarding: Add a test for flooded traffic")
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net 2/3] selftests: forwarding: fix learning_test when h1 supports IFF_UNICAST_FLT
  2022-07-03  7:36 ` [PATCH net 2/3] selftests: forwarding: fix learning_test when h1 " Vladimir Oltean
@ 2022-07-03 10:03   ` Ido Schimmel
  0 siblings, 0 replies; 8+ messages in thread
From: Ido Schimmel @ 2022-07-03 10:03 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Shuah Khan, Petr Machata, linux-kselftest

On Sun, Jul 03, 2022 at 10:36:25AM +0300, Vladimir Oltean wrote:
> The first host interface has by default no interest in receiving packets
> MAC DA de:ad:be:ef:13:37, so it might drop them before they hit the tc
> filter and this might confuse the selftest.
> 
> Enable promiscuous mode such that the filter properly counts received
> packets.
> 
> Fixes: d4deb01467ec ("selftests: forwarding: Add a test for FDB learning")
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net 3/3] selftests: forwarding: fix error message in learning_test
  2022-07-03  7:36 ` [PATCH net 3/3] selftests: forwarding: fix error message in learning_test Vladimir Oltean
@ 2022-07-03 10:03   ` Ido Schimmel
  0 siblings, 0 replies; 8+ messages in thread
From: Ido Schimmel @ 2022-07-03 10:03 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Shuah Khan, Petr Machata, linux-kselftest

On Sun, Jul 03, 2022 at 10:36:26AM +0300, Vladimir Oltean wrote:
> When packets are not received, they aren't received on $host1_if, so the
> message talking about the second host not receiving them is incorrect.
> Fix it.
> 
> Fixes: d4deb01467ec ("selftests: forwarding: Add a test for FDB learning")
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net 0/3] Fix bridge_vlan_aware.sh and bridge_vlan_unaware.sh with IFF_UNICAST_FLT
  2022-07-03  7:36 [PATCH net 0/3] Fix bridge_vlan_aware.sh and bridge_vlan_unaware.sh with IFF_UNICAST_FLT Vladimir Oltean
                   ` (2 preceding siblings ...)
  2022-07-03  7:36 ` [PATCH net 3/3] selftests: forwarding: fix error message in learning_test Vladimir Oltean
@ 2022-07-05 10:00 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-07-05 10:00 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev, davem, edumazet, kuba, pabeni, shuah, petrm, idosch,
	linux-kselftest

Hello:

This series was applied to netdev/net.git (master)
by Paolo Abeni <pabeni@redhat.com>:

On Sun,  3 Jul 2022 10:36:23 +0300 you wrote:
> Make sure that h1 and h2 don't drop packets with a random MAC DA, which
> otherwise confuses these selftests. Also, fix an incorrect error message
> found during those failures.
> 
> Vladimir Oltean (3):
>   selftests: forwarding: fix flood_unicast_test when h2 supports
>     IFF_UNICAST_FLT
>   selftests: forwarding: fix learning_test when h1 supports
>     IFF_UNICAST_FLT
>   selftests: forwarding: fix error message in learning_test
> 
> [...]

Here is the summary with links:
  - [net,1/3] selftests: forwarding: fix flood_unicast_test when h2 supports IFF_UNICAST_FLT
    https://git.kernel.org/netdev/net/c/b8e629b05f5d
  - [net,2/3] selftests: forwarding: fix learning_test when h1 supports IFF_UNICAST_FLT
    https://git.kernel.org/netdev/net/c/1a635d3e1c80
  - [net,3/3] selftests: forwarding: fix error message in learning_test
    https://git.kernel.org/netdev/net/c/83844aacab20

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-07-05 10:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-03  7:36 [PATCH net 0/3] Fix bridge_vlan_aware.sh and bridge_vlan_unaware.sh with IFF_UNICAST_FLT Vladimir Oltean
2022-07-03  7:36 ` [PATCH net 1/3] selftests: forwarding: fix flood_unicast_test when h2 supports IFF_UNICAST_FLT Vladimir Oltean
2022-07-03 10:02   ` Ido Schimmel
2022-07-03  7:36 ` [PATCH net 2/3] selftests: forwarding: fix learning_test when h1 " Vladimir Oltean
2022-07-03 10:03   ` Ido Schimmel
2022-07-03  7:36 ` [PATCH net 3/3] selftests: forwarding: fix error message in learning_test Vladimir Oltean
2022-07-03 10:03   ` Ido Schimmel
2022-07-05 10:00 ` [PATCH net 0/3] Fix bridge_vlan_aware.sh and bridge_vlan_unaware.sh with IFF_UNICAST_FLT patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.