2 # SPDX-License-Identifier: GPL-2.0
4 # This test uses standard topology for testing gretap. See
5 # mirror_gre_topo_lib.sh for more details.
7 # Test for "tc action mirred egress mirror" when the underlay route points at a
8 # bridge device without vlan filtering (802.1d). The device attached to that
21 source mirror_gre_lib.sh
22 source mirror_gre_topo_lib.sh
36 mirror_gre_topo_create
38 ip link add name br2 type bridge vlan_filtering 0
39 ip link set dev br2 up
43 ip link set dev $swp3.555 master br2
44 ip route add 192.0.2.130/32 dev br2
45 ip -6 route add 2001:db8:2::2/128 dev br2
47 ip address add dev br2 192.0.2.129/32
48 ip address add dev br2 2001:db8:2::1/128
50 vlan_create $h3 555 v$h3 192.0.2.130/28 2001:db8:2::2/64
59 vlan_destroy $swp3 555
61 mirror_gre_topo_destroy
67 local tundev=$1; shift
68 local vlan_match=$1; shift
71 full_test_span_gre_dir_vlan $tundev ingress "$vlan_match" 8 0 "$what"
72 full_test_span_gre_dir_vlan $tundev egress "$vlan_match" 0 8 "$what"
77 test_vlan_match gt4 'skip_hw vlan_id 555 vlan_ethtype ip' \
83 test_vlan_match gt6 'skip_hw vlan_id 555 vlan_ethtype ip' \
89 # Sometimes after mirror installation, the neighbor's state is not valid.
90 # The reason is that there is no SW datapath activity related to the
91 # neighbor for the remote GRE address. Therefore whether the corresponding
92 # neighbor will be valid is a matter of luck, and the test is thus racy.
93 # Set the neighbor's state to permanent, so it would be always valid.
94 ip neigh replace 192.0.2.130 lladdr $(mac_get $h3) \
96 full_test_span_gre_stp gt4 $swp3.555 "mirror to gretap"
101 ip neigh replace 2001:db8:2::2 lladdr $(mac_get $h3) \
102 nud permanent dev br2
103 full_test_span_gre_stp gt6 $swp3.555 "mirror to ip6gretap"
108 slow_path_trap_install $swp1 ingress
109 slow_path_trap_install $swp1 egress
113 slow_path_trap_uninstall $swp1 egress
114 slow_path_trap_uninstall $swp1 ingress
125 if ! tc_offload_check; then
126 echo "WARN: Could not test offloaded functionality"