99 lines · bash
1#!/bin/bash2# SPDX-License-Identifier: GPL-2.03 4# This test uses standard topology for testing gretap. See5# mirror_gre_topo_lib.sh for more details.6#7# Test for mirroring to gretap and ip6gretap, such that the neighbor entry for8# the tunnel remote address has invalid address at the time that the mirroring9# is set up. Later on, the neighbor is deleted and it is expected to be10# reinitialized using the usual ARP process, and the mirroring offload updated.11 12ALL_TESTS="13 test_gretap14 test_ip6gretap15"16 17NUM_NETIFS=618source lib.sh19source mirror_lib.sh20source mirror_gre_lib.sh21source mirror_gre_topo_lib.sh22 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_prepare35 mirror_gre_topo_create36 37 ip address add dev $swp3 192.0.2.129/2838 ip address add dev $h3 192.0.2.130/2839 40 ip address add dev $swp3 2001:db8:2::1/6441 ip address add dev $h3 2001:db8:2::2/6442}43 44cleanup()45{46 pre_cleanup47 48 ip address del dev $h3 2001:db8:2::2/6449 ip address del dev $swp3 2001:db8:2::1/6450 51 ip address del dev $h3 192.0.2.130/2852 ip address del dev $swp3 192.0.2.129/2853 54 mirror_gre_topo_destroy55 vrf_cleanup56}57 58test_span_gre_neigh()59{60 local addr=$1; shift61 local tundev=$1; shift62 local direction=$1; shift63 local forward_type=$1; shift64 local backward_type=$1; shift65 local what=$1; shift66 67 RET=068 69 ip neigh replace dev $swp3 $addr lladdr 00:11:22:33:44:5570 mirror_install $swp1 $direction $tundev "matchall"71 fail_test_span_gre_dir $tundev "$forward_type" "$backward_type"72 ip neigh del dev $swp3 $addr73 quick_test_span_gre_dir $tundev "$forward_type" "$backward_type"74 mirror_uninstall $swp1 $direction75 76 log_test "$direction $what: neighbor change"77}78 79test_gretap()80{81 test_span_gre_neigh 192.0.2.130 gt4 ingress 8 0 "mirror to gretap"82 test_span_gre_neigh 192.0.2.130 gt4 egress 0 8 "mirror to gretap"83}84 85test_ip6gretap()86{87 test_span_gre_neigh 2001:db8:2::2 gt6 ingress 8 0 "mirror to ip6gretap"88 test_span_gre_neigh 2001:db8:2::2 gt6 egress 0 8 "mirror to ip6gretap"89}90 91trap cleanup EXIT92 93setup_prepare94setup_wait95 96tests_run97 98exit $EXIT_STATUS99