selftests: net: bridge: add test for igmpv3 exclude timeout

Test that when a group in exclude mode expires it changes mode to
include and the blocked entries are deleted.

Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Nikolay Aleksandrov 2020-10-27 20:59:33 +02:00 коммит произвёл Jakub Kicinski
Родитель 9eb58e0747
Коммит 18f66c96ea
1 изменённых файлов: 48 добавлений и 1 удалений

Просмотреть файл

@ -3,7 +3,8 @@
ALL_TESTS="v2reportleave_test v3include_test v3inc_allow_test v3inc_is_include_test \
v3inc_is_exclude_test v3inc_to_exclude_test v3exc_allow_test v3exc_is_include_test \
v3exc_is_exclude_test v3exc_to_exclude_test v3inc_block_test v3exc_block_test"
v3exc_is_exclude_test v3exc_to_exclude_test v3inc_block_test v3exc_block_test \
v3exc_timeout_test"
NUM_NETIFS=4
CHECK_TC="yes"
TEST_GROUP="239.10.10.10"
@ -574,6 +575,52 @@ v3exc_block_test()
v3cleanup $swp1 $TEST_GROUP
}
v3exc_timeout_test()
{
RET=0
local X=("192.0.2.20" "192.0.2.30")
# GMI should be 3 seconds
ip link set dev br0 type bridge mcast_query_interval 100 mcast_query_response_interval 100
v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP
ip link set dev br0 type bridge mcast_query_interval 500 mcast_query_response_interval 500
$MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_ALLOW2" -q
sleep 3
bridge -j -d -s mdb show dev br0 \
| jq -e ".[].mdb[] | \
select(.grp == \"$TEST_GROUP\" and \
.source_list != null and .filter_mode == \"include\")" &>/dev/null
check_err $? "Wrong *,G entry filter mode"
bridge -j -d -s mdb show dev br0 \
| jq -e ".[].mdb[] | \
select(.grp == \"$TEST_GROUP\" and \
.source_list != null and
.source_list[].address == \"192.0.2.1\")" &>/dev/null
check_fail $? "Wrong *,G entry source list, 192.0.2.1 entry still exists"
bridge -j -d -s mdb show dev br0 \
| jq -e ".[].mdb[] | \
select(.grp == \"$TEST_GROUP\" and \
.source_list != null and
.source_list[].address == \"192.0.2.2\")" &>/dev/null
check_fail $? "Wrong *,G entry source list, 192.0.2.2 entry still exists"
check_sg_entries "allow" "${X[@]}"
check_sg_state 0 "${X[@]}"
check_sg_fwding 1 "${X[@]}"
check_sg_fwding 0 192.0.2.100
log_test "IGMPv3 group $TEST_GROUP exclude timeout"
ip link set dev br0 type bridge mcast_query_interval 12500 \
mcast_query_response_interval 1000
v3cleanup $swp1 $TEST_GROUP
}
trap cleanup EXIT
setup_prepare