• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0-or-later
3# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
4#
5# Change route gateway via netlink
6# gw (on rhost): 10.23.1.x, rhost: 10.23.0.1
7# lhost (iface set, but not specified in Netlink API): 10.23.1.1
8
9TST_SETUP="setup"
10TST_CLEANUP="route_cleanup"
11TST_TESTFUNC="test_netlink"
12. route-lib.sh
13
14setup()
15{
16	local cnt=0
17
18	tst_res TINFO "change IPv$TST_IPVER route gateway $ROUTE_CHANGE_NETLINK times"
19
20	check_max_ip
21	setup_gw
22
23	while [ $cnt -lt $ROUTE_MAX_IP ]; do
24		gw="$(tst_ipaddr_un -h 2,$max_ip_limit 1 $(($cnt + 1)))"
25		gw_all="$gw$IP_ADDR_DELIM$gw_all"
26		tst_add_ipaddr -s -q -a $gw rhost
27		cnt=$((cnt+1))
28	done
29
30	ROUTE_CHANGE_NETLINK_PARAMS="-d $(tst_iface) -g "$gw_all" -r $rhost"
31}
32
33tst_run
34