selftests: net: bridge: add test for igmpv3 inc -> block report
authorNikolay Aleksandrov <nikolay@nvidia.com>
Tue, 27 Oct 2020 18:59:31 +0000 (20:59 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 30 Oct 2020 17:50:29 +0000 (10:50 -0700)
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: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/forwarding/bridge_igmp.sh

index 3cfc30b..3772c7a 100755 (executable)
@@ -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