Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: forwarding: tc_flower: Relax success criterion

The test checks that filters that match on source or destination MAC
were only hit once. A host can send more than one packet with a given
source or destination MAC, resulting in failures.

Fix by relaxing the success criterion and instead check that the filters
were not hit zero times. Using tc_check_at_least_x_packets() is also an
option, but it is not available in older kernels.

Fixes: 07e5c75184a1 ("selftests: forwarding: Introduce tc flower matching tests")
Reported-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
Closes: https://lore.kernel.org/netdev/adc5e40d-d040-a65e-eb26-edf47dac5b02@alu.unizg.hr/
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Tested-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://lore.kernel.org/r/20230808141503.4060661-13-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Ido Schimmel and committed by
Jakub Kicinski
9ee37e53 5e867061

+4 -4
+4 -4
tools/testing/selftests/net/forwarding/tc_flower.sh
··· 52 52 tc_check_packets "dev $h2 ingress" 101 1 53 53 check_fail $? "Matched on a wrong filter" 54 54 55 - tc_check_packets "dev $h2 ingress" 102 1 56 - check_err $? "Did not match on correct filter" 55 + tc_check_packets "dev $h2 ingress" 102 0 56 + check_fail $? "Did not match on correct filter" 57 57 58 58 tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower 59 59 tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower ··· 78 78 tc_check_packets "dev $h2 ingress" 101 1 79 79 check_fail $? "Matched on a wrong filter" 80 80 81 - tc_check_packets "dev $h2 ingress" 102 1 82 - check_err $? "Did not match on correct filter" 81 + tc_check_packets "dev $h2 ingress" 102 0 82 + check_fail $? "Did not match on correct filter" 83 83 84 84 tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower 85 85 tc filter del dev $h2 ingress protocol ip pref 2 handle 102 flower