~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/net/forwarding/mirror_vlan.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0
  3 
  4 # This test uses standard topology for testing mirroring. See mirror_topo_lib.sh
  5 # for more details.
  6 #
  7 # Test for "tc action mirred egress mirror" that mirrors to a vlan device.
  8 
  9 ALL_TESTS="
 10         test_vlan
 11         test_tagged_vlan
 12 "
 13 
 14 NUM_NETIFS=6
 15 source lib.sh
 16 source mirror_lib.sh
 17 source mirror_topo_lib.sh
 18 
 19 setup_prepare()
 20 {
 21         h1=${NETIFS[p1]}
 22         swp1=${NETIFS[p2]}
 23 
 24         swp2=${NETIFS[p3]}
 25         h2=${NETIFS[p4]}
 26 
 27         swp3=${NETIFS[p5]}
 28         h3=${NETIFS[p6]}
 29 
 30         vrf_prepare
 31         mirror_topo_create
 32 
 33         vlan_create $swp3 555
 34 
 35         vlan_create $h3 555 v$h3
 36         matchall_sink_create $h3.555
 37 
 38         vlan_create $h1 111 v$h1 192.0.2.17/28
 39         bridge vlan add dev $swp1 vid 111
 40 
 41         vlan_create $h2 111 v$h2 192.0.2.18/28
 42         bridge vlan add dev $swp2 vid 111
 43 
 44         trap_install $h3 ingress
 45 }
 46 
 47 cleanup()
 48 {
 49         pre_cleanup
 50 
 51         trap_uninstall $h3 ingress
 52 
 53         vlan_destroy $h2 111
 54         vlan_destroy $h1 111
 55         vlan_destroy $h3 555
 56         vlan_destroy $swp3 555
 57 
 58         mirror_topo_destroy
 59         vrf_cleanup
 60 }
 61 
 62 test_vlan_dir()
 63 {
 64         local direction=$1; shift
 65         local forward_type=$1; shift
 66         local backward_type=$1; shift
 67 
 68         RET=0
 69 
 70         mirror_install $swp1 $direction $swp3.555 "matchall"
 71         test_span_dir "$h3.555" "$forward_type" "$backward_type"
 72         mirror_uninstall $swp1 $direction
 73 
 74         log_test "$direction mirror to vlan"
 75 }
 76 
 77 test_vlan()
 78 {
 79         test_vlan_dir ingress 8 0
 80         test_vlan_dir egress 0 8
 81 }
 82 
 83 test_tagged_vlan_dir()
 84 {
 85         local direction=$1; shift
 86         local forward_type=$1; shift
 87         local backward_type=$1; shift
 88 
 89         RET=0
 90 
 91         mirror_install $swp1 $direction $swp3.555 "matchall"
 92         do_test_span_vlan_dir_ips '>= 10' "$h3.555" 111 ip 192.0.2.17 192.0.2.18
 93         do_test_span_vlan_dir_ips  0 "$h3.555" 555 ip 192.0.2.17 192.0.2.18
 94         mirror_uninstall $swp1 $direction
 95 
 96         log_test "$direction mirror tagged to vlan"
 97 }
 98 
 99 test_tagged_vlan()
100 {
101         test_tagged_vlan_dir ingress 8 0
102         test_tagged_vlan_dir egress 0 8
103 }
104 
105 trap cleanup EXIT
106 
107 setup_prepare
108 setup_wait
109 
110 tests_run
111 
112 exit $EXIT_STATUS

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php