1 #!/bin/bash 2 # SPDX-License-Identifier: GPL-2.0 3 # 4 # A simple program for generating traffic for the toeplitz test. 5 # 6 # This program sends packets periodically for, conservatively, 20 seconds. The 7 # intent is for the calling program to kill this program once it is no longer 8 # needed, rather than waiting for the 20 second expiration. 9 10 send_traffic() { 11 expiration=$((SECONDS+20)) 12 while [[ "${SECONDS}" -lt "${expiration}" ]] 13 do 14 if [[ "${PROTO}" == "-u" ]]; then 15 echo "msg $i" | nc "${IPVER}" -u -w 0 "${ADDR}" "${PORT}" 16 else 17 echo "msg $i" | nc "${IPVER}" -w 0 "${ADDR}" "${PORT}" 18 fi 19 sleep 0.001 20 done 21 } 22 23 PROTO=$1 24 IPVER=$2 25 ADDR=$3 26 PORT=$4 27 28 send_traffic
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.