1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0 3 4# This test uses standard topology for testing gretap. See 5# mirror_gre_topo_lib.sh for more details. 6# 7# Test for mirroring to gretap and ip6gretap, such that the neighbor entry for 8# the tunnel remote address has invalid address at the time that the mirroring 9# is set up. Later on, the neighbor is deleted and it is expected to be 10# reinitialized using the usual ARP process, and the mirroring offload updated. 11 12ALL_TESTS=" 13 test_gretap 14 test_ip6gretap 15" 16 17NUM_NETIFS=6 18source lib.sh 19source mirror_lib.sh 20source mirror_gre_lib.sh 21source mirror_gre_topo_lib.sh 22 23setup_prepare() 24{ 25 h1=${NETIFS[p1]} 26 swp1=${NETIFS[p2]} 27 28 swp2=${NETIFS[p3]} 29 h2=${NETIFS[p4]} 30 31 swp3=${NETIFS[p5]} 32 h3=${NETIFS[p6]} 33 34 vrf_prepare 35 mirror_gre_topo_create 36 37 ip address add dev $swp3 192.0.2.129/28 38 ip address add dev $h3 192.0.2.130/28 39 40 ip address add dev $swp3 2001:db8:2::1/64 41 ip address add dev $h3 2001:db8:2::2/64 42} 43 44cleanup() 45{ 46 pre_cleanup 47 48 ip address del dev $h3 2001:db8:2::2/64 49 ip address del dev $swp3 2001:db8:2::1/64 50 51 ip address del dev $h3 192.0.2.130/28 52 ip address del dev $swp3 192.0.2.129/28 53 54 mirror_gre_topo_destroy 55 vrf_cleanup 56} 57 58test_span_gre_neigh() 59{ 60 local addr=$1; shift 61 local tundev=$1; shift 62 local direction=$1; shift 63 local what=$1; shift 64 65 RET=0 66 67 ip neigh replace dev $swp3 $addr lladdr 00:11:22:33:44:55 68 mirror_install $swp1 $direction $tundev "matchall $tcflags" 69 fail_test_span_gre_dir $tundev ingress 70 ip neigh del dev $swp3 $addr 71 quick_test_span_gre_dir $tundev ingress 72 mirror_uninstall $swp1 $direction 73 74 log_test "$direction $what: neighbor change ($tcflags)" 75} 76 77test_gretap() 78{ 79 test_span_gre_neigh 192.0.2.130 gt4 ingress "mirror to gretap" 80 test_span_gre_neigh 192.0.2.130 gt4 egress "mirror to gretap" 81} 82 83test_ip6gretap() 84{ 85 test_span_gre_neigh 2001:db8:2::2 gt6 ingress "mirror to ip6gretap" 86 test_span_gre_neigh 2001:db8:2::2 gt6 egress "mirror to ip6gretap" 87} 88 89test_all() 90{ 91 slow_path_trap_install $swp1 ingress 92 slow_path_trap_install $swp1 egress 93 94 tests_run 95 96 slow_path_trap_uninstall $swp1 egress 97 slow_path_trap_uninstall $swp1 ingress 98} 99 100trap cleanup EXIT 101 102setup_prepare 103setup_wait 104 105tcflags="skip_hw" 106test_all 107 108if ! tc_offload_check; then 109 echo "WARN: Could not test offloaded functionality" 110else 111 tcflags="skip_sw" 112 test_all 113fi 114 115exit $EXIT_STATUS 116