• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0-or-later
3# Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
4# Author: Petr Vorel <pvorel@suse.cz>
5
6CMD="${CMD:-ip}"
7
8TST_SETUP="${TST_SETUP:-if_setup}"
9TST_TESTFUNC="test_body"
10TST_PARSE_ARGS="if_parse_args"
11TST_USAGE="if_usage"
12TST_OPTS="c:"
13. tst_net_stress.sh
14
15if_usage()
16{
17	echo "-c      Test command (ip, $IF_CMD)"
18}
19
20if_parse_args()
21{
22	case $1 in
23	c) CMD="$2";;
24	esac
25}
26
27if_setup()
28{
29	if [ "$CMD" != 'ip' -a "$CMD" != "$IF_CMD" ]; then
30		tst_brk TBROK "Missing or wrong -c parameter: '$CMD', use 'ip' or '$IF_CMD'"
31	fi
32
33	tst_require_cmds "$CMD"
34	netstress_setup
35	TST_CLEANUP="${TST_CLEANUP:-netstress_cleanup}"
36}
37
38if_cleanup_restore()
39{
40	netstress_cleanup
41	restore_ipaddr
42	restore_ipaddr rhost
43}
44