74 lines · bash
1#!/bin/bash2# SPDX-License-Identifier: GPL-2.03 4# This test uses standard topology for testing gretap. See5# mirror_gre_topo_lib.sh for more details.6#7# Test for "tc action mirred egress mirror" that mirrors to a gretap netdevice8# whose underlay route points at a vlan device.9 10ALL_TESTS="11 test_gretap12"13 14NUM_NETIFS=615source lib.sh16source mirror_lib.sh17source mirror_gre_lib.sh18source mirror_gre_topo_lib.sh19 20setup_prepare()21{22 h1=${NETIFS[p1]}23 swp1=${NETIFS[p2]}24 25 swp2=${NETIFS[p3]}26 h2=${NETIFS[p4]}27 28 swp3=${NETIFS[p5]}29 h3=${NETIFS[p6]}30 31 vrf_prepare32 mirror_gre_topo_create33 34 ip link add name $swp3.555 link $swp3 type vlan id 55535 ip address add dev $swp3.555 192.0.2.129/3236 ip address add dev $swp3.555 2001:db8:2::1/12837 ip link set dev $swp3.555 up38 39 ip route add 192.0.2.130/32 dev $swp3.55540 ip -6 route add 2001:db8:2::2/128 dev $swp3.55541 42 ip link add name $h3.555 link $h3 type vlan id 55543 ip link set dev $h3.555 master v$h344 ip address add dev $h3.555 192.0.2.130/2845 ip address add dev $h3.555 2001:db8:2::2/6446 ip link set dev $h3.555 up47}48 49cleanup()50{51 pre_cleanup52 53 ip link del dev $h3.55554 ip link del dev $swp3.55555 56 mirror_gre_topo_destroy57 vrf_cleanup58}59 60test_gretap()61{62 full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap"63 full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap"64}65 66trap cleanup EXIT67 68setup_prepare69setup_wait70 71tests_run72 73exit $EXIT_STATUS74