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