Back to home page

OSCL-LXR

 
 

    


0001 # SPDX-License-Identifier: GPL-2.0
0002 
0003 # This is the standard topology for testing mirroring to gretap and ip6gretap
0004 # netdevices. The tests that use it tweak it in one way or another--importantly,
0005 # $swp3 and $h3 need to have addresses set up.
0006 #
0007 #   +---------------------+                             +---------------------+
0008 #   | H1                  |                             |                  H2 |
0009 #   |     + $h1           |                             |           $h2 +     |
0010 #   |     | 192.0.2.1/28  |                             |  192.0.2.2/28 |     |
0011 #   +-----|---------------+                             +---------------|-----+
0012 #         |                                                             |
0013 #   +-----|-------------------------------------------------------------|-----+
0014 #   | SW  o--> mirror                                                   |     |
0015 #   | +---|-------------------------------------------------------------|---+ |
0016 #   | |   + $swp1                    BR                           $swp2 +   | |
0017 #   | +---------------------------------------------------------------------+ |
0018 #   |                                                                         |
0019 #   |     + $swp3               + gt6 (ip6gretap)      + gt4 (gretap)         |
0020 #   |     |                     : loc=2001:db8:2::1    : loc=192.0.2.129      |
0021 #   |     |                     : rem=2001:db8:2::2    : rem=192.0.2.130      |
0022 #   |     |                     : ttl=100              : ttl=100              |
0023 #   |     |                     : tos=inherit          : tos=inherit          |
0024 #   |     |                     :                      :                      |
0025 #   +-----|---------------------:----------------------:----------------------+
0026 #         |                     :                      :
0027 #   +-----|---------------------:----------------------:----------------------+
0028 #   | H3  + $h3                 + h3-gt6 (ip6gretap)   + h3-gt4 (gretap)      |
0029 #   |                             loc=2001:db8:2::2      loc=192.0.2.130      |
0030 #   |                             rem=2001:db8:2::1      rem=192.0.2.129      |
0031 #   |                             ttl=100                ttl=100              |
0032 #   |                             tos=inherit            tos=inherit          |
0033 #   |                                                                         |
0034 #   +-------------------------------------------------------------------------+
0035 
0036 source "$relative_path/mirror_topo_lib.sh"
0037 
0038 mirror_gre_topo_h3_create()
0039 {
0040         mirror_topo_h3_create
0041 
0042         tunnel_create h3-gt4 gretap 192.0.2.130 192.0.2.129
0043         ip link set h3-gt4 vrf v$h3
0044         matchall_sink_create h3-gt4
0045 
0046         tunnel_create h3-gt6 ip6gretap 2001:db8:2::2 2001:db8:2::1
0047         ip link set h3-gt6 vrf v$h3
0048         matchall_sink_create h3-gt6
0049 }
0050 
0051 mirror_gre_topo_h3_destroy()
0052 {
0053         tunnel_destroy h3-gt6
0054         tunnel_destroy h3-gt4
0055 
0056         mirror_topo_h3_destroy
0057 }
0058 
0059 mirror_gre_topo_switch_create()
0060 {
0061         mirror_topo_switch_create
0062 
0063         tunnel_create gt4 gretap 192.0.2.129 192.0.2.130 \
0064                       ttl 100 tos inherit
0065 
0066         tunnel_create gt6 ip6gretap 2001:db8:2::1 2001:db8:2::2 \
0067                       ttl 100 tos inherit allow-localremote
0068 }
0069 
0070 mirror_gre_topo_switch_destroy()
0071 {
0072         tunnel_destroy gt6
0073         tunnel_destroy gt4
0074 
0075         mirror_topo_switch_destroy
0076 }
0077 
0078 mirror_gre_topo_create()
0079 {
0080         mirror_topo_h1_create
0081         mirror_topo_h2_create
0082         mirror_gre_topo_h3_create
0083 
0084         mirror_gre_topo_switch_create
0085 }
0086 
0087 mirror_gre_topo_destroy()
0088 {
0089         mirror_gre_topo_switch_destroy
0090 
0091         mirror_gre_topo_h3_destroy
0092         mirror_topo_h2_destroy
0093         mirror_topo_h1_destroy
0094 }