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