selftests: net: bridge: add vlan mcast igmp/mld version tests

Add tests which change the new per-vlan IGMP/MLD versions and verify
that proper tagged general query packets are sent.

TEST: Vlan mcast_igmp_version global option default value           [ OK ]
TEST: Vlan mcast_mld_version global option default value            [ OK ]
TEST: Vlan 10 mcast_igmp_version option changed to 3                [ OK ]
TEST: Vlan 10 tagged IGMPv3 general query sent                      [ OK ]
TEST: Vlan 10 mcast_mld_version option changed to 2                 [ OK ]
TEST: Vlan 10 tagged MLDv2 general query sent                       [ OK ]

Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Nikolay Aleksandrov 2021-11-25 16:08:51 +02:00 committed by Jakub Kicinski
parent dee2cdc0e3
commit 2b75e9dd58

View File

@ -1,7 +1,7 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
ALL_TESTS="vlmc_control_test vlmc_querier_test"
ALL_TESTS="vlmc_control_test vlmc_querier_test vlmc_igmp_mld_version_test"
NUM_NETIFS=4
CHECK_TC="yes"
TEST_GROUP="239.10.10.10"
@ -241,6 +241,49 @@ vlmc_querier_test()
log_test "Vlan 10 tagged MLD general query sent"
}
vlmc_igmp_mld_version_test()
{
RET=0
local goutput=`bridge -j vlan global show`
echo -n $goutput |
jq -e ".[].vlans[] | select(.vlan == 10)" &>/dev/null
check_err $? "Could not find vlan 10's global options"
echo -n $goutput |
jq -e ".[].vlans[] | select(.vlan == 10 and .mcast_igmp_version == 2) " &>/dev/null
check_err $? "Wrong default mcast_igmp_version global vlan option value"
log_test "Vlan mcast_igmp_version global option default value"
RET=0
echo -n $goutput |
jq -e ".[].vlans[] | select(.vlan == 10 and .mcast_mld_version == 1) " &>/dev/null
check_err $? "Wrong default mcast_mld_version global vlan option value"
log_test "Vlan mcast_mld_version global option default value"
RET=0
bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_igmp_version 3
check_err $? "Could not set mcast_igmp_version in vlan 10"
log_test "Vlan 10 mcast_igmp_version option changed to 3"
RET=0
vlmc_check_query igmp 3 $swp1 1 1
check_err $? "No vlan tagged IGMPv3 general query packets sent"
log_test "Vlan 10 tagged IGMPv3 general query sent"
RET=0
bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_mld_version 2
check_err $? "Could not set mcast_mld_version in vlan 10"
log_test "Vlan 10 mcast_mld_version option changed to 2"
RET=0
vlmc_check_query mld 2 $swp1 1 1
check_err $? "No vlan tagged MLDv2 general query packets sent"
log_test "Vlan 10 tagged MLDv2 general query sent"
bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_igmp_version 2
bridge vlan global set vid 10 dev br0 mcast_snooping 1 mcast_mld_version 1
}
trap cleanup EXIT
setup_prepare