#!/bin/bash # SPDX-License-Identifier: GPL-2.0 # # Simple tests for ipvtap # # The testing environment looks this way: # # |------HNS-------| |------PHY-------| # | veth<----------------->veth | # |------|--|------| |----------------| # | | # | | |-----TST0-------| # | |------------|----ipvlan | # | |----------------| # | # | |-----TST1-------| # |---------------|----ipvlan | # |----------------| # ALL_TESTS=" test_ip_set " source lib.sh DEBUG=0 VETH_HOST=vethtst.h VETH_PHY=vethtst.p NS_COUNT=32 IP_ITERATIONS=1024 IPSET_TIMEOUT="60s" ns_run() { ns=$1 shift if [[ "$ns" == "global" ]]; then "$@" >/dev/null else ip netns exec "$ns" "$@" >/dev/null fi } test_ip_setup_env() { setup_ns NS_PHY setup_ns HST_NS # setup simulated other-host (phy) and host itself ns_run "$HST_NS" ip link add $VETH_HOST type veth peer name $VETH_PHY \ netns "$NS_PHY" >/dev/null ns_run "$HST_NS" ip link set $VETH_HOST up ns_run "$NS_PHY" ip link set $VETH_PHY up for ((i=0; i/dev/null ip a a "fc00::$v/64" dev ipvlan0 2>/dev/null v=$(rnd) ip a d "172.25.0.$v/24" dev ipvlan0 2>/dev/null ip a d "fc00::$v/64" dev ipvlan0 2>/dev/null done } test_ip_set() { RET=0 trap test_ip_cleanup_env EXIT test_ip_setup_env declare -A ns_pids for ((i=0; i