WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / net / forwarding / mirror_gre_lib.sh
blobfac486178ef727aa387450042050f02c65c0ff32
1 # SPDX-License-Identifier: GPL-2.0
3 source "$relative_path/mirror_lib.sh"
5 quick_test_span_gre_dir_ips()
7 local tundev=$1; shift
9 do_test_span_dir_ips 10 h3-$tundev "$@"
12 fail_test_span_gre_dir_ips()
14 local tundev=$1; shift
16 do_test_span_dir_ips 0 h3-$tundev "$@"
19 test_span_gre_dir_ips()
21 local tundev=$1; shift
23 test_span_dir_ips h3-$tundev "$@"
26 full_test_span_gre_dir_ips()
28 local tundev=$1; shift
29 local direction=$1; shift
30 local forward_type=$1; shift
31 local backward_type=$1; shift
32 local what=$1; shift
33 local ip1=$1; shift
34 local ip2=$1; shift
36 RET=0
38 mirror_install $swp1 $direction $tundev "matchall $tcflags"
39 test_span_dir_ips "h3-$tundev" "$direction" "$forward_type" \
40 "$backward_type" "$ip1" "$ip2"
41 mirror_uninstall $swp1 $direction
43 log_test "$direction $what ($tcflags)"
46 full_test_span_gre_dir_vlan_ips()
48 local tundev=$1; shift
49 local direction=$1; shift
50 local vlan_match=$1; shift
51 local forward_type=$1; shift
52 local backward_type=$1; shift
53 local what=$1; shift
54 local ip1=$1; shift
55 local ip2=$1; shift
57 RET=0
59 mirror_install $swp1 $direction $tundev "matchall $tcflags"
61 test_span_dir_ips "h3-$tundev" "$direction" "$forward_type" \
62 "$backward_type" "$ip1" "$ip2"
64 tc filter add dev $h3 ingress pref 77 prot 802.1q \
65 flower $vlan_match \
66 action pass
67 mirror_test v$h1 $ip1 $ip2 $h3 77 10
68 tc filter del dev $h3 ingress pref 77
70 mirror_uninstall $swp1 $direction
72 log_test "$direction $what ($tcflags)"
75 quick_test_span_gre_dir()
77 quick_test_span_gre_dir_ips "$@" 192.0.2.1 192.0.2.2
80 fail_test_span_gre_dir()
82 fail_test_span_gre_dir_ips "$@" 192.0.2.1 192.0.2.2
85 test_span_gre_dir()
87 test_span_gre_dir_ips "$@" 192.0.2.1 192.0.2.2
90 full_test_span_gre_dir()
92 full_test_span_gre_dir_ips "$@" 192.0.2.1 192.0.2.2
95 full_test_span_gre_dir_vlan()
97 full_test_span_gre_dir_vlan_ips "$@" 192.0.2.1 192.0.2.2
100 full_test_span_gre_stp_ips()
102 local tundev=$1; shift
103 local nbpdev=$1; shift
104 local what=$1; shift
105 local ip1=$1; shift
106 local ip2=$1; shift
107 local h3mac=$(mac_get $h3)
109 RET=0
111 mirror_install $swp1 ingress $tundev "matchall $tcflags"
112 quick_test_span_gre_dir_ips $tundev ingress $ip1 $ip2
114 bridge link set dev $nbpdev state disabled
115 sleep 1
116 fail_test_span_gre_dir_ips $tundev ingress $ip1 $ip2
118 bridge link set dev $nbpdev state forwarding
119 sleep 1
120 quick_test_span_gre_dir_ips $tundev ingress $ip1 $ip2
122 mirror_uninstall $swp1 ingress
124 log_test "$what: STP state ($tcflags)"
127 full_test_span_gre_stp()
129 full_test_span_gre_stp_ips "$@" 192.0.2.1 192.0.2.2