Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: forwarding: Add PVID test case for VXLAN with VLAN-aware bridges

When using VLAN-aware bridges with VXLAN, the VLAN that is mapped to the
VNI of the VXLAN device is that which is configured as "pvid untagged"
on the corresponding bridge port.

When these flags are toggled or when the VLAN is deleted entirely,
remote hosts should not be able to receive packets from the VTEP.

Add a test case for above mentioned scenarios.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ido Schimmel and committed by
David S. Miller
55939b26 0efe9ed9

+70
+70
tools/testing/selftests/net/forwarding/vxlan_bridge_1q.sh
··· 95 95 test_flood 96 96 test_unicast 97 97 test_learning 98 + test_pvid 98 99 "} 99 100 100 101 NUM_NETIFS=6 ··· 609 608 for target in "${targets[@]}"; do 610 609 vxlan_fdb_add_del del 20 $target 611 610 done 611 + } 612 + 613 + test_pvid() 614 + { 615 + local -a expects=(0 0 0 0 0) 616 + local mac=de:ad:be:ef:13:37 617 + local dst=192.0.2.100 618 + local vid=10 619 + 620 + # Check that flooding works 621 + RET=0 622 + 623 + expects[0]=10; expects[1]=10; expects[3]=10 624 + vxlan_flood_test $mac $dst $vid "${expects[@]}" 625 + 626 + log_test "VXLAN: flood before pvid off" 627 + 628 + # Toggle PVID off and test that flood to remote hosts does not work 629 + RET=0 630 + 631 + bridge vlan add vid 10 dev vx10 632 + 633 + expects[0]=10; expects[1]=0; expects[3]=0 634 + vxlan_flood_test $mac $dst $vid "${expects[@]}" 635 + 636 + log_test "VXLAN: flood after pvid off" 637 + 638 + # Toggle PVID on and test that flood to remote hosts does work 639 + RET=0 640 + 641 + bridge vlan add vid 10 dev vx10 pvid untagged 642 + 643 + expects[0]=10; expects[1]=10; expects[3]=10 644 + vxlan_flood_test $mac $dst $vid "${expects[@]}" 645 + 646 + log_test "VXLAN: flood after pvid on" 647 + 648 + # Add a new VLAN and test that it does not affect flooding 649 + RET=0 650 + 651 + bridge vlan add vid 30 dev vx10 652 + 653 + expects[0]=10; expects[1]=10; expects[3]=10 654 + vxlan_flood_test $mac $dst $vid "${expects[@]}" 655 + 656 + bridge vlan del vid 30 dev vx10 657 + 658 + log_test "VXLAN: flood after vlan add" 659 + 660 + # Remove currently mapped VLAN and test that flood to remote hosts does 661 + # not work 662 + RET=0 663 + 664 + bridge vlan del vid 10 dev vx10 665 + 666 + expects[0]=10; expects[1]=0; expects[3]=0 667 + vxlan_flood_test $mac $dst $vid "${expects[@]}" 668 + 669 + log_test "VXLAN: flood after vlan delete" 670 + 671 + # Re-add the VLAN and test that flood to remote hosts does work 672 + RET=0 673 + 674 + bridge vlan add vid 10 dev vx10 pvid untagged 675 + 676 + expects[0]=10; expects[1]=10; expects[3]=10 677 + vxlan_flood_test $mac $dst $vid "${expects[@]}" 678 + 679 + log_test "VXLAN: flood after vlan re-add" 612 680 } 613 681 614 682 vxlan_ping_test()