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 destination
9f08c3bdfSopenharmony_ci# lhost: 10.0.0.2, rhost: 10.23.x.1
10f08c3bdfSopenharmony_ci
11f08c3bdfSopenharmony_ciTST_SETUP="setup"
12f08c3bdfSopenharmony_ciTST_CLEANUP="route_cleanup"
13f08c3bdfSopenharmony_ciTST_TESTFUNC="test_dst"
14f08c3bdfSopenharmony_ci
15f08c3bdfSopenharmony_cisetup()
16f08c3bdfSopenharmony_ci{
17f08c3bdfSopenharmony_ci	tst_res TINFO "change IPv$TST_IPVER route destination $ROUTE_CHANGE_IP times"
18f08c3bdfSopenharmony_ci}
19f08c3bdfSopenharmony_ci
20f08c3bdfSopenharmony_citest_dst()
21f08c3bdfSopenharmony_ci{
22f08c3bdfSopenharmony_ci	local iface="$(tst_iface)"
23f08c3bdfSopenharmony_ci	local rt="$(tst_ipaddr_un -p $1)"
24f08c3bdfSopenharmony_ci	local rhost="$(tst_ipaddr_un $1 1)"
25f08c3bdfSopenharmony_ci
26f08c3bdfSopenharmony_ci	tst_res TINFO "testing route '$rt'"
27f08c3bdfSopenharmony_ci
28f08c3bdfSopenharmony_ci	tst_add_ipaddr -s -q -a $rhost rhost
29f08c3bdfSopenharmony_ci	ROD ip route add $rt dev $iface
30f08c3bdfSopenharmony_ci	EXPECT_PASS_BRK ping$TST_IPV6 -c1 -I $(tst_ipaddr) $rhost \>/dev/null
31f08c3bdfSopenharmony_ci	ROD ip route del $rt dev $iface
32f08c3bdfSopenharmony_ci	tst_del_ipaddr -s -q -a $rhost rhost
33f08c3bdfSopenharmony_ci}
34f08c3bdfSopenharmony_ci
35f08c3bdfSopenharmony_ci. route-lib.sh
36f08c3bdfSopenharmony_ciTST_CNT=$ROUTE_CHANGE_IP
37f08c3bdfSopenharmony_citst_run
38