summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/net/forwarding/bridge_igmp.sh
blob: e6a3e04fd83f31f7897cb7111ed11406665fffb6 (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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
#!/bin/bash
# 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 v3exc_allow_test v3exc_is_include_test \
	   v3exc_is_exclude_test v3exc_to_exclude_test v3inc_block_test v3exc_block_test \
	   v3exc_timeout_test v3star_ex_auto_add_test"
NUM_NETIFS=4
CHECK_TC="yes"
TEST_GROUP="239.10.10.10"
TEST_GROUP_MAC="01:00:5e:0a:0a:0a"

ALL_GROUP="224.0.0.1"
ALL_MAC="01:00:5e:00:00:01"

# IGMPv3 is_in report: grp 239.10.10.10 is_include 192.0.2.1,192.0.2.2,192.0.2.3
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:02:02:c0:00:02:03"
# IGMPv3 is_in report: grp 239.10.10.10 is_include 192.0.2.10,192.0.2.11,192.0.2.12
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 is_in report: grp 239.10.10.10 is_include 192.0.2.20,192.0.2.30
MZPKT_IS_INC3="22:00:5f:b4:00:00:00:01:01:00:00:02:ef:0a:0a:0a:c0:00:02:14:c0:00:02:1e"
# 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 is_ex report: grp 239.10.10.10 is_exclude 192.0.2.20,192.0.2.30
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

h1_create()
{
	simple_if_init $h1 192.0.2.1/24 2001:db8:1::1/64
}

h1_destroy()
{
	simple_if_fini $h1 192.0.2.1/24 2001:db8:1::1/64
}

h2_create()
{
	simple_if_init $h2 192.0.2.2/24 2001:db8:1::2/64
}

h2_destroy()
{
	simple_if_fini $h2 192.0.2.2/24 2001:db8:1::2/64
}

switch_create()
{
	ip link add dev br0 type bridge mcast_snooping 1 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
}

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
}

v2reportleave_test()
{
	RET=0
	ip address add dev $h2 $TEST_GROUP/32 autojoin
	check_err $? "Could not join $TEST_GROUP"

	sleep 5
	bridge mdb show dev br0 | grep $TEST_GROUP 1>/dev/null
	check_err $? "IGMPv2 report didn't create mdb entry for $TEST_GROUP"

	mcast_packet_test $TEST_GROUP_MAC 192.0.2.1 $TEST_GROUP $h1 $h2
	check_fail $? "Traffic to $TEST_GROUP wasn't forwarded"

	log_test "IGMPv2 report $TEST_GROUP"

	RET=0
	bridge mdb show dev br0 | grep $TEST_GROUP 1>/dev/null
	check_err $? "mdb entry for $TEST_GROUP is missing"

	ip address del dev $h2 $TEST_GROUP/32
	check_err $? "Could not leave $TEST_GROUP"

	sleep 5
	bridge mdb show dev br0 | grep $TEST_GROUP 1>/dev/null
	check_fail $? "Leave didn't delete mdb entry for $TEST_GROUP"

	mcast_packet_test $TEST_GROUP_MAC 192.0.2.1 $TEST_GROUP $h1 $h2
	check_err $? "Traffic to $TEST_GROUP was forwarded without mdb entry"

	log_test "IGMPv2 leave $TEST_GROUP"
}

v3include_prepare()
{
	local host1_if=$1
	local mac=$2
	local group=$3
	local X=("192.0.2.1" "192.0.2.2" "192.0.2.3")

	ip link set dev br0 type bridge mcast_igmp_version 3
	check_err $? "Could not change bridge IGMP version to 3"

	$MZ $host1_if -b $mac -c 1 -B $group -t ip "proto=2,p=$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[@]}"
}

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"

	brmcast_check_sg_entries "is_exclude" "${X[@]}" "${Y[@]}"

	brmcast_check_sg_state 0 "${X[@]}"
	brmcast_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
	local group=$2

	bridge mdb del dev br0 port $port grp $group
	ip link set dev br0 type bridge mcast_igmp_version 2
}

v3include_test()
{
	RET=0
	local X=("192.0.2.1" "192.0.2.2" "192.0.2.3")

	v3include_prepare $h1 $ALL_MAC $ALL_GROUP

	brmcast_check_sg_state 0 "${X[@]}"

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

	log_test "IGMPv3 report $TEST_GROUP is_include"

	v3cleanup $swp1 $TEST_GROUP
}

v3inc_allow_test()
{
	RET=0
	local X=("192.0.2.10" "192.0.2.11" "192.0.2.12")

	v3include_prepare $h1 $ALL_MAC $ALL_GROUP

	$MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_ALLOW" -q
	sleep 1
	brmcast_check_sg_entries "allow" "${X[@]}"

	brmcast_check_sg_state 0 "${X[@]}"

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

	log_test "IGMPv3 report $TEST_GROUP include -> allow"

	v3cleanup $swp1 $TEST_GROUP
}

v3inc_is_include_test()
{
	RET=0
	local X=("192.0.2.10" "192.0.2.11" "192.0.2.12")

	v3include_prepare $h1 $ALL_MAC $ALL_GROUP

	$MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_IS_INC2" -q
	sleep 1
	brmcast_check_sg_entries "is_include" "${X[@]}"

	brmcast_check_sg_state 0 "${X[@]}"

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

	log_test "IGMPv3 report $TEST_GROUP include -> is_include"

	v3cleanup $swp1 $TEST_GROUP
}

v3inc_is_exclude_test()
{
	RET=0

	v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP

	brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100
	brmcast_check_sg_fwding 0 "${Y[@]}"

	log_test "IGMPv3 report $TEST_GROUP include -> is_exclude"

	v3cleanup $swp1 $TEST_GROUP
}

v3inc_to_exclude_test()
{
	RET=0
	local X=("192.0.2.1")
	local Y=("192.0.2.20" "192.0.2.30")

	v3include_prepare $h1 $ALL_MAC $ALL_GROUP

	ip link set dev br0 type bridge mcast_last_member_interval 500
	check_err $? "Could not change mcast_last_member_interval to 5s"

	$MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_TO_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"

	brmcast_check_sg_entries "to_exclude" "${X[@]}" "${Y[@]}"

	brmcast_check_sg_state 0 "${X[@]}"
	brmcast_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.2\")" &>/dev/null
	check_fail $? "Wrong *,G entry source list, 192.0.2.2 entry still exists"
	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.21\")" &>/dev/null
	check_fail $? "Wrong *,G entry source list, 192.0.2.21 entry still exists"

	brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100
	brmcast_check_sg_fwding 0 "${Y[@]}"

	log_test "IGMPv3 report $TEST_GROUP include -> to_exclude"

	ip link set dev br0 type bridge mcast_last_member_interval 100

	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
	brmcast_check_sg_entries "allow" "${X[@]}" "${Y[@]}"

	brmcast_check_sg_state 0 "${X[@]}"
	brmcast_check_sg_state 1 "${Y[@]}"

	brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100
	brmcast_check_sg_fwding 0 "${Y[@]}"

	log_test "IGMPv3 report $TEST_GROUP exclude -> allow"

	v3cleanup $swp1 $TEST_GROUP
}

v3exc_is_include_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_IS_INC3" -q
	sleep 1
	brmcast_check_sg_entries "is_include" "${X[@]}" "${Y[@]}"

	brmcast_check_sg_state 0 "${X[@]}"
	brmcast_check_sg_state 1 "${Y[@]}"

	brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100
	brmcast_check_sg_fwding 0 "${Y[@]}"

	log_test "IGMPv3 report $TEST_GROUP exclude -> is_include"

	v3cleanup $swp1 $TEST_GROUP
}

v3exc_is_exclude_test()
{
	RET=0
	local X=("192.0.2.30")
	local Y=("192.0.2.20")

	v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP

	$MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_IS_EXC2" -q
	sleep 1
	brmcast_check_sg_entries "is_exclude" "${X[@]}" "${Y[@]}"

	brmcast_check_sg_state 0 "${X[@]}"
	brmcast_check_sg_state 1 "${Y[@]}"

	brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100
	brmcast_check_sg_fwding 0 "${Y[@]}"

	log_test "IGMPv3 report $TEST_GROUP exclude -> is_exclude"

	v3cleanup $swp1 $TEST_GROUP
}

v3exc_to_exclude_test()
{
	RET=0
	local X=("192.0.2.1" "192.0.2.30")
	local Y=("192.0.2.20")

	v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP

	ip link set dev br0 type bridge mcast_last_member_interval 500
	check_err $? "Could not change mcast_last_member_interval to 5s"

	$MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_TO_EXC" -q
	sleep 1
	brmcast_check_sg_entries "to_exclude" "${X[@]}" "${Y[@]}"

	brmcast_check_sg_state 0 "${X[@]}"
	brmcast_check_sg_state 1 "${Y[@]}"

	brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100
	brmcast_check_sg_fwding 0 "${Y[@]}"

	log_test "IGMPv3 report $TEST_GROUP exclude -> to_exclude"

	ip link set dev br0 type bridge mcast_last_member_interval 100

	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
	brmcast_check_sg_entries "block" "${X[@]}"

	brmcast_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"

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

	log_test "IGMPv3 report $TEST_GROUP include -> block"

	v3cleanup $swp1 $TEST_GROUP
}

v3exc_block_test()
{
	RET=0
	local X=("192.0.2.1" "192.0.2.2" "192.0.2.30")
	local Y=("192.0.2.20" "192.0.2.21")

	v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP

	ip link set dev br0 type bridge mcast_last_member_interval 500
	check_err $? "Could not change mcast_last_member_interval to 5s"

	$MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_BLOCK" -q
	sleep 1
	brmcast_check_sg_entries "block" "${X[@]}" "${Y[@]}"

	brmcast_check_sg_state 0 "${X[@]}"
	brmcast_check_sg_state 1 "${Y[@]}"

	brmcast_check_sg_fwding 1 "${X[@]}" 192.0.2.100
	brmcast_check_sg_fwding 0 "${Y[@]}"

	log_test "IGMPv3 report $TEST_GROUP exclude -> block"

	ip link set dev br0 type bridge mcast_last_member_interval 100

	v3cleanup $swp1 $TEST_GROUP
}

v3exc_timeout_test()
{
	RET=0
	local X=("192.0.2.20" "192.0.2.30")

	# GMI should be 5 seconds
	ip link set dev br0 type bridge mcast_query_interval 100 \
					mcast_query_response_interval 100 \
					mcast_membership_interval 500

	v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP
	ip link set dev br0 type bridge mcast_query_interval 500 \
					mcast_query_response_interval 500 \
					mcast_membership_interval 1500

	$MZ $h1 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_ALLOW2" -q
	sleep 5
	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"

	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"
	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.2\")" &>/dev/null
	check_fail $? "Wrong *,G entry source list, 192.0.2.2 entry still exists"

	brmcast_check_sg_entries "allow" "${X[@]}"

	brmcast_check_sg_state 0 "${X[@]}"

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

	log_test "IGMPv3 group $TEST_GROUP exclude timeout"

	ip link set dev br0 type bridge mcast_query_interval 12500 \
					mcast_query_response_interval 1000 \
					mcast_membership_interval 26000

	v3cleanup $swp1 $TEST_GROUP
}

v3star_ex_auto_add_test()
{
	RET=0

	v3exclude_prepare $h1 $ALL_MAC $ALL_GROUP

	$MZ $h2 -c 1 -b $ALL_MAC -B $ALL_GROUP -t ip "proto=2,p=$MZPKT_IS_INC" -q
	sleep 1
	bridge -j -d -s mdb show dev br0 \
		| jq -e ".[].mdb[] | \
			 select(.grp == \"$TEST_GROUP\" and .src == \"192.0.2.3\" and \
				.port == \"$swp1\")" &>/dev/null
	check_err $? "S,G entry for *,G port doesn't exist"

	bridge -j -d -s mdb show dev br0 \
		| jq -e ".[].mdb[] | \
			 select(.grp == \"$TEST_GROUP\" and .src == \"192.0.2.3\" and \
				.port == \"$swp1\" and \
				.flags[] == \"added_by_star_ex\")" &>/dev/null
	check_err $? "Auto-added S,G entry doesn't have added_by_star_ex flag"

	brmcast_check_sg_fwding 1 192.0.2.3

	log_test "IGMPv3 S,G port entry automatic add to a *,G port"

	v3cleanup $swp1 $TEST_GROUP
	v3cleanup $swp2 $TEST_GROUP
}

trap cleanup EXIT

setup_prepare
setup_wait

tests_run

exit $EXIT_STATUS