1f08c3bdfSopenharmony_ci#!/bin/sh 2f08c3bdfSopenharmony_ci# SPDX-License-Identifier: GPL-2.0-or-later 3f08c3bdfSopenharmony_ci# Copyright (c) 2019-2022 Petr Vorel <pvorel@suse.cz> 4f08c3bdfSopenharmony_ci# Copyright (c) International Business Machines Corp., 2006 5f08c3bdfSopenharmony_ci# Author: Mitsuru Chinen <mitch@jp.ibm.com> 6f08c3bdfSopenharmony_ci# Rewrite into new shell API: Petr Vorel 7f08c3bdfSopenharmony_ci# 8f08c3bdfSopenharmony_ci# Change route gateway 9f08c3bdfSopenharmony_ci# lhost: 10.23.1.1, gw (on rhost): 10.23.1.x, rhost: 10.23.0.1 10f08c3bdfSopenharmony_ci 11f08c3bdfSopenharmony_ciTST_SETUP="setup" 12f08c3bdfSopenharmony_ciTST_CLEANUP="route_cleanup" 13f08c3bdfSopenharmony_ciTST_TESTFUNC="test_gw" 14f08c3bdfSopenharmony_ci 15f08c3bdfSopenharmony_cisetup() 16f08c3bdfSopenharmony_ci{ 17f08c3bdfSopenharmony_ci tst_res TINFO "change IPv$TST_IPVER route gateway $ROUTE_CHANGE_IP times" 18f08c3bdfSopenharmony_ci setup_gw 19f08c3bdfSopenharmony_ci} 20f08c3bdfSopenharmony_ci 21f08c3bdfSopenharmony_citest_gw() 22f08c3bdfSopenharmony_ci{ 23f08c3bdfSopenharmony_ci local gw="$(tst_ipaddr_un -h 2,254 1 $(($1 + 1)))" 24f08c3bdfSopenharmony_ci local iface="$(tst_iface)" 25f08c3bdfSopenharmony_ci 26f08c3bdfSopenharmony_ci tst_res TINFO "testing route over gateway '$gw'" 27f08c3bdfSopenharmony_ci 28f08c3bdfSopenharmony_ci tst_add_ipaddr -s -q -a $gw rhost 29f08c3bdfSopenharmony_ci ROD ip route add $rt dev $iface via $gw 30f08c3bdfSopenharmony_ci EXPECT_PASS_BRK ping$TST_IPV6 -c1 -I $lhost $rhost \>/dev/null 31f08c3bdfSopenharmony_ci ROD ip route del $rt dev $iface via $gw 32f08c3bdfSopenharmony_ci tst_del_ipaddr -s -q -a $gw rhost 33f08c3bdfSopenharmony_ci} 34f08c3bdfSopenharmony_ci 35f08c3bdfSopenharmony_ci. route-lib.sh 36f08c3bdfSopenharmony_ciTST_CNT=$ROUTE_CHANGE_IP 37f08c3bdfSopenharmony_citst_run 38