1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0-or-later 3# Copyright (c) 2019-2020 Petr Vorel <pvorel@suse.cz> 4# Copyright (c) International Business Machines Corp., 2006 5# Author: Mitsuru Chinen <mitch@jp.ibm.com> 6# Rewrite into new shell API: Petr Vorel 7# 8# Change route interface 9# lhost: 10.23.x.2, gw (on rhost): 10.23.x.1, rhost: 10.23.0.1, switching ifaces on lhost 10 11TST_SETUP="setup" 12TST_CLEANUP="cleanup_if" 13TST_TESTFUNC="test_if" 14. route-lib.sh 15TST_CNT=$ROUTE_CHANGE_IP 16 17setup() 18{ 19 tst_res TINFO "change IPv$TST_IPVER route interface $ROUTE_CHANGE_IP times" 20 setup_if 21} 22 23test_if() 24{ 25 local gw="$(tst_ipaddr_un -n1 $1 1)" 26 local lhost="$(tst_ipaddr_un -n1 $1 2)" 27 local link_num="$(($1 % $(tst_get_ifaces_cnt)))" 28 local iface="$(tst_iface lhost $link_num)" 29 30 tst_res TINFO "testing route over interface '$iface' with gateway '$gw'" 31 32 tst_add_ipaddr -s -q -a $lhost lhost $link_num 33 tst_add_ipaddr -s -q -a $gw rhost $link_num 34 ROD ip route add $rt dev $iface via $gw 35 EXPECT_PASS_BRK ping$TST_IPV6 -c1 -I $lhost $rhost \>/dev/null 36 ROD ip route del $rt dev $iface via $gw 37 tst_del_ipaddr -s -q -a $lhost lhost $link_num 38 tst_del_ipaddr -s -q -a $gw rhost $link_num 39} 40 41tst_run 42