1# SPDX-License-Identifier: GPL-2.0 2 3# This is the standard topology for testing mirroring to gretap and ip6gretap 4# netdevices. The tests that use it tweak it in one way or another--importantly, 5# $swp3 and $h3 need to have addresses set up. 6# 7# +---------------------+ +---------------------+ 8# | H1 | | H2 | 9# | + $h1 | | $h2 + | 10# | | 192.0.2.1/28 | | 192.0.2.2/28 | | 11# +-----|---------------+ +---------------|-----+ 12# | | 13# +-----|-------------------------------------------------------------|-----+ 14# | SW o--> mirror | | 15# | +---|-------------------------------------------------------------|---+ | 16# | | + $swp1 BR $swp2 + | | 17# | +---------------------------------------------------------------------+ | 18# | | 19# | + $swp3 + gt6 (ip6gretap) + gt4 (gretap) | 20# | | : loc=2001:db8:2::1 : loc=192.0.2.129 | 21# | | : rem=2001:db8:2::2 : rem=192.0.2.130 | 22# | | : ttl=100 : ttl=100 | 23# | | : tos=inherit : tos=inherit | 24# | | : : | 25# +-----|---------------------:----------------------:----------------------+ 26# | : : 27# +-----|---------------------:----------------------:----------------------+ 28# | H3 + $h3 + h3-gt6 (ip6gretap) + h3-gt4 (gretap) | 29# | loc=2001:db8:2::2 loc=192.0.2.130 | 30# | rem=2001:db8:2::1 rem=192.0.2.129 | 31# | ttl=100 ttl=100 | 32# | tos=inherit tos=inherit | 33# | | 34# +-------------------------------------------------------------------------+ 35 36source "$net_forwarding_dir/mirror_topo_lib.sh" 37 38mirror_gre_topo_h3_create() 39{ 40 mirror_topo_h3_create 41 42 tunnel_create h3-gt4 gretap 192.0.2.130 192.0.2.129 43 ip link set h3-gt4 vrf v$h3 44 matchall_sink_create h3-gt4 45 46 tunnel_create h3-gt6 ip6gretap 2001:db8:2::2 2001:db8:2::1 47 ip link set h3-gt6 vrf v$h3 48 matchall_sink_create h3-gt6 49} 50 51mirror_gre_topo_h3_destroy() 52{ 53 tunnel_destroy h3-gt6 54 tunnel_destroy h3-gt4 55 56 mirror_topo_h3_destroy 57} 58 59mirror_gre_topo_switch_create() 60{ 61 mirror_topo_switch_create 62 63 tunnel_create gt4 gretap 192.0.2.129 192.0.2.130 \ 64 ttl 100 tos inherit 65 66 tunnel_create gt6 ip6gretap 2001:db8:2::1 2001:db8:2::2 \ 67 ttl 100 tos inherit allow-localremote 68} 69 70mirror_gre_topo_switch_destroy() 71{ 72 tunnel_destroy gt6 73 tunnel_destroy gt4 74 75 mirror_topo_switch_destroy 76} 77 78mirror_gre_topo_create() 79{ 80 mirror_topo_h1_create 81 mirror_topo_h2_create 82 mirror_gre_topo_h3_create 83 84 mirror_gre_topo_switch_create 85} 86 87mirror_gre_topo_destroy() 88{ 89 mirror_gre_topo_switch_destroy 90 91 mirror_gre_topo_h3_destroy 92 mirror_topo_h2_destroy 93 mirror_topo_h1_destroy 94} 95