From: Petr Machata Date: Thu, 27 Feb 2020 07:50:06 +0000 (+0100) Subject: selftests: forwarding: lib.sh: Add start_tcp_traffic X-Git-Tag: v5.7-rc1~146^2~307^2~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4113b04823948e40eda1c54dfadadad4bc01dcdb;p=thirdparty%2Fkernel%2Flinux.git selftests: forwarding: lib.sh: Add start_tcp_traffic Extract a helper __start_traffic() configurable by protocol type. Allow passing through extra mausezahn arguments. Add a wrapper, start_tcp_traffic(). Signed-off-by: Petr Machata Signed-off-by: Ido Schimmel Signed-off-by: Jiri Pirko Signed-off-by: David S. Miller --- diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 2f5da414aaa7f..f80f384978ceb 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -1132,18 +1132,29 @@ flood_test() flood_multicast_test $br_port $host1_if $host2_if } -start_traffic() +__start_traffic() { + local proto=$1; shift local h_in=$1; shift # Where the traffic egresses the host local sip=$1; shift local dip=$1; shift local dmac=$1; shift $MZ $h_in -p 8000 -A $sip -B $dip -c 0 \ - -a own -b $dmac -t udp -q & + -a own -b $dmac -t "$proto" -q "$@" & sleep 1 } +start_traffic() +{ + __start_traffic udp "$@" +} + +start_tcp_traffic() +{ + __start_traffic tcp "$@" +} + stop_traffic() { # Suppress noise from killing mausezahn.