2 # SPDX-License-Identifier: GPL-2.0
4 # Test various aspects of VxLAN offloading which are specific to mlxsw, such
5 # as sanitization of invalid configurations and offload indication.
7 lib_dir
=$
(dirname $0)/..
/..
/..
/net
/forwarding
9 ALL_TESTS
="sanitization_test offload_indication_test \
10 sanitization_vlan_aware_test offload_indication_vlan_aware_test"
12 : ${TIMEOUT:=20000} # ms
13 source $lib_dir/lib.sh
20 ip link
set dev
$swp1 up
21 ip link
set dev
$swp2 up
28 ip link
set dev
$swp2 down
29 ip link
set dev
$swp1 down
32 sanitization_single_dev_test_pass
()
34 ip link
set dev
$swp1 master br0
36 ip link
set dev vxlan0 master br0
39 ip link
set dev
$swp1 nomaster
41 ip link
set dev
$swp1 master br0
45 sanitization_single_dev_test_fail
()
47 ip link
set dev
$swp1 master br0
49 ip link
set dev vxlan0 master br0
&> /dev
/null
52 ip link
set dev
$swp1 nomaster
54 ip link
set dev vxlan0 master br0
56 ip link
set dev
$swp1 master br0
&> /dev
/null
60 sanitization_single_dev_valid_test
()
64 ip link add dev br0
type bridge mcast_snooping
0
66 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
67 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
69 sanitization_single_dev_test_pass
71 ip link del dev vxlan0
74 log_test
"vxlan device - valid configuration"
77 sanitization_single_dev_vlan_aware_test
()
81 ip link add dev br0
type bridge mcast_snooping
0 vlan_filtering
1
83 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
84 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
86 sanitization_single_dev_test_pass
88 ip link del dev vxlan0
91 log_test
"vxlan device with a vlan-aware bridge"
94 sanitization_single_dev_mcast_enabled_test
()
98 ip link add dev br0
type bridge
100 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
101 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
103 sanitization_single_dev_test_fail
105 ip link del dev vxlan0
108 log_test
"vxlan device with a multicast enabled bridge"
111 sanitization_single_dev_mcast_group_test
()
115 ip link add dev br0
type bridge mcast_snooping
0
116 ip link add name dummy1 up
type dummy
118 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
119 ttl
20 tos inherit
local 198.51.100.1 dstport
4789 \
120 dev dummy1 group
239.0.0.1
122 sanitization_single_dev_test_fail
124 ip link del dev vxlan0
125 ip link del dev dummy1
128 log_test
"vxlan device with a multicast group"
131 sanitization_single_dev_no_local_ip_test
()
135 ip link add dev br0
type bridge mcast_snooping
0
137 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
138 ttl
20 tos inherit dstport
4789
140 sanitization_single_dev_test_fail
142 ip link del dev vxlan0
145 log_test
"vxlan device with no local ip"
148 sanitization_single_dev_local_ipv6_test
()
152 ip link add dev br0
type bridge mcast_snooping
0
154 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
155 ttl
20 tos inherit
local 2001:db8
::1 dstport
4789
157 sanitization_single_dev_test_fail
159 ip link del dev vxlan0
162 log_test
"vxlan device with local ipv6 address"
165 sanitization_single_dev_learning_enabled_test
()
169 ip link add dev br0
type bridge mcast_snooping
0
171 ip link add name vxlan0 up
type vxlan id
10 learning noudpcsum \
172 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
174 sanitization_single_dev_test_pass
176 ip link del dev vxlan0
179 log_test
"vxlan device with learning enabled"
182 sanitization_single_dev_local_interface_test
()
186 ip link add dev br0
type bridge mcast_snooping
0
187 ip link add name dummy1 up
type dummy
189 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
190 ttl
20 tos inherit
local 198.51.100.1 dstport
4789 dev dummy1
192 sanitization_single_dev_test_fail
194 ip link del dev vxlan0
195 ip link del dev dummy1
198 log_test
"vxlan device with local interface"
201 sanitization_single_dev_port_range_test
()
205 ip link add dev br0
type bridge mcast_snooping
0
207 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
208 ttl
20 tos inherit
local 198.51.100.1 dstport
4789 \
211 sanitization_single_dev_test_fail
213 ip link del dev vxlan0
216 log_test
"vxlan device with udp source port range"
219 sanitization_single_dev_tos_static_test
()
223 ip link add dev br0
type bridge mcast_snooping
0
225 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
226 ttl
20 tos
20 local 198.51.100.1 dstport
4789
228 sanitization_single_dev_test_fail
230 ip link del dev vxlan0
233 log_test
"vxlan device with static tos"
236 sanitization_single_dev_ttl_inherit_test
()
240 ip link add dev br0
type bridge mcast_snooping
0
242 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
243 ttl inherit tos inherit
local 198.51.100.1 dstport
4789
245 sanitization_single_dev_test_fail
247 ip link del dev vxlan0
250 log_test
"vxlan device with inherit ttl"
253 sanitization_single_dev_udp_checksum_test
()
257 ip link add dev br0
type bridge mcast_snooping
0
259 ip link add name vxlan0 up
type vxlan id
10 nolearning udpcsum \
260 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
262 sanitization_single_dev_test_fail
264 ip link del dev vxlan0
267 log_test
"vxlan device with udp checksum"
270 sanitization_single_dev_test
()
272 # These tests make sure that we correctly sanitize VxLAN device
273 # configurations we do not support
274 sanitization_single_dev_valid_test
275 sanitization_single_dev_vlan_aware_test
276 sanitization_single_dev_mcast_enabled_test
277 sanitization_single_dev_mcast_group_test
278 sanitization_single_dev_no_local_ip_test
279 sanitization_single_dev_local_ipv6_test
280 sanitization_single_dev_learning_enabled_test
281 sanitization_single_dev_local_interface_test
282 sanitization_single_dev_port_range_test
283 sanitization_single_dev_tos_static_test
284 sanitization_single_dev_ttl_inherit_test
285 sanitization_single_dev_udp_checksum_test
288 sanitization_multi_devs_test_pass
()
290 ip link
set dev
$swp1 master br0
292 ip link
set dev vxlan0 master br0
294 ip link
set dev
$swp2 master br1
296 ip link
set dev vxlan1 master br1
299 ip link
set dev
$swp2 nomaster
300 ip link
set dev
$swp1 nomaster
302 ip link
set dev
$swp1 master br0
304 ip link
set dev
$swp2 master br1
308 sanitization_multi_devs_test_fail
()
310 ip link
set dev
$swp1 master br0
312 ip link
set dev vxlan0 master br0
314 ip link
set dev
$swp2 master br1
316 ip link
set dev vxlan1 master br1
&> /dev
/null
319 ip link
set dev
$swp2 nomaster
320 ip link
set dev
$swp1 nomaster
322 ip link
set dev vxlan1 master br1
324 ip link
set dev
$swp1 master br0
326 ip link
set dev
$swp2 master br1
&> /dev
/null
330 sanitization_multi_devs_valid_test
()
334 ip link add dev br0
type bridge mcast_snooping
0
335 ip link add dev br1
type bridge mcast_snooping
0
337 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
338 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
339 ip link add name vxlan1 up
type vxlan id
20 nolearning noudpcsum \
340 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
342 sanitization_multi_devs_test_pass
344 ip link del dev vxlan1
345 ip link del dev vxlan0
349 log_test
"multiple vxlan devices - valid configuration"
352 sanitization_multi_devs_ttl_test
()
356 ip link add dev br0
type bridge mcast_snooping
0
357 ip link add dev br1
type bridge mcast_snooping
0
359 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
360 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
361 ip link add name vxlan1 up
type vxlan id
20 nolearning noudpcsum \
362 ttl
40 tos inherit
local 198.51.100.1 dstport
4789
364 sanitization_multi_devs_test_fail
366 ip link del dev vxlan1
367 ip link del dev vxlan0
371 log_test
"multiple vxlan devices with different ttl"
374 sanitization_multi_devs_udp_dstport_test
()
378 ip link add dev br0
type bridge mcast_snooping
0
379 ip link add dev br1
type bridge mcast_snooping
0
381 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
382 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
383 ip link add name vxlan1 up
type vxlan id
20 nolearning noudpcsum \
384 ttl
20 tos inherit
local 198.51.100.1 dstport
5789
386 sanitization_multi_devs_test_fail
388 ip link del dev vxlan1
389 ip link del dev vxlan0
393 log_test
"multiple vxlan devices with different udp destination port"
396 sanitization_multi_devs_local_ip_test
()
400 ip link add dev br0
type bridge mcast_snooping
0
401 ip link add dev br1
type bridge mcast_snooping
0
403 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
404 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
405 ip link add name vxlan1 up
type vxlan id
20 nolearning noudpcsum \
406 ttl
20 tos inherit
local 198.51.100.2 dstport
4789
408 sanitization_multi_devs_test_fail
410 ip link del dev vxlan1
411 ip link del dev vxlan0
415 log_test
"multiple vxlan devices with different local ip"
418 sanitization_multi_devs_test
()
420 # The device has a single VTEP, which means all the VxLAN devices
421 # we offload must share certain properties such as source IP and
422 # UDP destination port. These tests make sure that we forbid
423 # configurations that violate this limitation
424 sanitization_multi_devs_valid_test
425 sanitization_multi_devs_ttl_test
426 sanitization_multi_devs_udp_dstport_test
427 sanitization_multi_devs_local_ip_test
432 sanitization_single_dev_test
433 sanitization_multi_devs_test
436 offload_indication_setup_create
()
438 # Create a simple setup with two bridges, each with a VxLAN device
440 ip link add name br0 up
type bridge mcast_snooping
0
441 ip link add name br1 up
type bridge mcast_snooping
0
443 ip link
set dev
$swp1 master br0
444 ip link
set dev
$swp2 master br1
446 ip address add
198.51.100.1/32 dev lo
448 ip link add name vxlan0 up master br0
type vxlan id
10 nolearning \
449 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
450 ip link add name vxlan1 up master br1
type vxlan id
20 nolearning \
451 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
454 offload_indication_setup_destroy
()
456 ip link del dev vxlan1
457 ip link del dev vxlan0
459 ip address del
198.51.100.1/32 dev lo
461 ip link
set dev
$swp2 nomaster
462 ip link
set dev
$swp1 nomaster
468 offload_indication_fdb_flood_test
()
472 bridge fdb append
00:00:00:00:00:00 dev vxlan0 self dst
198.51.100.2
474 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb
00:00:00:00:00:00 \
475 bridge fdb show brport vxlan0
478 bridge fdb del
00:00:00:00:00:00 dev vxlan0 self
480 log_test
"vxlan flood entry offload indication"
483 offload_indication_fdb_bridge_test
()
487 bridge fdb add de
:ad
:be
:ef
:13:37 dev vxlan0 self master static \
490 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb \
491 de
:ad
:be
:ef
:13:37 self bridge fdb show brport vxlan0
493 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb \
494 de
:ad
:be
:ef
:13:37 self
-v bridge fdb show brport vxlan0
497 log_test
"vxlan entry offload indication - initial state"
499 # Remove FDB entry from the bridge driver and check that corresponding
500 # entry in the VxLAN driver is not marked as offloaded
503 bridge fdb del de
:ad
:be
:ef
:13:37 dev vxlan0 master
504 busywait
"$TIMEOUT" not wait_for_offload grep_bridge_fdb \
505 de
:ad
:be
:ef
:13:37 self bridge fdb show brport vxlan0
508 log_test
"vxlan entry offload indication - after removal from bridge"
510 # Add the FDB entry back to the bridge driver and make sure it is
511 # marked as offloaded in both drivers
514 bridge fdb add de
:ad
:be
:ef
:13:37 dev vxlan0 master static
515 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb \
516 de
:ad
:be
:ef
:13:37 self bridge fdb show brport vxlan0
518 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb \
519 de
:ad
:be
:ef
:13:37 self
-v bridge fdb show brport vxlan0
522 log_test
"vxlan entry offload indication - after re-add to bridge"
524 # Remove FDB entry from the VxLAN driver and check that corresponding
525 # entry in the bridge driver is not marked as offloaded
528 bridge fdb del de
:ad
:be
:ef
:13:37 dev vxlan0 self
529 busywait
"$TIMEOUT" not wait_for_offload grep_bridge_fdb \
530 de
:ad
:be
:ef
:13:37 self
-v bridge fdb show brport vxlan0
533 log_test
"vxlan entry offload indication - after removal from vxlan"
535 # Add the FDB entry back to the VxLAN driver and make sure it is
536 # marked as offloaded in both drivers
539 bridge fdb add de
:ad
:be
:ef
:13:37 dev vxlan0 self dst
198.51.100.2
540 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb \
541 de
:ad
:be
:ef
:13:37 self bridge fdb show brport vxlan0
543 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb \
544 de
:ad
:be
:ef
:13:37 self
-v bridge fdb show brport vxlan0
547 log_test
"vxlan entry offload indication - after re-add to vxlan"
549 bridge fdb del de
:ad
:be
:ef
:13:37 dev vxlan0 self master
552 offload_indication_fdb_test
()
554 offload_indication_fdb_flood_test
555 offload_indication_fdb_bridge_test
558 offload_indication_decap_route_test
()
562 busywait
"$TIMEOUT" wait_for_offload \
563 ip route show table
local 198.51.100.1
566 ip link
set dev vxlan0 down
567 busywait
"$TIMEOUT" wait_for_offload \
568 ip route show table
local 198.51.100.1
571 ip link
set dev vxlan1 down
572 busywait
"$TIMEOUT" not wait_for_offload \
573 ip route show table
local 198.51.100.1
576 log_test
"vxlan decap route - vxlan device down"
580 ip link
set dev vxlan1 up
581 busywait
"$TIMEOUT" wait_for_offload \
582 ip route show table
local 198.51.100.1
585 ip link
set dev vxlan0 up
586 busywait
"$TIMEOUT" wait_for_offload \
587 ip route show table
local 198.51.100.1
590 log_test
"vxlan decap route - vxlan device up"
594 ip address delete
198.51.100.1/32 dev lo
595 busywait
"$TIMEOUT" not wait_for_offload \
596 ip route show table
local 198.51.100.1
599 ip address add
198.51.100.1/32 dev lo
600 busywait
"$TIMEOUT" wait_for_offload \
601 ip route show table
local 198.51.100.1
604 log_test
"vxlan decap route - add local route"
608 ip link
set dev
$swp1 nomaster
609 busywait
"$TIMEOUT" wait_for_offload \
610 ip route show table
local 198.51.100.1
613 ip link
set dev
$swp2 nomaster
614 busywait
"$TIMEOUT" not wait_for_offload \
615 ip route show table
local 198.51.100.1
618 ip link
set dev
$swp1 master br0
619 ip link
set dev
$swp2 master br1
620 busywait
"$TIMEOUT" wait_for_offload \
621 ip route show table
local 198.51.100.1
624 log_test
"vxlan decap route - local ports enslavement"
629 busywait
"$TIMEOUT" wait_for_offload \
630 ip route show table
local 198.51.100.1
634 busywait
"$TIMEOUT" not wait_for_offload \
635 ip route show table
local 198.51.100.1
638 log_test
"vxlan decap route - bridge device deletion"
642 ip link add name br0 up
type bridge mcast_snooping
0
643 ip link add name br1 up
type bridge mcast_snooping
0
644 ip link
set dev
$swp1 master br0
645 ip link
set dev
$swp2 master br1
646 ip link
set dev vxlan0 master br0
647 ip link
set dev vxlan1 master br1
648 busywait
"$TIMEOUT" wait_for_offload \
649 ip route show table
local 198.51.100.1
652 ip link del dev vxlan0
653 busywait
"$TIMEOUT" wait_for_offload \
654 ip route show table
local 198.51.100.1
657 ip link del dev vxlan1
658 busywait
"$TIMEOUT" not wait_for_offload \
659 ip route show table
local 198.51.100.1
662 log_test
"vxlan decap route - vxlan device deletion"
664 ip link add name vxlan0 up master br0
type vxlan id
10 nolearning \
665 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
666 ip link add name vxlan1 up master br1
type vxlan id
20 nolearning \
667 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
670 check_fdb_offloaded
()
672 local mac
=00:11:22:33:44:55
673 local zmac
=00:00:00:00:00:00
675 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb
$mac self \
676 bridge fdb show dev vxlan0
678 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb
$mac master \
679 bridge fdb show dev vxlan0
682 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb
$zmac self \
683 bridge fdb show dev vxlan0
687 check_vxlan_fdb_not_offloaded
()
689 local mac
=00:11:22:33:44:55
690 local zmac
=00:00:00:00:00:00
692 bridge fdb show dev vxlan0 |
grep $mac |
grep -q self
694 busywait
"$TIMEOUT" not wait_for_offload grep_bridge_fdb
$mac self \
695 bridge fdb show dev vxlan0
698 bridge fdb show dev vxlan0 |
grep $zmac |
grep -q self
700 busywait
"$TIMEOUT" not wait_for_offload grep_bridge_fdb
$zmac self \
701 bridge fdb show dev vxlan0
705 check_bridge_fdb_not_offloaded
()
707 local mac
=00:11:22:33:44:55
708 local zmac
=00:00:00:00:00:00
710 bridge fdb show dev vxlan0 |
grep $mac |
grep -q master
712 busywait
"$TIMEOUT" not wait_for_offload grep_bridge_fdb
$mac master \
713 bridge fdb show dev vxlan0
717 __offload_indication_join_vxlan_first
()
721 local mac
=00:11:22:33:44:55
722 local zmac
=00:00:00:00:00:00
724 bridge fdb append
$zmac dev vxlan0 self dst
198.51.100.2
726 ip link
set dev vxlan0 master br0
727 bridge fdb add dev vxlan0
$mac self master static dst
198.51.100.2
730 check_vxlan_fdb_not_offloaded
731 ip link
set dev
$swp1 master br0
734 log_test
"offload indication - attach vxlan first"
737 ip link
set dev vxlan0 down
738 check_vxlan_fdb_not_offloaded
739 check_bridge_fdb_not_offloaded
740 log_test
"offload indication - set vxlan down"
743 ip link
set dev vxlan0 up
746 log_test
"offload indication - set vxlan up"
748 if [[ ! -z $vid ]]; then
750 bridge vlan del dev vxlan0 vid
$vid
751 check_vxlan_fdb_not_offloaded
752 check_bridge_fdb_not_offloaded
753 log_test
"offload indication - delete VLAN"
756 bridge vlan add dev vxlan0 vid
$vid
757 check_vxlan_fdb_not_offloaded
758 check_bridge_fdb_not_offloaded
759 log_test
"offload indication - add tagged VLAN"
762 bridge vlan add dev vxlan0 vid
$vid pvid untagged
765 log_test
"offload indication - add pvid/untagged VLAN"
769 ip link
set dev
$swp1 nomaster
770 check_vxlan_fdb_not_offloaded
771 log_test
"offload indication - detach port"
774 offload_indication_join_vxlan_first
()
776 ip link add dev br0 up
type bridge mcast_snooping
0
777 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
778 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
780 __offload_indication_join_vxlan_first
782 ip link del dev vxlan0
786 __offload_indication_join_vxlan_last
()
788 local zmac
=00:00:00:00:00:00
792 bridge fdb append
$zmac dev vxlan0 self dst
198.51.100.2
794 ip link
set dev
$swp1 master br0
796 busywait
"$TIMEOUT" not wait_for_offload grep_bridge_fdb
$zmac self \
797 bridge fdb show dev vxlan0
800 ip link
set dev vxlan0 master br0
802 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb
$zmac self \
803 bridge fdb show dev vxlan0
806 log_test
"offload indication - attach vxlan last"
809 offload_indication_join_vxlan_last
()
811 ip link add dev br0 up
type bridge mcast_snooping
0
812 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
813 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
815 __offload_indication_join_vxlan_last
817 ip link del dev vxlan0
821 offload_indication_test
()
823 offload_indication_setup_create
824 offload_indication_fdb_test
825 offload_indication_decap_route_test
826 offload_indication_setup_destroy
828 log_info
"offload indication - replay & cleanup"
829 offload_indication_join_vxlan_first
830 offload_indication_join_vxlan_last
833 sanitization_vlan_aware_test
()
837 ip link add dev br0
type bridge mcast_snooping
0 vlan_filtering
1
839 ip link add name vxlan10 up master br0
type vxlan id
10 nolearning \
840 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
842 ip link add name vxlan20 up master br0
type vxlan id
20 nolearning \
843 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
845 # Test that when each VNI is mapped to a different VLAN we can enslave
846 # a port to the bridge
847 bridge vlan add vid
10 dev vxlan10 pvid untagged
848 bridge vlan add vid
20 dev vxlan20 pvid untagged
850 ip link
set dev
$swp1 master br0
853 log_test
"vlan-aware - enslavement to vlan-aware bridge"
855 # Try to map both VNIs to the same VLAN and make sure configuration
859 bridge vlan add vid
10 dev vxlan20 pvid untagged
&> /dev
/null
862 log_test
"vlan-aware - two vnis mapped to the same vlan"
864 # Test that enslavement of a port to a bridge fails when two VNIs
865 # are mapped to the same VLAN
868 ip link
set dev
$swp1 nomaster
870 bridge vlan del vid
20 dev vxlan20 pvid untagged
871 bridge vlan add vid
10 dev vxlan20 pvid untagged
873 ip link
set dev
$swp1 master br0
&> /dev
/null
876 log_test
"vlan-aware - failed enslavement to vlan-aware bridge"
878 bridge vlan del vid
10 dev vxlan20
879 bridge vlan add vid
20 dev vxlan20 pvid untagged
881 # Test that when two VXLAN tunnels with conflicting configurations
882 # (i.e., different TTL) are enslaved to the same VLAN-aware bridge,
883 # then the enslavement of a port to the bridge is denied.
885 # Use the offload indication of the local route to ensure the VXLAN
886 # configuration was correctly rollbacked.
887 ip address add
198.51.100.1/32 dev lo
889 ip link
set dev vxlan10
type vxlan ttl
10
890 ip link
set dev
$swp1 master br0
&> /dev
/null
893 busywait
"$TIMEOUT" not wait_for_offload \
894 ip route show table
local 198.51.100.1
897 log_test
"vlan-aware - failed enslavement to bridge due to conflict"
899 ip link
set dev vxlan10
type vxlan ttl
20
900 ip address del
198.51.100.1/32 dev lo
902 ip link del dev vxlan20
903 ip link del dev vxlan10
907 offload_indication_vlan_aware_setup_create
()
909 # Create a simple setup with two VxLAN devices and a single VLAN-aware
911 ip link add name br0 up
type bridge mcast_snooping
0 vlan_filtering
1 \
914 ip link
set dev
$swp1 master br0
916 bridge vlan add vid
10 dev
$swp1
917 bridge vlan add vid
20 dev
$swp1
919 ip address add
198.51.100.1/32 dev lo
921 ip link add name vxlan10 up master br0
type vxlan id
10 nolearning \
922 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
923 ip link add name vxlan20 up master br0
type vxlan id
20 nolearning \
924 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
926 bridge vlan add vid
10 dev vxlan10 pvid untagged
927 bridge vlan add vid
20 dev vxlan20 pvid untagged
930 offload_indication_vlan_aware_setup_destroy
()
932 bridge vlan del vid
20 dev vxlan20
933 bridge vlan del vid
10 dev vxlan10
935 ip link del dev vxlan20
936 ip link del dev vxlan10
938 ip address del
198.51.100.1/32 dev lo
940 bridge vlan del vid
20 dev
$swp1
941 bridge vlan del vid
10 dev
$swp1
943 ip link
set dev
$swp1 nomaster
948 offload_indication_vlan_aware_fdb_test
()
952 log_info
"vxlan entry offload indication - vlan-aware"
954 bridge fdb add de
:ad
:be
:ef
:13:37 dev vxlan10 self master static \
955 dst
198.51.100.2 vlan
10
957 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb \
958 de
:ad
:be
:ef
:13:37 self bridge fdb show brport vxlan10
960 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb \
961 de
:ad
:be
:ef
:13:37 self
-v bridge fdb show brport vxlan10
964 log_test
"vxlan entry offload indication - initial state"
966 # Remove FDB entry from the bridge driver and check that corresponding
967 # entry in the VxLAN driver is not marked as offloaded
970 bridge fdb del de
:ad
:be
:ef
:13:37 dev vxlan10 master vlan
10
971 busywait
"$TIMEOUT" not wait_for_offload grep_bridge_fdb \
972 de
:ad
:be
:ef
:13:37 self bridge fdb show brport vxlan10
975 log_test
"vxlan entry offload indication - after removal from bridge"
977 # Add the FDB entry back to the bridge driver and make sure it is
978 # marked as offloaded in both drivers
981 bridge fdb add de
:ad
:be
:ef
:13:37 dev vxlan10 master static vlan
10
982 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb \
983 de
:ad
:be
:ef
:13:37 self bridge fdb show brport vxlan10
985 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb \
986 de
:ad
:be
:ef
:13:37 self
-v bridge fdb show brport vxlan10
989 log_test
"vxlan entry offload indication - after re-add to bridge"
991 # Remove FDB entry from the VxLAN driver and check that corresponding
992 # entry in the bridge driver is not marked as offloaded
995 bridge fdb del de
:ad
:be
:ef
:13:37 dev vxlan10 self
996 busywait
"$TIMEOUT" not wait_for_offload grep_bridge_fdb \
997 de
:ad
:be
:ef
:13:37 self
-v bridge fdb show brport vxlan10
1000 log_test
"vxlan entry offload indication - after removal from vxlan"
1002 # Add the FDB entry back to the VxLAN driver and make sure it is
1003 # marked as offloaded in both drivers
1006 bridge fdb add de
:ad
:be
:ef
:13:37 dev vxlan10 self dst
198.51.100.2
1007 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb \
1008 de
:ad
:be
:ef
:13:37 self bridge fdb show brport vxlan10
1010 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb \
1011 de
:ad
:be
:ef
:13:37 self
-v bridge fdb show brport vxlan10
1014 log_test
"vxlan entry offload indication - after re-add to vxlan"
1016 bridge fdb del de
:ad
:be
:ef
:13:37 dev vxlan10 self master vlan
10
1019 offload_indication_vlan_aware_decap_route_test
()
1023 busywait
"$TIMEOUT" wait_for_offload \
1024 ip route show table
local 198.51.100.1
1027 # Toggle PVID flag on one VxLAN device and make sure route is still
1028 # marked as offloaded
1029 bridge vlan add vid
10 dev vxlan10 untagged
1031 busywait
"$TIMEOUT" wait_for_offload \
1032 ip route show table
local 198.51.100.1
1035 # Toggle PVID flag on second VxLAN device and make sure route is no
1036 # longer marked as offloaded
1037 bridge vlan add vid
20 dev vxlan20 untagged
1039 busywait
"$TIMEOUT" not wait_for_offload \
1040 ip route show table
local 198.51.100.1
1043 # Toggle PVID flag back and make sure route is marked as offloaded
1044 bridge vlan add vid
10 dev vxlan10 pvid untagged
1045 bridge vlan add vid
20 dev vxlan20 pvid untagged
1047 busywait
"$TIMEOUT" wait_for_offload ip route show table
local 198.51.100.1
1050 log_test
"vxlan decap route - vni map/unmap"
1053 offload_indication_vlan_aware_join_vxlan_first
()
1055 ip link add dev br0 up
type bridge mcast_snooping
0 \
1056 vlan_filtering
1 vlan_default_pvid
1
1057 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
1058 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
1060 __offload_indication_join_vxlan_first
1
1062 ip link del dev vxlan0
1066 offload_indication_vlan_aware_join_vxlan_last
()
1068 ip link add dev br0 up
type bridge mcast_snooping
0 \
1069 vlan_filtering
1 vlan_default_pvid
1
1070 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
1071 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
1073 __offload_indication_join_vxlan_last
1075 ip link del dev vxlan0
1079 offload_indication_vlan_aware_l3vni_test
()
1081 local zmac
=00:00:00:00:00:00
1085 sysctl_set net.ipv6.conf.default.disable_ipv6
1
1086 ip link add dev br0 up
type bridge mcast_snooping
0 \
1087 vlan_filtering
1 vlan_default_pvid
0
1088 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
1089 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
1091 ip link
set dev
$swp1 master br0
1093 # The test will use the offload indication on the FDB entry to
1094 # understand if the tunnel is offloaded or not
1095 bridge fdb append
$zmac dev vxlan0 self dst
192.0.2.1
1097 ip link
set dev vxlan0 master br0
1098 bridge vlan add dev vxlan0 vid
10 pvid untagged
1100 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb
$zmac self \
1101 bridge fdb show brport vxlan0
1102 check_err $?
"vxlan tunnel not offloaded when should"
1104 # Configure a VLAN interface and make sure tunnel is offloaded
1105 ip link add link br0 name br10 up
type vlan id
10
1106 sysctl_set net.ipv6.conf.br10.disable_ipv6
0
1107 ip
-6 address add
2001:db8
:1::1/64 dev br10
1108 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb
$zmac self \
1109 bridge fdb show brport vxlan0
1110 check_err $?
"vxlan tunnel not offloaded when should"
1112 # Unlink the VXLAN device, make sure tunnel is no longer offloaded,
1113 # then add it back to the bridge and make sure it is offloaded
1114 ip link
set dev vxlan0 nomaster
1115 busywait
"$TIMEOUT" not wait_for_offload grep_bridge_fdb
$zmac self \
1116 bridge fdb show brport vxlan0
1117 check_err $?
"vxlan tunnel offloaded after unlinked from bridge"
1119 ip link
set dev vxlan0 master br0
1120 busywait
"$TIMEOUT" not wait_for_offload grep_bridge_fdb
$zmac self \
1121 bridge fdb show brport vxlan0
1122 check_err $?
"vxlan tunnel offloaded despite no matching vid"
1124 bridge vlan add dev vxlan0 vid
10 pvid untagged
1125 busywait
"$TIMEOUT" wait_for_offload grep_bridge_fdb
$zmac self \
1126 bridge fdb show brport vxlan0
1127 check_err $?
"vxlan tunnel not offloaded after adding vid"
1129 log_test
"vxlan - l3 vni"
1131 ip link del dev vxlan0
1133 sysctl_restore net.ipv6.conf.default.disable_ipv6
1136 offload_indication_vlan_aware_test
()
1138 offload_indication_vlan_aware_setup_create
1139 offload_indication_vlan_aware_fdb_test
1140 offload_indication_vlan_aware_decap_route_test
1141 offload_indication_vlan_aware_setup_destroy
1143 log_info
"offload indication - replay & cleanup - vlan aware"
1144 offload_indication_vlan_aware_join_vxlan_first
1145 offload_indication_vlan_aware_join_vxlan_last
1146 offload_indication_vlan_aware_l3vni_test