Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/bash
0002 # SPDX-License-Identifier: GPL-2.0
0003 
0004 # This test uses standard topology for testing gretap. See
0005 # mirror_gre_topo_lib.sh for more details.
0006 #
0007 # Test for "tc action mirred egress mirror" that mirrors to a gretap netdevice
0008 # whose underlay route points at a vlan device.
0009 
0010 ALL_TESTS="
0011         test_gretap
0012 "
0013 
0014 NUM_NETIFS=6
0015 source lib.sh
0016 source mirror_lib.sh
0017 source mirror_gre_lib.sh
0018 source mirror_gre_topo_lib.sh
0019 
0020 setup_prepare()
0021 {
0022         h1=${NETIFS[p1]}
0023         swp1=${NETIFS[p2]}
0024 
0025         swp2=${NETIFS[p3]}
0026         h2=${NETIFS[p4]}
0027 
0028         swp3=${NETIFS[p5]}
0029         h3=${NETIFS[p6]}
0030 
0031         vrf_prepare
0032         mirror_gre_topo_create
0033 
0034         ip link add name $swp3.555 link $swp3 type vlan id 555
0035         ip address add dev $swp3.555 192.0.2.129/32
0036         ip address add dev $swp3.555 2001:db8:2::1/128
0037         ip link set dev $swp3.555 up
0038 
0039         ip route add 192.0.2.130/32 dev $swp3.555
0040         ip -6 route add 2001:db8:2::2/128 dev $swp3.555
0041 
0042         ip link add name $h3.555 link $h3 type vlan id 555
0043         ip link set dev $h3.555 master v$h3
0044         ip address add dev $h3.555 192.0.2.130/28
0045         ip address add dev $h3.555 2001:db8:2::2/64
0046         ip link set dev $h3.555 up
0047 }
0048 
0049 cleanup()
0050 {
0051         pre_cleanup
0052 
0053         ip link del dev $h3.555
0054         ip link del dev $swp3.555
0055 
0056         mirror_gre_topo_destroy
0057         vrf_cleanup
0058 }
0059 
0060 test_gretap()
0061 {
0062         full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap"
0063         full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap"
0064 }
0065 
0066 test_all()
0067 {
0068         slow_path_trap_install $swp1 ingress
0069         slow_path_trap_install $swp1 egress
0070 
0071         tests_run
0072 
0073         slow_path_trap_uninstall $swp1 egress
0074         slow_path_trap_uninstall $swp1 ingress
0075 }
0076 
0077 trap cleanup EXIT
0078 
0079 setup_prepare
0080 setup_wait
0081 
0082 tcflags="skip_hw"
0083 test_all
0084 
0085 if ! tc_offload_check; then
0086         echo "WARN: Could not test offloaded functionality"
0087 else
0088         tcflags="skip_sw"
0089         test_all
0090 fi
0091 
0092 exit $EXIT_STATUS