File: mcast-snooping.at

package info (click to toggle)
openvswitch 3.6.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 99,632 kB
  • sloc: sh: 1,683,183; ansic: 313,349; python: 28,192; xml: 21,442; makefile: 549; javascript: 191
file content (689 lines) | stat: -rw-r--r-- 26,434 bytes parent folder | download | duplicates (3)
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
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
AT_BANNER([mcast snooping])

AT_SETUP([mcast - check multicasts to trunk ports are not duplicated])

OVS_VSWITCHD_START([])

AT_CHECK([
    ovs-vsctl set bridge br0 \
    datapath_type=dummy \
    mcast_snooping_enable=true \
    other-config:mcast-snooping-disable-flood-unregistered=true
], [0])

AT_CHECK([ovs-ofctl add-flow br0 action=normal])

# Create an access port p1 on vlan 1725, and a trunk port p2.
AT_CHECK([
    ovs-vsctl add-port br0 p1 tag=1725 -- set Interface p1 type=dummy \
    other-config:hwaddr=aa:55:aa:55:00:01 ofport_request=1 \
    -- add-port br0 p2 -- set Interface p2 type=dummy \
    other-config:hwaddr=aa:55:aa:55:00:02 ofport_request=2
], [0])

AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dummy@ovs-dummy: hit:0 missed:0
  br0:
    br0 65534/100: (dummy-internal)
    p1 1/1: (dummy)
    p2 2/2: (dummy)
])

ovs-appctl time/stop

# Send IGMPv3 query on p2 with vlan 1725.
# 5c:8a:38:55:25:52 > 01:00:5e:00:00:01, ethertype 802.1Q (0x8100), length 64: vlan 1725, p 0, ethertype IPv4,
# 172.17.25.1 > 224.0.0.1: igmp query v3
AT_CHECK([ovs-appctl netdev-dummy/receive p2 \
'01005e0000015c8a38552552810006bd080046c000240000000001027f00ac111901e0000001940400001164ec1e00000000027d000000000000000000000000'])

# Send IGMPv3 query on p2 with vlan 1728.
# 5c:8a:38:55:25:52 > 01:00:5e:00:00:01, ethertype 802.1Q (0x8100), length 64: vlan 1728, p 0, ethertype IPv4,
# 172.17.28.1 > 224.0.0.1: igmp query v3
AT_CHECK([ovs-appctl netdev-dummy/receive p2 \
'01005e0000015c8a38552552810006c0080046c000240000000001027c00ac111c01e0000001940400001164ec1e00000000027d000000000000000000000000'])

AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
 port  VLAN  protocol  GROUP                Age
    2  1725  UNKNOWN   querier               0
    2  1728  UNKNOWN   querier               0
])

AT_CHECK([ovs-vsctl set Interface p2 options:tx_pcap=p2.pcap])

# Send a multicast packet on p1.
AT_CHECK([
    ovs-appctl netdev-dummy/receive p1 \
    'in_port(1),eth(src=aa:55:aa:55:00:01,dst=01:00:5e:5e:01:01),eth_type(0x0800),ipv4(src=10.0.0.1,dst=239.94.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=0,dst=8000)'
])

# Check this packet was forwarded exactly once to p2 and has vlan tag 1725.
# aa:55:aa:55:00:01 > 01:00:5e:5e:01:01, ethertype 802.1Q (0x8100), length 46: vlan 1725, p 0, ethertype IPv4,
# 10.0.0.1.0 > 239.94.1.1.8000: UDP, length 0
AT_CHECK([ovs-pcap p2.pcap > p2.pcap.txt 2>&1])
AT_CHECK([cat p2.pcap.txt], [0], [dnl
01005e5e0101aa55aa550001810006bd08004500005c00000000401180310a000001ef5e010100001f40004801ba000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f
])

# Clear the mdb, send a IGMP packet with invalid checksum and make sure it
# does not end up in the mdb.
AT_CHECK([ovs-appctl mdb/flush br0], [0], [dnl
table successfully flushed
])

AT_CHECK([ovs-appctl netdev-dummy/receive p2 \
'01005e0000015c8a38552552810006bd080046c000240000000001027f00ac111901e0000001940400001164ec1000000000027d000000000000000000000000'])

AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
 port  VLAN  protocol  GROUP                Age
])


# First send a valid packet to make sure it populates the mdb. Than Clear
# the mdb, send a MLD packet with invalid checksum and make sure it does
# not end up in the mdb.

AT_CHECK([ovs-appctl netdev-dummy/receive p2 \
'3333ff0e4c67000c290e4c6786dd600000000020000100000000000000000000000000000000ff0200000000000000000001ff0e4c673a000502000001008300e7b800000000ff0200000000000000000001ff0e4c67'])

AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
 port  VLAN  protocol  GROUP                Age
    2     0  MLDv1     ff02::1:ff0e:4c67           0
])

AT_CHECK([ovs-appctl mdb/flush br0], [0], [dnl
table successfully flushed
])

AT_CHECK([ovs-appctl netdev-dummy/receive p2 \
'3333ff0e4c67000c290e4c6786dd600000000020000100000000000000000000000000000000ff0200000000000000000001ff0e4c673a000502000001008300e7b000000000ff0200000000000000000001ff0e4c67'])

AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
 port  VLAN  protocol  GROUP                Age
])

OVS_VSWITCHD_STOP
AT_CLEANUP


AT_SETUP([mcast - check multicast per port flooding])
OVS_VSWITCHD_START([])

AT_CHECK([
    ovs-vsctl set bridge br0 \
    datapath_type=dummy \
    mcast_snooping_enable=true \
    other-config:mcast-snooping-disable-flood-unregistered=false
], [0])

AT_CHECK([ovs-ofctl add-flow br0 action=normal])

AT_CHECK([
    ovs-vsctl add-port br0 p1 \
    -- set Interface p1 type=dummy other-config:hwaddr=aa:55:aa:55:00:01 ofport_request=1 \
    -- add-port br0 p2 \
    -- set Interface p2 type=dummy other-config:hwaddr=aa:55:aa:55:00:02 ofport_request=2 \
    -- add-port br0 p3 \
    -- set Interface p3 type=dummy other-config:hwaddr=aa:55:aa:55:00:03 ofport_request=3 \
], [0])

ovs-appctl time/stop

AT_CHECK([ovs-appctl ofproto/trace "in_port(3),eth(src=aa:55:aa:55:00:ff,dst=01:00:5e:01:01:01),eth_type(0x0800),ipv4(src=10.0.0.1,dst=224.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=0,dst=8000)"], [0], [stdout])
AT_CHECK([grep -v 'Datapath actions:' stdout], [0], [dnl
Flow: udp,in_port=3,vlan_tci=0x0000,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_src=10.0.0.1,nw_dst=224.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,nw_frag=no,tp_src=0,tp_dst=8000

bridge("br0")
-------------
 0. priority 32768
    NORMAL
     -> unregistered multicast, flooding

Final flow: unchanged
Megaflow: recirc_id=0,eth,udp,in_port=3,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_dst=224.1.1.1,nw_frag=no
])
AT_CHECK([sed -ne 's/^Datapath actions: \(.*\)$/\1/p' stdout | tr "," "\n" | sort -n], [0], [dnl
1
2
100
])

# Send report packets.
AT_CHECK([
    ovs-appctl netdev-dummy/receive p1  \
        '01005E010101000C29A027A108004500001C000100004002CBAEAC10221EE001010112140CE9E0010101'
], [0])
AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
 port  VLAN  protocol  GROUP                Age
    1     0  IGMPv1    224.1.1.1           0
])

AT_CHECK([ovs-appctl ofproto/trace "in_port(3),eth(src=aa:55:aa:55:00:ff,dst=01:00:5e:01:01:01),eth_type(0x0800),ipv4(src=10.0.0.1,dst=224.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=0,dst=8000)"], [0], [dnl
Flow: udp,in_port=3,vlan_tci=0x0000,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_src=10.0.0.1,nw_dst=224.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,nw_frag=no,tp_src=0,tp_dst=8000

bridge("br0")
-------------
 0. priority 32768
    NORMAL
     -> forwarding to mcast group port

Final flow: unchanged
Megaflow: recirc_id=0,eth,udp,in_port=3,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_dst=224.1.1.1,nw_frag=no
Datapath actions: 1
])

AT_CHECK([ovs-vsctl set port p2 other_config:mcast-snooping-flood=true])

AT_CHECK([ovs-appctl ofproto/trace "in_port(3),eth(src=aa:55:aa:55:00:ff,dst=01:00:5e:01:01:01),eth_type(0x0800),ipv4(src=10.0.0.1,dst=224.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=0,dst=8000)"], [0], [dnl
Flow: udp,in_port=3,vlan_tci=0x0000,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_src=10.0.0.1,nw_dst=224.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,nw_frag=no,tp_src=0,tp_dst=8000

bridge("br0")
-------------
 0. priority 32768
    NORMAL
     -> forwarding to mcast group port
     -> forwarding to mcast flood port

Final flow: unchanged
Megaflow: recirc_id=0,eth,udp,in_port=3,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_dst=224.1.1.1,nw_frag=no
Datapath actions: 1,2
])

AT_CHECK([ovs-vsctl set port p3 other_config:mcast-snooping-flood=true])

AT_CHECK([ovs-appctl ofproto/trace "in_port(3),eth(src=aa:55:aa:55:00:ff,dst=01:00:5e:01:01:01),eth_type(0x0800),ipv4(src=10.0.0.1,dst=224.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=0,dst=8000)"], [0], [dnl
Flow: udp,in_port=3,vlan_tci=0x0000,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_src=10.0.0.1,nw_dst=224.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,nw_frag=no,tp_src=0,tp_dst=8000

bridge("br0")
-------------
 0. priority 32768
    NORMAL
     -> forwarding to mcast group port
     -> forwarding to mcast flood port
     -> mcast flood port is input port, dropping

Final flow: unchanged
Megaflow: recirc_id=0,eth,udp,in_port=3,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_dst=224.1.1.1,nw_frag=no
Datapath actions: 1,2
])

# Change p2 ofport to force a ofbundle change and check that the mdb contains
# no stale port.
AT_CHECK([ovs-vsctl set interface p2 ofport_request=4])

AT_CHECK([ovs-appctl ofproto/trace "in_port(3),eth(src=aa:55:aa:55:00:ff,dst=01:00:5e:01:01:01),eth_type(0x0800),ipv4(src=10.0.0.1,dst=224.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=0,dst=8000)"], [0], [dnl
Flow: udp,in_port=3,vlan_tci=0x0000,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_src=10.0.0.1,nw_dst=224.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,nw_frag=no,tp_src=0,tp_dst=8000

bridge("br0")
-------------
 0. priority 32768
    NORMAL
     -> forwarding to mcast group port
     -> mcast flood port is input port, dropping
     -> forwarding to mcast flood port

Final flow: unchanged
Megaflow: recirc_id=0,eth,udp,in_port=3,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_dst=224.1.1.1,nw_frag=no
Datapath actions: 1,2
])

OVS_VSWITCHD_STOP
AT_CLEANUP


AT_SETUP([mcast - check multicast per port flooding (unregistered flood disabled)])
OVS_VSWITCHD_START([])

AT_CHECK([
    ovs-vsctl set bridge br0 \
    datapath_type=dummy \
    mcast_snooping_enable=true \
    other-config:mcast-snooping-disable-flood-unregistered=true
], [0])

AT_CHECK([ovs-ofctl add-flow br0 action=normal])

AT_CHECK([
    ovs-vsctl add-port br0 p1 \
    -- set Interface p1 type=dummy other-config:hwaddr=aa:55:aa:55:00:01 ofport_request=1 \
    -- add-port br0 p2 \
    -- set Interface p2 type=dummy other-config:hwaddr=aa:55:aa:55:00:02 ofport_request=2 \
    -- add-port br0 p3 \
    -- set Interface p3 type=dummy other-config:hwaddr=aa:55:aa:55:00:03 ofport_request=3 \
], [0])

ovs-appctl time/stop

AT_CHECK([ovs-appctl ofproto/trace "in_port(3),eth(src=aa:55:aa:55:00:ff,dst=01:00:5e:01:01:01),eth_type(0x0800),ipv4(src=10.0.0.1,dst=224.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=0,dst=8000)"], [0], [dnl
Flow: udp,in_port=3,vlan_tci=0x0000,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_src=10.0.0.1,nw_dst=224.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,nw_frag=no,tp_src=0,tp_dst=8000

bridge("br0")
-------------
 0. priority 32768
    NORMAL

Final flow: unchanged
Megaflow: recirc_id=0,eth,udp,in_port=3,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_dst=224.1.1.1,nw_frag=no
Datapath actions: drop
])

AT_CHECK([ovs-vsctl set port p2 other_config:mcast-snooping-flood=true])

AT_CHECK([ovs-appctl ofproto/trace "in_port(3),eth(src=aa:55:aa:55:00:ff,dst=01:00:5e:01:01:01),eth_type(0x0800),ipv4(src=10.0.0.1,dst=224.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=0,dst=8000)"], [0], [dnl
Flow: udp,in_port=3,vlan_tci=0x0000,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_src=10.0.0.1,nw_dst=224.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,nw_frag=no,tp_src=0,tp_dst=8000

bridge("br0")
-------------
 0. priority 32768
    NORMAL
     -> forwarding to mcast flood port

Final flow: unchanged
Megaflow: recirc_id=0,eth,udp,in_port=3,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_dst=224.1.1.1,nw_frag=no
Datapath actions: 2
])

AT_CHECK([ovs-vsctl set port p3 other_config:mcast-snooping-flood=true])

AT_CHECK([ovs-appctl ofproto/trace "in_port(3),eth(src=aa:55:aa:55:00:ff,dst=01:00:5e:01:01:01),eth_type(0x0800),ipv4(src=10.0.0.1,dst=224.1.1.1,proto=17,tos=0,ttl=64,frag=no),udp(src=0,dst=8000)"], [0], [dnl
Flow: udp,in_port=3,vlan_tci=0x0000,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_src=10.0.0.1,nw_dst=224.1.1.1,nw_tos=0,nw_ecn=0,nw_ttl=64,nw_frag=no,tp_src=0,tp_dst=8000

bridge("br0")
-------------
 0. priority 32768
    NORMAL
     -> forwarding to mcast flood port
     -> mcast flood port is input port, dropping

Final flow: unchanged
Megaflow: recirc_id=0,eth,udp,in_port=3,dl_src=aa:55:aa:55:00:ff,dl_dst=01:00:5e:01:01:01,nw_dst=224.1.1.1,nw_frag=no
Datapath actions: 2
])

OVS_VSWITCHD_STOP
AT_CLEANUP


AT_SETUP([mcast - check reports per port flooding])
OVS_VSWITCHD_START([])

AT_CHECK([
    ovs-vsctl set bridge br0 \
    datapath_type=dummy \
    mcast_snooping_enable=true \
    other-config:mcast-snooping-disable-flood-unregistered=false
], [0])

AT_CHECK([ovs-ofctl add-flow br0 action=normal])

AT_CHECK([
    ovs-vsctl add-port br0 p1 \
    -- set Interface p1 type=dummy other-config:hwaddr=aa:55:aa:55:00:01 ofport_request=1 \
    -- add-port br0 p2 \
    -- set Interface p2 type=dummy other-config:hwaddr=aa:55:aa:55:00:02 ofport_request=2 \
    -- add-port br0 p3 \
    -- set Interface p3 type=dummy other-config:hwaddr=aa:55:aa:55:00:03 ofport_request=3 \
], [0])

ovs-appctl time/stop

AT_CHECK([ovs-appctl ofproto/trace "in_port(1)" '01005E010101000C29A027A108004500001C000100004002CBAEAC10221EE001010112140CE9E0010101'], [0], [dnl
Flow: ip,in_port=1,vlan_tci=0x0000,dl_src=00:0c:29:a0:27:a1,dl_dst=01:00:5e:01:01:01,nw_src=172.16.34.30,nw_dst=224.1.1.1,nw_proto=2,nw_tos=0,nw_ecn=0,nw_ttl=64,nw_frag=no,tp_src=18,tp_dst=20

bridge("br0")
-------------
 0. priority 32768
    NORMAL
     -> learned that 00:0c:29:a0:27:a1 is on port p1 in VLAN 0
     -> multicast snooping learned that 224.1.1.1 is on port p1 in VLAN 0

Final flow: unchanged
Megaflow: recirc_id=0,eth,ip,in_port=1,dl_src=00:0c:29:a0:27:a1,dl_dst=01:00:5e:01:01:01,nw_proto=2,nw_frag=no
Datapath actions: drop
This flow is handled by the userspace slow path because it:
  - Uses action(s) not supported by datapath.
])

AT_CHECK([ovs-vsctl set port p3 other_config:mcast-snooping-flood-reports=true])

AT_CHECK([ovs-appctl ofproto/trace "in_port(1)" '01005E010101000C29A027A108004500001C000100004002CBAEAC10221EE001010112140CE9E0010101'], [0], [dnl
Flow: ip,in_port=1,vlan_tci=0x0000,dl_src=00:0c:29:a0:27:a1,dl_dst=01:00:5e:01:01:01,nw_src=172.16.34.30,nw_dst=224.1.1.1,nw_proto=2,nw_tos=0,nw_ecn=0,nw_ttl=64,nw_frag=no,tp_src=18,tp_dst=20

bridge("br0")
-------------
 0. priority 32768
    NORMAL
     -> forwarding report to mcast flagged port

Final flow: unchanged
Megaflow: recirc_id=0,eth,ip,in_port=1,dl_src=00:0c:29:a0:27:a1,dl_dst=01:00:5e:01:01:01,nw_proto=2,nw_frag=no
Datapath actions: 3
This flow is handled by the userspace slow path because it:
  - Uses action(s) not supported by datapath.
])

AT_CHECK([ovs-vsctl set port p2 other_config:mcast-snooping-flood-reports=true])

AT_CHECK([ovs-appctl ofproto/trace "in_port(1)" '01005E010101000C29A027A108004500001C000100004002CBAEAC10221EE001010112140CE9E0010101'], [0], [dnl
Flow: ip,in_port=1,vlan_tci=0x0000,dl_src=00:0c:29:a0:27:a1,dl_dst=01:00:5e:01:01:01,nw_src=172.16.34.30,nw_dst=224.1.1.1,nw_proto=2,nw_tos=0,nw_ecn=0,nw_ttl=64,nw_frag=no,tp_src=18,tp_dst=20

bridge("br0")
-------------
 0. priority 32768
    NORMAL
     -> forwarding report to mcast flagged port
     -> forwarding report to mcast flagged port

Final flow: unchanged
Megaflow: recirc_id=0,eth,ip,in_port=1,dl_src=00:0c:29:a0:27:a1,dl_dst=01:00:5e:01:01:01,nw_proto=2,nw_frag=no
Datapath actions: 3,2
This flow is handled by the userspace slow path because it:
  - Uses action(s) not supported by datapath.
])

AT_CHECK([ovs-vsctl set port p1 other_config:mcast-snooping-flood-reports=true])

AT_CHECK([ovs-appctl ofproto/trace "in_port(1)" '01005E010101000C29A027A108004500001C000100004002CBAEAC10221EE001010112140CE9E0010101'], [0], [dnl
Flow: ip,in_port=1,vlan_tci=0x0000,dl_src=00:0c:29:a0:27:a1,dl_dst=01:00:5e:01:01:01,nw_src=172.16.34.30,nw_dst=224.1.1.1,nw_proto=2,nw_tos=0,nw_ecn=0,nw_ttl=64,nw_frag=no,tp_src=18,tp_dst=20

bridge("br0")
-------------
 0. priority 32768
    NORMAL
     -> forwarding report to mcast flagged port
     -> forwarding report to mcast flagged port
     -> mcast port is input port, dropping the Report

Final flow: unchanged
Megaflow: recirc_id=0,eth,ip,in_port=1,dl_src=00:0c:29:a0:27:a1,dl_dst=01:00:5e:01:01:01,nw_proto=2,nw_frag=no
Datapath actions: 3,2
This flow is handled by the userspace slow path because it:
  - Uses action(s) not supported by datapath.
])

# Change p2 ofport to force a ofbundle change and check that the mdb contains
# no stale port.
AT_CHECK([ovs-vsctl set interface p3 ofport_request=4])

AT_CHECK([ovs-appctl ofproto/trace "in_port(1)" '01005E010101000C29A027A108004500001C000100004002CBAEAC10221EE001010112140CE9E0010101'], [0], [dnl
Flow: ip,in_port=1,vlan_tci=0x0000,dl_src=00:0c:29:a0:27:a1,dl_dst=01:00:5e:01:01:01,nw_src=172.16.34.30,nw_dst=224.1.1.1,nw_proto=2,nw_tos=0,nw_ecn=0,nw_ttl=64,nw_frag=no,tp_src=18,tp_dst=20

bridge("br0")
-------------
 0. priority 32768
    NORMAL
     -> forwarding report to mcast flagged port
     -> mcast port is input port, dropping the Report
     -> forwarding report to mcast flagged port

Final flow: unchanged
Megaflow: recirc_id=0,eth,ip,in_port=1,dl_src=00:0c:29:a0:27:a1,dl_dst=01:00:5e:01:01:01,nw_proto=2,nw_frag=no
Datapath actions: 2,3
This flow is handled by the userspace slow path because it:
  - Uses action(s) not supported by datapath.
])

OVS_VSWITCHD_STOP
AT_CLEANUP


AT_SETUP([mcast - delete the port mdb when vlan configuration changed])
OVS_VSWITCHD_START([])

AT_CHECK([
    ovs-vsctl set bridge br0 \
    datapath_type=dummy \
    mcast_snooping_enable=true \
    other-config:mcast-snooping-disable-flood-unregistered=false
], [0])

AT_CHECK([ovs-ofctl add-flow br0 action=normal])

AT_CHECK([
    ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy \
    other-config:hwaddr=aa:55:aa:55:00:01 ofport_request=1 \
    -- add-port br0 p2 \
    -- set Interface p2 type=dummy other-config:hwaddr=aa:55:aa:55:00:02 ofport_request=2 \
    -- add-port br0 p3 \
    -- set Interface p3 type=dummy other-config:hwaddr=aa:55:aa:55:00:03 ofport_request=3
], [0])

ovs-appctl time/stop

# Send report packets.
AT_CHECK([
    ovs-appctl netdev-dummy/receive p1  \
        '01005E010101000C29A027A18100000108004500001C000100004002CBAEAC10221EE001010112140CE9E0010101'
    ovs-appctl netdev-dummy/receive p1  \
        '01005E010101000C29A027A28100000208004500001C000100004002CBAEAC10221EE001010112140CE9E0010101'
], [0])

# Send query packets.
AT_CHECK([
    ovs-appctl netdev-dummy/receive p3  \
       '01005E010101000C29A027D18100000108004500001C000100004002CBCBAC102201E00101011114EEEB00000000'
    ovs-appctl netdev-dummy/receive p3  \
        '01005E010101000C29A027D28100000208004500001C000100004002CBCAAC102202E00101011114EEEB00000000'
], [0])

AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
 port  VLAN  protocol  GROUP                Age
    1     1  IGMPv1    224.1.1.1           0
    1     2  IGMPv1    224.1.1.1           0
    3     1  UNKNOWN   querier               0
    3     2  UNKNOWN   querier               0
])

AT_CHECK([ovs-vsctl set port p3 tag=2], [0])

AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
 port  VLAN  protocol  GROUP                Age
    1     1  IGMPv1    224.1.1.1           0
    1     2  IGMPv1    224.1.1.1           0
])

AT_CLEANUP

AT_SETUP([mcast - delete the port mdb when port destroyed])
OVS_VSWITCHD_START([])

AT_CHECK([
    ovs-vsctl set bridge br0 \
    datapath_type=dummy \
    mcast_snooping_enable=true \
    other-config:mcast-snooping-disable-flood-unregistered=false
], [0])

AT_CHECK([ovs-ofctl add-flow br0 action=normal])

AT_CHECK([
    ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy \
    other-config:hwaddr=aa:55:aa:55:00:01 ofport_request=1 \
    -- add-port br0 p2 \
    -- set Interface p2 type=dummy other-config:hwaddr=aa:55:aa:55:00:02 ofport_request=2 \
], [0])

ovs-appctl time/stop

# Send report packets.
AT_CHECK([
    ovs-appctl netdev-dummy/receive p1  \
        '01005E010101000C29A027A18100000108004500001C000100004002CBAEAC10221EE001010112140CE9E0010101'
    ovs-appctl netdev-dummy/receive p1  \
        '01005E010101000C29A027A28100000208004500001C000100004002CBAEAC10221EE001010112140CE9E0010101'
], [0])

# Send query packets.
AT_CHECK([
    ovs-appctl netdev-dummy/receive p2  \
       '01005E010101000C29A027D18100000108004500001C000100004002CBCBAC102201E00101011114EEEB00000000'
    ovs-appctl netdev-dummy/receive p2  \
        '01005E010101000C29A027D28100000208004500001C000100004002CBCAAC102202E00101011114EEEB00000000'
], [0])

AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
 port  VLAN  protocol  GROUP                Age
    1     1  IGMPv1    224.1.1.1           0
    1     2  IGMPv1    224.1.1.1           0
    2     1  UNKNOWN   querier               0
    2     2  UNKNOWN   querier               0
])

AT_CHECK([ovs-vsctl del-port br0 p2], [0])

AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
 port  VLAN  protocol  GROUP                Age
    1     1  IGMPv1    224.1.1.1           0
    1     2  IGMPv1    224.1.1.1           0
])

AT_CLEANUP


AT_SETUP([mcast - igmp flood for non-snoop enabled])
OVS_VSWITCHD_START([])

AT_CHECK([
    ovs-vsctl set bridge br0 \
    datapath_type=dummy], [0])

add_of_ports br0 1 2

AT_CHECK([ovs-ofctl add-flow br0 action=normal])

ovs-appctl time/stop

dnl Basic scenario - needs to flood for IGMP followed by unicast ICMP
dnl in reverse direction
AT_CHECK([ovs-appctl netdev-dummy/receive p1 \
    '0101000c29a0aa55aa550001080046c00028000040000102d3494565eb4ae0000016940400002200f9020000000104000000e00000fb000000000000'])
AT_CHECK([ovs-appctl netdev-dummy/receive p2 \
    'aa55aa5500010101000c29a008004500001c00010000400164dc0a0101010a0101020800f7ffffffffff'])


AT_CHECK([ovs-appctl dpctl/dump-flows | grep -e .*ipv4 | sort | dnl
          strip_stats | strip_used | strip_recirc | dnl
          sed -e 's/,packet_type(ns=[[0-9]]*,id=[[0-9]]*),/,/'],
                     [0], [dnl
recirc_id(<recirc>),in_port(1),eth(src=aa:55:aa:55:00:01,dst=01:01:00:0c:29:a0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:100,2
recirc_id(<recirc>),in_port(2),eth(src=01:01:00:0c:29:a0,dst=aa:55:aa:55:00:01),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:1
])

ovs-appctl time/warp 100000

dnl Next we should clear the flows and install a complex case
AT_CHECK([ovs-ofctl del-flows br0])

AT_DATA([flows.txt], [dnl
table=0, arp actions=NORMAL
table=0, ip,in_port=1 actions=ct(table=1,zone=64000)
table=0, in_port=2 actions=output:1
table=1, ip,ct_state=+trk+inv actions=drop
table=1  ip,in_port=1,icmp,ct_state=+trk+new actions=output:2
table=1, in_port=1,ip,ct_state=+trk+new actions=controller(userdata=00.de.ad.be.ef.ca.fe.01)
table=1, in_port=1,ip,ct_state=+trk+est actions=output:2
])
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])

ovs-appctl time/warp 100000

dnl Send the IGMP, followed by a unicast ICMP - ensure we won't black hole
AT_CHECK([ovs-appctl netdev-dummy/receive p1 \
    '0101000c29a0aa55aa550001080046c00028000040000102d3494565eb4ae0000016940400002200f9020000000104000000e00000fb000000000000'])
AT_CHECK([ovs-appctl netdev-dummy/receive p1 \
    'aa55aa550001aa55aa55000208004500001c00010000400164dc0a0101010a0101020800f7ffffffffff'])


AT_CHECK([ovs-appctl dpctl/dump-flows | grep -e .*ipv4 | sort | dnl
          strip_stats | strip_used | strip_recirc | dnl
          sed 's/pid=[[0-9]]*,//
               s/,packet_type(ns=[[0-9]]*,id=[[0-9]]*),/,/'],
                     [0], [dnl
recirc_id(<recirc>),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:0.0s, actions:ct(zone=64000),recirc(<recirc>)
recirc_id(<recirc>),in_port(1),ct_state(+new-inv+trk),eth_type(0x0800),ipv4(proto=1,frag=no), packets:0, bytes:0, used:never, actions:2
recirc_id(<recirc>),in_port(1),ct_state(+new-inv+trk),eth_type(0x0800),ipv4(proto=2,frag=no), packets:0, bytes:0, used:never, actions:userspace(controller(reason=1,dont_send=0,continuation=0,recirc_id=<recirc>,rule_cookie=0,controller_id=0,max_len=65535))
])

AT_CLEANUP

AT_SETUP([mcast - mcast_group protocol updated in mdb])
OVS_VSWITCHD_START([])

AT_CHECK([
    ovs-vsctl set bridge br0 \
    datapath_type=dummy \
    mcast_snooping_enable=true \
], [0])

AT_CHECK([ovs-ofctl add-flow br0 action=normal])

AT_CHECK([
    ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy \
    other-config:hwaddr=aa:55:aa:55:00:01 ofport_request=1 \
], [0])

AT_CHECK([ovs-appctl time/stop])

# Send IGMPv1 report packet.
AT_CHECK([
    ovs-appctl netdev-dummy/receive p1  \
        '01005E010101000C29A027A18100000008004500001C000100004002CBAEAC10221EE001010112140CE9E0010101'
], [0])

# Send IGMPv2 report packet.
AT_CHECK([
    ovs-appctl netdev-dummy/receive p1  \
        '01005e010102505400000103080046c00020000040000102f8110a000103e001010294040000160008fce0010102'
], [0])

# Send IGMPv3 report packet.
AT_CHECK([
    ovs-appctl netdev-dummy/receive p1  \
        '01005e000016505400000003080046c00028000040000102f9f60a000003e0000016940400002200e3e10000000104000000e9360ce6'
], [0])

# Check that all the ipv4 mcast groups were updated in
# the mdb with the appropriate protocol.
AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
 port  VLAN  protocol  GROUP                Age
    1     0  IGMPv1    224.1.1.1           0
    1     0  IGMPv2    224.1.1.2           0
    1     0  IGMPv3    233.54.12.230           0
])

# Send IGMPv1 report packet to address 224.1.1.2
# and make sure that the protocol will be updated to
# IGMPV1.
AT_CHECK([
    ovs-appctl netdev-dummy/receive p1  \
        '01005e010102505400000103080046c00020000040000102f8110a000103e00101029404000012000cfce0010102'
], [0])

AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
 port  VLAN  protocol  GROUP                Age
    1     0  IGMPv1    224.1.1.1           0
    1     0  IGMPv3    233.54.12.230           0
    1     0  IGMPv1    224.1.1.2           0
])

# Flush the mdb.
AT_CHECK([ovs-appctl mdb/flush br0], [0], [dnl
table successfully flushed
])

# Send MLDV2 packet.
AT_CHECK([ovs-appctl netdev-dummy/receive p1 \
'333300000016d0509956ddf986dd60000000001c3a01fe80000000000000712065589886fa88ff0200000000000000000000000000168f00134d0000000104000000ff0200000000000000000001ff52f3e1'])

# Send MLDV1 packet.
AT_CHECK([ovs-appctl netdev-dummy/receive p1 \
'3333ff0e4c67000c290e4c6786dd600000000020000100000000000000000000000000000000ff0200000000000000000001ff0e4c673a000502000001008300e7b800000000ff0200000000000000000001ff0e4c67'])

# Check that all the ipv6 mcast groups were updated in
# the mdb with the appropriate protocol.
AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
 port  VLAN  protocol  GROUP                Age
    1     0  MLDv2     ff02::1:ff52:f3e1           0
    1     0  MLDv1     ff02::1:ff0e:4c67           0
])
AT_CLEANUP