summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@nvidia.com>2020-10-27 21:59:27 +0300
committerJakub Kicinski <kuba@kernel.org>2020-10-30 20:50:28 +0300
commiteecd8cfdff1b9e437ca9162d058de0cee68c1fe6 (patch)
treef19eea6e8da4d0bd18a0341cc09daba6afbba82c
parent735af7bec0f128e67192512854db459f61b1c278 (diff)
downloadlinux-eecd8cfdff1b9e437ca9162d058de0cee68c1fe6.tar.xz
selftests: net: bridge: add test for igmpv3 exc -> allow report
The test checks for the following case: state report result action EXCLUDE (X,Y) ALLOW (A) EXCLUDE (X+A,Y-A) (A)=GMI Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rwxr-xr-xtools/testing/selftests/net/forwarding/bridge_igmp.sh83
1 files changed, 59 insertions, 24 deletions
diff --git a/tools/testing/selftests/net/forwarding/bridge_igmp.sh b/tools/testing/selftests/net/forwarding/bridge_igmp.sh
index 36f10a3168cc..d786e75abe2c 100755
--- a/tools/testing/selftests/net/forwarding/bridge_igmp.sh
+++ b/tools/testing/selftests/net/forwarding/bridge_igmp.sh
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-2.0
ALL_TESTS="v2reportleave_test v3include_test v3inc_allow_test v3inc_is_include_test \
- v3inc_is_exclude_test v3inc_to_exclude_test"
+ v3inc_is_exclude_test v3inc_to_exclude_test v3exc_allow_test"
NUM_NETIFS=4
CHECK_TC="yes"
TEST_GROUP="239.10.10.10"
@@ -17,6 +17,8 @@ MZPKT_IS_INC="22:00:9d:de:00:00:00:01:01:00:00:03:ef:0a:0a:0a:c0:00:02:01:c0:00:
MZPKT_IS_INC2="22:00:9d:c3:00:00:00:01:01:00:00:03:ef:0a:0a:0a:c0:00:02:0a:c0:00:02:0b:c0:00:02:0c"
# IGMPv3 allow report: grp 239.10.10.10 allow 192.0.2.10,192.0.2.11,192.0.2.12
MZPKT_ALLOW="22:00:99:c3:00:00:00:01:05:00:00:03:ef:0a:0a:0a:c0:00:02:0a:c0:00:02:0b:c0:00:02:0c"
+# IGMPv3 allow report: grp 239.10.10.10 allow 192.0.2.20,192.0.2.30
+MZPKT_ALLOW2="22:00:5b:b4:00:00:00:01:05:00:00:02:ef:0a:0a:0a:c0:00:02:14:c0:00:02:1e"
# IGMPv3 is_ex report: grp 239.10.10.10 is_exclude 192.0.2.1,192.0.2.2,192.0.2.20,192.0.2.21
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:02:02:c0:00:02:14:c0:00:02:15"
# IGMPv3 to_ex report: grp 239.10.10.10 to_exclude 192.0.2.1,192.0.2.20,192.0.2.30
@@ -250,6 +252,38 @@ v3include_prepare()
check_sg_entries "is_include" "${X[@]}"
}
+v3exclude_prepare()
+{
+ local host1_if=$1
+ local mac=$2
+ local group=$3
+ local pkt=$4
+ local X=("192.0.2.1" "192.0.2.2")
+ local Y=("192.0.2.20" "192.0.2.21")
+
+ v3include_prepare $host1_if $mac $group
+
+ $MZ $host1_if -c 1 -b $mac -B $group -t ip "proto=2,p=$MZPKT_IS_EXC" -q
+ sleep 1
+ bridge -j -d -s mdb show dev br0 \
+ | jq -e ".[].mdb[] | \
+ select(.grp == \"$TEST_GROUP\" and \
+ .source_list != null and .filter_mode == \"exclude\")" &>/dev/null
+ check_err $? "Wrong *,G entry filter mode"
+
+ check_sg_entries "is_exclude" "${X[@]}" "${Y[@]}"
+
+ check_sg_state 0 "${X[@]}"
+ check_sg_state 1 "${Y[@]}"
+
+ 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.3\")" &>/dev/null
+ check_fail $? "Wrong *,G entry source list, 192.0.2.3 entry still exists"
+}
+
v3cleanup()
{
local port=$1
@@ -321,30 +355,8 @@ v3inc_is_include_test()
v3inc_is_exclude_test()
{
RET=0
- local X=("192.0.2.1" "192.0.2.2")
- local Y=("192.0.2.20" "192.0.2.21")
-
- v3include_prepare $h1 $ALL_MAC $ALL_GROUP
-
- $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_IS_EXC" -q
- sleep 1
- bridge -j -d -s mdb show dev br0 \
- | jq -e ".[].mdb[] | \
- select(.grp == \"$TEST_GROUP\" and \
- .source_list != null and .filter_mode == \"exclude\")" &>/dev/null
- check_err $? "Wrong *,G entry filter mode"
-
- check_sg_entries "is_exclude" "${X[@]}" "${Y[@]}"
- check_sg_state 0 "${X[@]}"
- check_sg_state 1 "${Y[@]}"
-
- 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.3\")" &>/dev/null
- check_fail $? "Wrong *,G entry source list, 192.0.2.3 entry still exists"
+ v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP
check_sg_fwding 1 "${X[@]}" 192.0.2.100
check_sg_fwding 0 "${Y[@]}"
@@ -401,6 +413,29 @@ v3inc_to_exclude_test()
v3cleanup $swp1 $TEST_GROUP
}
+v3exc_allow_test()
+{
+ RET=0
+ local X=("192.0.2.1" "192.0.2.2" "192.0.2.20" "192.0.2.30")
+ local Y=("192.0.2.21")
+
+ v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP
+
+ $MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_ALLOW2" -q
+ sleep 1
+ check_sg_entries "allow" "${X[@]}" "${Y[@]}"
+
+ check_sg_state 0 "${X[@]}"
+ check_sg_state 1 "${Y[@]}"
+
+ check_sg_fwding 1 "${X[@]}" 192.0.2.100
+ check_sg_fwding 0 "${Y[@]}"
+
+ log_test "IGMPv3 report $TEST_GROUP exclude -> allow"
+
+ v3cleanup $swp1 $TEST_GROUP
+}
+
trap cleanup EXIT
setup_prepare