xref: /linux/tools/testing/selftests/net/forwarding/bridge_mld.sh (revision 3d0fe49454652117522f60bfbefb978ba0e5300b)
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
4ALL_TESTS="mldv2include_test mldv2inc_allow_test mldv2inc_is_include_test mldv2inc_is_exclude_test \
5	   mldv2inc_to_exclude_test mldv2exc_allow_test mldv2exc_is_include_test \
6	   mldv2exc_is_exclude_test mldv2exc_to_exclude_test mldv2inc_block_test \
7	   mldv2exc_block_test mldv2exc_timeout_test mldv2star_ex_auto_add_test"
8NUM_NETIFS=4
9CHECK_TC="yes"
10TEST_GROUP="ff02::cc"
11TEST_GROUP_MAC="33:33:00:00:00:cc"
12
13# MLDv2 is_in report: grp ff02::cc is_include 2001:db8:1::1,2001:db8:1::2,2001:db8:1::3
14MZPKT_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:\
1500: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:\
1600: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:\
1700: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:\
1800:00:00:00:00:00:02:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:03"
19# MLDv2 is_in report: grp ff02::cc is_include 2001:db8:1::10,2001:db8:1::11,2001:db8:1::12
20MZPKT_IS_INC2="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:\
2100: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:\
2205:02:00:00:00:00:8f:00:8e:ac:00:00:00:01:01:00:00:03:ff:02:00:00:00:00:00:00:00:00:00:00:00:\
2300:00:cc:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:10:20:01:0d:b8:00:01:00:00:00:00:00:00:\
2400:00:00:11:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:12"
25# MLDv2 is_in report: grp ff02::cc is_include 2001:db8:1::20,2001:db8:1::30
26MZPKT_IS_INC3="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:44:00:01:fe:80:00:00:00:\
2700: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:\
2800:00:00:8f:00:bc:5a:00:00:00:01:01:00:00:02:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:cc:20:\
2901:0d:b8:00:01:00:00:00:00:00:00:00:00:00:20:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:30"
30# MLDv2 allow report: grp ff02::cc allow 2001:db8:1::10,2001:db8:1::11,2001:db8:1::12
31MZPKT_ALLOW="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:\
3200: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:\
3302:00:00:00:00:8f:00:8a:ac:00:00:00:01:05:00:00:03:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:\
3400:cc:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:10:20:01:0d:b8:00:01:00:00:00:00:00:00:00:\
3500:00:11:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:12"
36# MLDv2 allow report: grp ff02::cc allow 2001:db8:1::20,2001:db8:1::30
37MZPKT_ALLOW2="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:44:00:01:fe:80:00:00:00:\
3800: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:\
3900:00:00:8f:00:b8:5a:00:00:00:01:05:00:00:02:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:cc:20:\
4001:0d:b8:00:01:00:00:00:00:00:00:00:00:00:20:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:30"
41# MLDv2 is_ex report: grp ff02::cc is_exclude 2001:db8:1::1,2001:db8:1::2,2001:db8:1::20,2001:db8:1::21
42MZPKT_IS_EXC="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:64:00:01:fe:80:00:00:00:\
4300: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:\
4400:00:00:8f:00:5f:d0:00:00:00:01:02:00:00:04:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:cc:20:\
4501: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:\
4601:0d:b8:00:01:00:00:00:00:00:00:00:00:00:20:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:21"
47# MLDv2 is_ex report: grp ff02::cc is_exclude 2001:db8:1::20,2001:db8:1::30
48MZPKT_IS_EXC2="33:33:00:00:00:01:fe:54:00:04:5e:ba:86:dd:60:0a:2d:ae:00:44:00:01:fe:80:00:00:00:\
4900: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:\
5000:00:00:8f:00:bb:5a:00:00:00:01:02:00:00:02:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:cc:20:\
5101:0d:b8:00:01:00:00:00:00:00:00:00:00:00:20:20:01:0d:b8:00:01:00:00:00:00:00:00:00:00:00:30"
52# MLDv2 to_ex report: grp ff02::cc to_exclude 2001:db8:1::1,2001:db8:1::20,2001:db8:1::30
53MZPKT_TO_EXC="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:\
5400: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:\
5500:00:00:8f:00:8b:8e:00:00:00:01:04:00:00:03:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:cc:20:\
5601: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:20:20:\
5701:0d:b8:00:01:00:00:00:00:00:00:00:00:00:30"
58# MLDv2 block report: grp ff02::cc block 2001:db8:1::1,2001:db8:1::20,2001:db8:1::30
59MZPKT_BLOCK="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:\
6000: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:\
6100:00:8f:00:89:8e:00:00:00:01:06:00:00:03:ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:cc:20:01:\
620d: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:20:20:01:\
630d:b8:00:01:00:00:00:00:00:00:00:00:00:30"
64
65source lib.sh
66
67h1_create()
68{
69	simple_if_init $h1 2001:db8:1::1/64
70}
71
72h1_destroy()
73{
74	simple_if_fini $h1 2001:db8:1::1/64
75}
76
77h2_create()
78{
79	simple_if_init $h2 2001:db8:1::2/64
80}
81
82h2_destroy()
83{
84	simple_if_fini $h2 2001:db8:1::2/64
85}
86
87switch_create()
88{
89	ip link add dev br0 type bridge mcast_snooping 1 mcast_query_response_interval 100 \
90					mcast_mld_version 2 mcast_startup_query_interval 300 \
91					mcast_querier 1
92
93	ip link set dev $swp1 master br0
94	ip link set dev $swp2 master br0
95
96	ip link set dev br0 up
97	ip link set dev $swp1 up
98	ip link set dev $swp2 up
99
100	# make sure a query has been generated
101	sleep 5
102}
103
104switch_destroy()
105{
106	ip link set dev $swp2 down
107	ip link set dev $swp1 down
108
109	ip link del dev br0
110}
111
112setup_prepare()
113{
114	h1=${NETIFS[p1]}
115	swp1=${NETIFS[p2]}
116
117	swp2=${NETIFS[p3]}
118	h2=${NETIFS[p4]}
119
120	vrf_prepare
121
122	h1_create
123	h2_create
124
125	switch_create
126}
127
128cleanup()
129{
130	pre_cleanup
131
132	switch_destroy
133
134	h2_destroy
135	h1_destroy
136
137	vrf_cleanup
138}
139
140mldv2include_prepare()
141{
142	local host1_if=$1
143	local X=("2001:db8:1::1" "2001:db8:1::2" "2001:db8:1::3")
144
145	ip link set dev br0 type bridge mcast_mld_version 2
146	check_err $? "Could not change bridge MLD version to 2"
147
148	$MZ $host1_if $MZPKT_IS_INC -q
149	sleep 1
150	bridge -j -d -s mdb show dev br0 \
151		| jq -e ".[].mdb[] | \
152			 select(.grp == \"$TEST_GROUP\" and .source_list != null)" &>/dev/null
153	check_err $? "Missing *,G entry with source list"
154	bridge -j -d -s mdb show dev br0 \
155		| jq -e ".[].mdb[] | \
156			 select(.grp == \"$TEST_GROUP\" and \
157				.source_list != null and .filter_mode == \"include\")" &>/dev/null
158	check_err $? "Wrong *,G entry filter mode"
159	brmcast_check_sg_entries "is_include" "${X[@]}"
160}
161
162mldv2exclude_prepare()
163{
164	local host1_if=$1
165	local mac=$2
166	local group=$3
167	local pkt=$4
168	local X=("2001:db8:1::1" "2001:db8:1::2")
169	local Y=("2001:db8:1::20" "2001:db8:1::21")
170
171	mldv2include_prepare $h1
172
173	$MZ $host1_if -c 1 $MZPKT_IS_EXC -q
174	sleep 1
175	bridge -j -d -s mdb show dev br0 \
176		| jq -e ".[].mdb[] | \
177			 select(.grp == \"$TEST_GROUP\" and \
178			 .source_list != null and .filter_mode == \"exclude\")" &>/dev/null
179	check_err $? "Wrong *,G entry filter mode"
180
181	brmcast_check_sg_entries "is_exclude" "${X[@]}" "${Y[@]}"
182
183	brmcast_check_sg_state 0 "${X[@]}"
184	brmcast_check_sg_state 1 "${Y[@]}"
185
186	bridge -j -d -s mdb show dev br0 \
187		| jq -e ".[].mdb[] | \
188			 select(.grp == \"$TEST_GROUP\" and \
189				.source_list != null and
190				.source_list[].address == \"2001:db8:1::3\")" &>/dev/null
191	check_fail $? "Wrong *,G entry source list, 2001:db8:1::3 entry still exists"
192}
193
194mldv2cleanup()
195{
196	local port=$1
197
198	bridge mdb del dev br0 port $port grp $TEST_GROUP
199	ip link set dev br0 type bridge mcast_mld_version 1
200}
201
202mldv2include_test()
203{
204	RET=0
205	local X=("2001:db8:1::1" "2001:db8:1::2" "2001:db8:1::3")
206
207	mldv2include_prepare $h1
208
209	brmcast_check_sg_state 0 "${X[@]}"
210
211	brmcast_check_sg_fwding 1 "${X[@]}"
212	brmcast_check_sg_fwding 0 "2001:db8:1::100"
213
214	log_test "MLDv2 report $TEST_GROUP is_include"
215
216	mldv2cleanup $swp1
217}
218
219mldv2inc_allow_test()
220{
221	RET=0
222	local X=("2001:db8:1::10" "2001:db8:1::11" "2001:db8:1::12")
223
224	mldv2include_prepare $h1
225
226	$MZ $h1 -c 1 $MZPKT_ALLOW -q
227	sleep 1
228	brmcast_check_sg_entries "allow" "${X[@]}"
229
230	brmcast_check_sg_state 0 "${X[@]}"
231
232	brmcast_check_sg_fwding 1 "${X[@]}"
233	brmcast_check_sg_fwding 0 "2001:db8:1::100"
234
235	log_test "MLDv2 report $TEST_GROUP include -> allow"
236
237	mldv2cleanup $swp1
238}
239
240mldv2inc_is_include_test()
241{
242	RET=0
243	local X=("2001:db8:1::10" "2001:db8:1::11" "2001:db8:1::12")
244
245	mldv2include_prepare $h1
246
247	$MZ $h1 -c 1 $MZPKT_IS_INC2 -q
248	sleep 1
249	brmcast_check_sg_entries "is_include" "${X[@]}"
250
251	brmcast_check_sg_state 0 "${X[@]}"
252
253	brmcast_check_sg_fwding 1 "${X[@]}"
254	brmcast_check_sg_fwding 0 "2001:db8:1::100"
255
256	log_test "MLDv2 report $TEST_GROUP include -> is_include"
257
258	mldv2cleanup $swp1
259}
260
261mldv2inc_is_exclude_test()
262{
263	RET=0
264
265	mldv2exclude_prepare $h1
266
267	brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100
268	brmcast_check_sg_fwding 0 "${Y[@]}"
269
270	log_test "MLDv2 report $TEST_GROUP include -> is_exclude"
271
272	mldv2cleanup $swp1
273}
274
275mldv2inc_to_exclude_test()
276{
277	RET=0
278	local X=("2001:db8:1::1")
279	local Y=("2001:db8:1::20" "2001:db8:1::30")
280
281	mldv2include_prepare $h1
282
283	ip link set dev br0 type bridge mcast_last_member_interval 500
284	check_err $? "Could not change mcast_last_member_interval to 5s"
285
286	$MZ $h1 -c 1 $MZPKT_TO_EXC -q
287	sleep 1
288	bridge -j -d -s mdb show dev br0 \
289		| jq -e ".[].mdb[] | \
290			 select(.grp == \"$TEST_GROUP\" and \
291				.source_list != null and .filter_mode == \"exclude\")" &>/dev/null
292	check_err $? "Wrong *,G entry filter mode"
293
294	brmcast_check_sg_entries "to_exclude" "${X[@]}" "${Y[@]}"
295
296	brmcast_check_sg_state 0 "${X[@]}"
297	brmcast_check_sg_state 1 "${Y[@]}"
298
299	bridge -j -d -s mdb show dev br0 \
300		| jq -e ".[].mdb[] | \
301			 select(.grp == \"$TEST_GROUP\" and \
302				.source_list != null and
303				.source_list[].address == \"2001:db8:1::2\")" &>/dev/null
304	check_fail $? "Wrong *,G entry source list, 2001:db8:1::2 entry still exists"
305	bridge -j -d -s mdb show dev br0 \
306		| jq -e ".[].mdb[] | \
307			 select(.grp == \"$TEST_GROUP\" and \
308				.source_list != null and
309				.source_list[].address == \"2001:db8:1::21\")" &>/dev/null
310	check_fail $? "Wrong *,G entry source list, 2001:db8:1::21 entry still exists"
311
312	brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100
313	brmcast_check_sg_fwding 0 "${Y[@]}"
314
315	log_test "MLDv2 report $TEST_GROUP include -> to_exclude"
316
317	ip link set dev br0 type bridge mcast_last_member_interval 100
318
319	mldv2cleanup $swp1
320}
321
322mldv2exc_allow_test()
323{
324	RET=0
325	local X=("2001:db8:1::1" "2001:db8:1::2" "2001:db8:1::20" "2001:db8:1::30")
326	local Y=("2001:db8:1::21")
327
328	mldv2exclude_prepare $h1
329
330	$MZ $h1 -c 1 $MZPKT_ALLOW2 -q
331	sleep 1
332	brmcast_check_sg_entries "allow" "${X[@]}" "${Y[@]}"
333
334	brmcast_check_sg_state 0 "${X[@]}"
335	brmcast_check_sg_state 1 "${Y[@]}"
336
337	brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100
338	brmcast_check_sg_fwding 0 "${Y[@]}"
339
340	log_test "MLDv2 report $TEST_GROUP exclude -> allow"
341
342	mldv2cleanup $swp1
343}
344
345mldv2exc_is_include_test()
346{
347	RET=0
348	local X=("2001:db8:1::1" "2001:db8:1::2" "2001:db8:1::20" "2001:db8:1::30")
349	local Y=("2001:db8:1::21")
350
351	mldv2exclude_prepare $h1
352
353	$MZ $h1 -c 1 $MZPKT_IS_INC3 -q
354	sleep 1
355	brmcast_check_sg_entries "is_include" "${X[@]}" "${Y[@]}"
356
357	brmcast_check_sg_state 0 "${X[@]}"
358	brmcast_check_sg_state 1 "${Y[@]}"
359
360	brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100
361	brmcast_check_sg_fwding 0 "${Y[@]}"
362
363	log_test "MLDv2 report $TEST_GROUP exclude -> is_include"
364
365	mldv2cleanup $swp1
366}
367
368mldv2exc_is_exclude_test()
369{
370	RET=0
371	local X=("2001:db8:1::30")
372	local Y=("2001:db8:1::20")
373
374	mldv2exclude_prepare $h1
375
376	$MZ $h1 -c 1 $MZPKT_IS_EXC2 -q
377	sleep 1
378	brmcast_check_sg_entries "is_exclude" "${X[@]}" "${Y[@]}"
379
380	brmcast_check_sg_state 0 "${X[@]}"
381	brmcast_check_sg_state 1 "${Y[@]}"
382
383	brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100
384	brmcast_check_sg_fwding 0 "${Y[@]}"
385
386	log_test "MLDv2 report $TEST_GROUP exclude -> is_exclude"
387
388	mldv2cleanup $swp1
389}
390
391mldv2exc_to_exclude_test()
392{
393	RET=0
394	local X=("2001:db8:1::1" "2001:db8:1::30")
395	local Y=("2001:db8:1::20")
396
397	mldv2exclude_prepare $h1
398
399	ip link set dev br0 type bridge mcast_last_member_interval 500
400	check_err $? "Could not change mcast_last_member_interval to 5s"
401
402	$MZ $h1 -c 1 $MZPKT_TO_EXC -q
403	sleep 1
404	brmcast_check_sg_entries "to_exclude" "${X[@]}" "${Y[@]}"
405
406	brmcast_check_sg_state 0 "${X[@]}"
407	brmcast_check_sg_state 1 "${Y[@]}"
408
409	brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100
410	brmcast_check_sg_fwding 0 "${Y[@]}"
411
412	log_test "MLDv2 report $TEST_GROUP exclude -> to_exclude"
413
414	ip link set dev br0 type bridge mcast_last_member_interval 100
415
416	mldv2cleanup $swp1
417}
418
419mldv2inc_block_test()
420{
421	RET=0
422	local X=("2001:db8:1::2" "2001:db8:1::3")
423
424	mldv2include_prepare $h1
425
426	$MZ $h1 -c 1 $MZPKT_BLOCK -q
427	# make sure the lowered timers have expired (by default 2 seconds)
428	sleep 3
429	brmcast_check_sg_entries "block" "${X[@]}"
430
431	brmcast_check_sg_state 0 "${X[@]}"
432
433	bridge -j -d -s mdb show dev br0 \
434		| jq -e ".[].mdb[] | \
435			 select(.grp == \"$TEST_GROUP\" and \
436				.source_list != null and
437				.source_list[].address == \"2001:db8:1::1\")" &>/dev/null
438	check_fail $? "Wrong *,G entry source list, 2001:db8:1::1 entry still exists"
439
440	brmcast_check_sg_fwding 1 "${X[@]}"
441	brmcast_check_sg_fwding 0 2001:db8:1::100
442
443	log_test "MLDv2 report $TEST_GROUP include -> block"
444
445	mldv2cleanup $swp1
446}
447
448mldv2exc_block_test()
449{
450	RET=0
451	local X=("2001:db8:1::1" "2001:db8:1::2" "2001:db8:1::30")
452	local Y=("2001:db8:1::20" "2001:db8:1::21")
453
454	mldv2exclude_prepare $h1
455
456	ip link set dev br0 type bridge mcast_last_member_interval 500
457	check_err $? "Could not change mcast_last_member_interval to 5s"
458
459	$MZ $h1 -c 1 $MZPKT_BLOCK -q
460	sleep 1
461	brmcast_check_sg_entries "block" "${X[@]}" "${Y[@]}"
462
463	brmcast_check_sg_state 0 "${X[@]}"
464	brmcast_check_sg_state 1 "${Y[@]}"
465
466	brmcast_check_sg_fwding 1 "${X[@]}" 2001:db8:1::100
467	brmcast_check_sg_fwding 0 "${Y[@]}"
468
469	log_test "MLDv2 report $TEST_GROUP exclude -> block"
470
471	ip link set dev br0 type bridge mcast_last_member_interval 100
472
473	mldv2cleanup $swp1
474}
475
476mldv2exc_timeout_test()
477{
478	RET=0
479	local X=("2001:db8:1::20" "2001:db8:1::30")
480
481	# GMI should be 3 seconds
482	ip link set dev br0 type bridge mcast_query_interval 100 \
483					mcast_query_response_interval 100 \
484					mcast_membership_interval 300
485
486	mldv2exclude_prepare $h1
487	ip link set dev br0 type bridge mcast_query_interval 500 \
488					mcast_query_response_interval 500 \
489					mcast_membership_interval 1500
490
491	$MZ $h1 -c 1 $MZPKT_ALLOW2 -q
492	sleep 3
493	bridge -j -d -s mdb show dev br0 \
494		| jq -e ".[].mdb[] | \
495			 select(.grp == \"$TEST_GROUP\" and \
496				.source_list != null and .filter_mode == \"include\")" &>/dev/null
497	check_err $? "Wrong *,G entry filter mode"
498
499	bridge -j -d -s mdb show dev br0 \
500		| jq -e ".[].mdb[] | \
501			 select(.grp == \"$TEST_GROUP\" and \
502				.source_list != null and
503				.source_list[].address == \"2001:db8:1::1\")" &>/dev/null
504	check_fail $? "Wrong *,G entry source list, 2001:db8:1::1 entry still exists"
505	bridge -j -d -s mdb show dev br0 \
506		| jq -e ".[].mdb[] | \
507			 select(.grp == \"$TEST_GROUP\" and \
508				.source_list != null and
509				.source_list[].address == \"2001:db8:1::2\")" &>/dev/null
510	check_fail $? "Wrong *,G entry source list, 2001:db8:1::2 entry still exists"
511
512	brmcast_check_sg_entries "allow" "${X[@]}"
513
514	brmcast_check_sg_state 0 "${X[@]}"
515
516	brmcast_check_sg_fwding 1 "${X[@]}"
517	brmcast_check_sg_fwding 0 2001:db8:1::100
518
519	log_test "MLDv2 group $TEST_GROUP exclude timeout"
520
521	ip link set dev br0 type bridge mcast_query_interval 12500 \
522					mcast_query_response_interval 1000 \
523					mcast_membership_interval 26000
524
525	mldv2cleanup $swp1
526}
527
528mldv2star_ex_auto_add_test()
529{
530	RET=0
531
532	mldv2exclude_prepare $h1
533
534	$MZ $h2 -c 1 $MZPKT_IS_INC -q
535	sleep 1
536	bridge -j -d -s mdb show dev br0 \
537		| jq -e ".[].mdb[] | \
538			 select(.grp == \"$TEST_GROUP\" and .src == \"2001:db8:1::3\" and \
539				.port == \"$swp1\")" &>/dev/null
540	check_err $? "S,G entry for *,G port doesn't exist"
541
542	bridge -j -d -s mdb show dev br0 \
543		| jq -e ".[].mdb[] | \
544			 select(.grp == \"$TEST_GROUP\" and .src == \"2001:db8:1::3\" and \
545				.port == \"$swp1\" and \
546				.flags[] == \"added_by_star_ex\")" &>/dev/null
547	check_err $? "Auto-added S,G entry doesn't have added_by_star_ex flag"
548
549	brmcast_check_sg_fwding 1 2001:db8:1::3
550
551	log_test "MLDv2 S,G port entry automatic add to a *,G port"
552
553	mldv2cleanup $swp1
554	mldv2cleanup $swp2
555}
556
557trap cleanup EXIT
558
559setup_prepare
560setup_wait
561
562tests_run
563
564exit $EXIT_STATUS
565