selftests: mlxsw: Add a test for EAPOL trap

Test that packets with a destination MAC of 01:80:C2:00:00:03 trigger
the "eapol" packet trap.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Ido Schimmel 2022-11-08 11:47:19 +01:00 committed by Jakub Kicinski
parent da23a713d1
commit 25a26f0c20
1 changed files with 22 additions and 0 deletions

View File

@ -83,6 +83,7 @@ ALL_TESTS="
ptp_general_test
flow_action_sample_test
flow_action_trap_test
eapol_test
"
NUM_NETIFS=4
source $lib_dir/lib.sh
@ -677,6 +678,27 @@ flow_action_trap_test()
tc qdisc del dev $rp1 clsact
}
eapol_payload_get()
{
local source_mac=$1; shift
local p
p=$(:
)"01:80:C2:00:00:03:"$( : ETH daddr
)"$source_mac:"$( : ETH saddr
)"88:8E:"$( : ETH type
)
echo $p
}
eapol_test()
{
local h1mac=$(mac_get $h1)
devlink_trap_stats_test "EAPOL" "eapol" $MZ $h1 -c 1 \
$(eapol_payload_get $h1mac) -p 100 -q
}
trap cleanup EXIT
setup_prepare