Skip to content

Commit 55939b2

Browse files
idoschdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0efe9ed commit 55939b2

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

tools/testing/selftests/net/forwarding/vxlan_bridge_1q.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export VXPORT
9595
test_flood
9696
test_unicast
9797
test_learning
98+
test_pvid
9899
"}
99100

100101
NUM_NETIFS=6
@@ -610,6 +611,75 @@ test_unicast()
610611
done
611612
}
612613

614+
test_pvid()
615+
{
616+
local -a expects=(0 0 0 0 0)
617+
local mac=de:ad:be:ef:13:37
618+
local dst=192.0.2.100
619+
local vid=10
620+
621+
# Check that flooding works
622+
RET=0
623+
624+
expects[0]=10; expects[1]=10; expects[3]=10
625+
vxlan_flood_test $mac $dst $vid "${expects[@]}"
626+
627+
log_test "VXLAN: flood before pvid off"
628+
629+
# Toggle PVID off and test that flood to remote hosts does not work
630+
RET=0
631+
632+
bridge vlan add vid 10 dev vx10
633+
634+
expects[0]=10; expects[1]=0; expects[3]=0
635+
vxlan_flood_test $mac $dst $vid "${expects[@]}"
636+
637+
log_test "VXLAN: flood after pvid off"
638+
639+
# Toggle PVID on and test that flood to remote hosts does work
640+
RET=0
641+
642+
bridge vlan add vid 10 dev vx10 pvid untagged
643+
644+
expects[0]=10; expects[1]=10; expects[3]=10
645+
vxlan_flood_test $mac $dst $vid "${expects[@]}"
646+
647+
log_test "VXLAN: flood after pvid on"
648+
649+
# Add a new VLAN and test that it does not affect flooding
650+
RET=0
651+
652+
bridge vlan add vid 30 dev vx10
653+
654+
expects[0]=10; expects[1]=10; expects[3]=10
655+
vxlan_flood_test $mac $dst $vid "${expects[@]}"
656+
657+
bridge vlan del vid 30 dev vx10
658+
659+
log_test "VXLAN: flood after vlan add"
660+
661+
# Remove currently mapped VLAN and test that flood to remote hosts does
662+
# not work
663+
RET=0
664+
665+
bridge vlan del vid 10 dev vx10
666+
667+
expects[0]=10; expects[1]=0; expects[3]=0
668+
vxlan_flood_test $mac $dst $vid "${expects[@]}"
669+
670+
log_test "VXLAN: flood after vlan delete"
671+
672+
# Re-add the VLAN and test that flood to remote hosts does work
673+
RET=0
674+
675+
bridge vlan add vid 10 dev vx10 pvid untagged
676+
677+
expects[0]=10; expects[1]=10; expects[3]=10
678+
vxlan_flood_test $mac $dst $vid "${expects[@]}"
679+
680+
log_test "VXLAN: flood after vlan re-add"
681+
}
682+
613683
vxlan_ping_test()
614684
{
615685
local ping_dev=$1; shift

0 commit comments

Comments
 (0)