Commit 80899f1b authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by Jakub Kicinski
Browse files

selftests: net: bridge: add test for igmpv3 inc -> block report



The test checks for the following case:
    state          report        result                  action
  INCLUDE (A)    BLOCK (B)     INCLUDE (A)              Send Q(G,A*B)

Signed-off-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 65bfc146
Loading
Loading
Loading
Loading
+32 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@

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"
	   v3exc_is_exclude_test v3exc_to_exclude_test v3inc_block_test"
NUM_NETIFS=4
CHECK_TC="yes"
TEST_GROUP="239.10.10.10"
@@ -28,6 +28,8 @@ MZPKT_IS_EXC="22:00:da:b6:00:00:00:01:02:00:00:04:ef:0a:0a:0a:c0:00:02:01:c0:00:
MZPKT_IS_EXC2="22:00:5e:b4:00:00:00:01:02:00:00:02:ef:0a:0a:0a:c0:00:02:14:c0:00:02:1e"
# IGMPv3 to_ex report: grp 239.10.10.10 to_exclude 192.0.2.1,192.0.2.20,192.0.2.30
MZPKT_TO_EXC="22:00:9a:b1:00:00:00:01:04:00:00:03:ef:0a:0a:0a:c0:00:02:01:c0:00:02:14:c0:00:02:1e"
# IGMPv3 block report: grp 239.10.10.10 block 192.0.2.1,192.0.2.20,192.0.2.30
MZPKT_BLOCK="22:00:98:b1:00:00:00:01:06:00:00:03:ef:0a:0a:0a:c0:00:02:01:c0:00:02:14:c0:00:02:1e"

source lib.sh

@@ -515,6 +517,35 @@ v3exc_to_exclude_test()
	v3cleanup $swp1 $TEST_GROUP
}

v3inc_block_test()
{
	RET=0
	local X=("192.0.2.2" "192.0.2.3")

	v3include_prepare $h1 $ALL_MAC $ALL_GROUP

	$MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_BLOCK" -q
	# make sure the lowered timers have expired (by default 2 seconds)
	sleep 3
	check_sg_entries "block" "${X[@]}"

	check_sg_state 0 "${X[@]}"

	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"

	check_sg_fwding 1 "${X[@]}"
	check_sg_fwding 0 "192.0.2.100"

	log_test "IGMPv3 report $TEST_GROUP include -> block"

	v3cleanup $swp1 $TEST_GROUP
}

trap cleanup EXIT

setup_prepare