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 gateway 9# lhost: 10.23.1.1, gw (on rhost): 10.23.1.x, rhost: 10.23.0.1 10 11TST_SETUP="setup" 12TST_CLEANUP="route_cleanup" 13TST_TESTFUNC="test_gw" 14. route-lib.sh 15TST_CNT=$ROUTE_CHANGE_IP 16 17setup() 18{ 19 tst_res TINFO "change IPv$TST_IPVER route gateway $ROUTE_CHANGE_IP times" 20 setup_gw 21} 22 23test_gw() 24{ 25 local gw="$(tst_ipaddr_un -h 2,254 1 $(($1 + 1)))" 26 local iface="$(tst_iface)" 27 28 tst_res TINFO "testing route over gateway '$gw'" 29 30 tst_add_ipaddr -s -q -a $gw rhost 31 ROD ip route add $rt dev $iface via $gw 32 EXPECT_PASS_BRK ping$TST_IPV6 -c1 -I $lhost $rhost \>/dev/null 33 ROD ip route del $rt dev $iface via $gw 34 tst_del_ipaddr -s -q -a $gw rhost 35} 36 37tst_run 38