blob: 3d0d579e4e03991b9c3791cbcdedca6e38fd8854 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
ALL_TESTS="mldv2include_test"
NUM_NETIFS=4
CHECK_TC="yes"
TEST_GROUP="ff02::cc"
TEST_GROUP_MAC="33:33:00:00:00:cc"
# MLDv2 is_in report: grp ff02::cc is_include 2001:db8:1::1,2001:db8:1::2,2001:db8:1::3
MZPKT_IS_INC="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:54:00:01:fe:80:00:\
00:00:00:00:00:fc:54:00:ff:fe:04:5e:ba:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:01:3a:\
00:05:02:00:00:00:00:8f:00:8e:d9:00:00:00:01:01:00:00:03:ff:02:00:00:00:00:00:00:00:00:00:\
00:00:00:00:cc:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:01:20:01:0d:b8:00:01:00:00:00:\
00:00:00:00:00:00:02:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:03"
source lib.sh
h1_create()
{
simple_if_init $h1 2001:db8:1::1/64
}
h1_destroy()
{
simple_if_fini $h1 2001:db8:1::1/64
}
h2_create()
{
simple_if_init $h2 2001:db8:1::2/64
}
h2_destroy()
{
simple_if_fini $h2 2001:db8:1::2/64
}
switch_create()
{
ip link add dev br0 type bridge mcast_snooping 1 mcast_query_response_interval 100 \
mcast_mld_version 2 mcast_startup_query_interval 300 \
mcast_querier 1
ip link set dev $swp1 master br0
ip link set dev $swp2 master br0
ip link set dev br0 up
ip link set dev $swp1 up
ip link set dev $swp2 up
# make sure a query has been generated
sleep 5
}
switch_destroy()
{
ip link set dev $swp2 down
ip link set dev $swp1 down
ip link del dev br0
}
setup_prepare()
{
h1=${NETIFS[p1]}
swp1=${NETIFS[p2]}
swp2=${NETIFS[p3]}
h2=${NETIFS[p4]}
vrf_prepare
h1_create
h2_create
switch_create
}
cleanup()
{
pre_cleanup
switch_destroy
h2_destroy
h1_destroy
vrf_cleanup
}
mldv2include_prepare()
{
local host1_if=$1
local X=("2001:db8:1::1" "2001:db8:1::2" "2001:db8:1::3")
ip link set dev br0 type bridge mcast_mld_version 2
check_err $? "Could not change bridge MLD version to 2"
$MZ $host1_if $MZPKT_IS_INC -q
sleep 1
bridge -j -d -s mdb show dev br0 \
| jq -e ".[].mdb[] | \
select(.grp == \"$TEST_GROUP\" and .source_list != null)" &>/dev/null
check_err $? "Missing *,G entry with source list"
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"
brmcast_check_sg_entries "is_include" "${X[@]}"
}
mldv2cleanup()
{
local port=$1
bridge mdb del dev br0 port $port grp $TEST_GROUP
ip link set dev br0 type bridge mcast_mld_version 1
}
mldv2include_test()
{
RET=0
local X=("2001:db8:1::1" "2001:db8:1::2" "2001:db8:1::3")
mldv2include_prepare $h1
brmcast_check_sg_state 0 "${X[@]}"
brmcast_check_sg_fwding 1 "${X[@]}"
brmcast_check_sg_fwding 0 "2001:db8:1::100"
log_test "MLDv2 report $TEST_GROUP is_include"
mldv2cleanup $swp1
}
trap cleanup EXIT
setup_prepare
setup_wait
tests_run
exit $EXIT_STATUS
|