1b64b0d1eSJesper Dangaard Brouer# 2b64b0d1eSJesper Dangaard Brouer# Common functions used by pktgen scripts 3b64b0d1eSJesper Dangaard Brouer# - Depending on bash 3 (or higher) syntax 4b64b0d1eSJesper Dangaard Brouer# 5b64b0d1eSJesper Dangaard Brouer# Author: Jesper Dangaaard Brouer 6b64b0d1eSJesper Dangaard Brouer# License: GPL 7b64b0d1eSJesper Dangaard Brouer 83cad8f91SDaniel T. Leeset -o errexit 93cad8f91SDaniel T. Lee 10b64b0d1eSJesper Dangaard Brouer## -- General shell logging cmds -- 11b64b0d1eSJesper Dangaard Brouerfunction err() { 12b64b0d1eSJesper Dangaard Brouer local exitcode=$1 13b64b0d1eSJesper Dangaard Brouer shift 14b64b0d1eSJesper Dangaard Brouer echo "ERROR: $@" >&2 15b64b0d1eSJesper Dangaard Brouer exit $exitcode 16b64b0d1eSJesper Dangaard Brouer} 17b64b0d1eSJesper Dangaard Brouer 18b64b0d1eSJesper Dangaard Brouerfunction warn() { 19b64b0d1eSJesper Dangaard Brouer echo "WARN : $@" >&2 20b64b0d1eSJesper Dangaard Brouer} 21b64b0d1eSJesper Dangaard Brouer 22b64b0d1eSJesper Dangaard Brouerfunction info() { 23b64b0d1eSJesper Dangaard Brouer if [[ -n "$VERBOSE" ]]; then 24b64b0d1eSJesper Dangaard Brouer echo "INFO : $@" >&2 25b64b0d1eSJesper Dangaard Brouer fi 26b64b0d1eSJesper Dangaard Brouer} 27b64b0d1eSJesper Dangaard Brouer 28b64b0d1eSJesper Dangaard Brouer## -- Pktgen proc config commands -- ## 29b64b0d1eSJesper Dangaard Brouerexport PROC_DIR=/proc/net/pktgen 30b64b0d1eSJesper Dangaard Brouer# 31b64b0d1eSJesper Dangaard Brouer# Three different shell functions for configuring the different 32b64b0d1eSJesper Dangaard Brouer# components of pktgen: 33b64b0d1eSJesper Dangaard Brouer# pg_ctrl(), pg_thread() and pg_set(). 34b64b0d1eSJesper Dangaard Brouer# 35b64b0d1eSJesper Dangaard Brouer# These functions correspond to pktgens different components. 36b64b0d1eSJesper Dangaard Brouer# * pg_ctrl() control "pgctrl" (/proc/net/pktgen/pgctrl) 37b64b0d1eSJesper Dangaard Brouer# * pg_thread() control the kernel threads and binding to devices 38b64b0d1eSJesper Dangaard Brouer# * pg_set() control setup of individual devices 39b64b0d1eSJesper Dangaard Brouerfunction pg_ctrl() { 40b64b0d1eSJesper Dangaard Brouer local proc_file="pgctrl" 41b64b0d1eSJesper Dangaard Brouer proc_cmd ${proc_file} "$@" 42b64b0d1eSJesper Dangaard Brouer} 43b64b0d1eSJesper Dangaard Brouer 44b64b0d1eSJesper Dangaard Brouerfunction pg_thread() { 45b64b0d1eSJesper Dangaard Brouer local thread=$1 46b64b0d1eSJesper Dangaard Brouer local proc_file="kpktgend_${thread}" 47b64b0d1eSJesper Dangaard Brouer shift 48b64b0d1eSJesper Dangaard Brouer proc_cmd ${proc_file} "$@" 49b64b0d1eSJesper Dangaard Brouer} 50b64b0d1eSJesper Dangaard Brouer 51b64b0d1eSJesper Dangaard Brouerfunction pg_set() { 52b64b0d1eSJesper Dangaard Brouer local dev=$1 53b64b0d1eSJesper Dangaard Brouer local proc_file="$dev" 54b64b0d1eSJesper Dangaard Brouer shift 55b64b0d1eSJesper Dangaard Brouer proc_cmd ${proc_file} "$@" 56b64b0d1eSJesper Dangaard Brouer} 57b64b0d1eSJesper Dangaard Brouer 58b64b0d1eSJesper Dangaard Brouer# More generic replacement for pgset(), that does not depend on global 59b64b0d1eSJesper Dangaard Brouer# variable for proc file. 60b64b0d1eSJesper Dangaard Brouerfunction proc_cmd() { 61b64b0d1eSJesper Dangaard Brouer local result 62b64b0d1eSJesper Dangaard Brouer local proc_file=$1 633cad8f91SDaniel T. Lee local status=0 64b64b0d1eSJesper Dangaard Brouer # after shift, the remaining args are contained in $@ 65b64b0d1eSJesper Dangaard Brouer shift 66b64b0d1eSJesper Dangaard Brouer local proc_ctrl=${PROC_DIR}/$proc_file 67b64b0d1eSJesper Dangaard Brouer if [[ ! -e "$proc_ctrl" ]]; then 68b64b0d1eSJesper Dangaard Brouer err 3 "proc file:$proc_ctrl does not exists (dev added to thread?)" 69b64b0d1eSJesper Dangaard Brouer else 70b64b0d1eSJesper Dangaard Brouer if [[ ! -w "$proc_ctrl" ]]; then 71b64b0d1eSJesper Dangaard Brouer err 4 "proc file:$proc_ctrl not writable, not root?!" 72b64b0d1eSJesper Dangaard Brouer fi 73b64b0d1eSJesper Dangaard Brouer fi 74b64b0d1eSJesper Dangaard Brouer 75b64b0d1eSJesper Dangaard Brouer if [[ "$DEBUG" == "yes" ]]; then 76b64b0d1eSJesper Dangaard Brouer echo "cmd: $@ > $proc_ctrl" 77b64b0d1eSJesper Dangaard Brouer fi 78b64b0d1eSJesper Dangaard Brouer # Quoting of "$@" is important for space expansion 793cad8f91SDaniel T. Lee echo "$@" > "$proc_ctrl" || status=$? 80b64b0d1eSJesper Dangaard Brouer 813cad8f91SDaniel T. Lee if [[ "$proc_file" != "pgctrl" ]]; then 823cad8f91SDaniel T. Lee result=$(grep "Result: OK:" $proc_ctrl) || true 83b64b0d1eSJesper Dangaard Brouer if [[ "$result" == "" ]]; then 84b64b0d1eSJesper Dangaard Brouer grep "Result:" $proc_ctrl >&2 85b64b0d1eSJesper Dangaard Brouer fi 863cad8f91SDaniel T. Lee fi 87b64b0d1eSJesper Dangaard Brouer if (( $status != 0 )); then 88b64b0d1eSJesper Dangaard Brouer err 5 "Write error($status) occurred cmd: \"$@ > $proc_ctrl\"" 89b64b0d1eSJesper Dangaard Brouer fi 90b64b0d1eSJesper Dangaard Brouer} 91b64b0d1eSJesper Dangaard Brouer 92b64b0d1eSJesper Dangaard Brouer# Old obsolete "pgset" function, with slightly improved err handling 93b64b0d1eSJesper Dangaard Brouerfunction pgset() { 94b64b0d1eSJesper Dangaard Brouer local result 95b64b0d1eSJesper Dangaard Brouer 96b64b0d1eSJesper Dangaard Brouer if [[ "$DEBUG" == "yes" ]]; then 97b64b0d1eSJesper Dangaard Brouer echo "cmd: $1 > $PGDEV" 98b64b0d1eSJesper Dangaard Brouer fi 99b64b0d1eSJesper Dangaard Brouer echo $1 > $PGDEV 100b64b0d1eSJesper Dangaard Brouer local status=$? 101b64b0d1eSJesper Dangaard Brouer 102b64b0d1eSJesper Dangaard Brouer result=`cat $PGDEV | fgrep "Result: OK:"` 103b64b0d1eSJesper Dangaard Brouer if [[ "$result" == "" ]]; then 104b64b0d1eSJesper Dangaard Brouer cat $PGDEV | fgrep Result: 105b64b0d1eSJesper Dangaard Brouer fi 106b64b0d1eSJesper Dangaard Brouer if (( $status != 0 )); then 107b64b0d1eSJesper Dangaard Brouer err 5 "Write error($status) occurred cmd: \"$1 > $PGDEV\"" 108b64b0d1eSJesper Dangaard Brouer fi 109b64b0d1eSJesper Dangaard Brouer} 110b64b0d1eSJesper Dangaard Brouer 111*a27ac539SJ.J. Martzkifunction trap_exit() 112*a27ac539SJ.J. Martzki{ 113c8fd4852SIgor Russkikh # Cleanup pktgen setup on exit if thats not "append mode" 114*a27ac539SJ.J. Martzki if [[ -z "$APPEND" ]] && [[ $EUID -eq 0 ]]; then 115c8fd4852SIgor Russkikh trap 'pg_ctrl "reset"' EXIT 116c8fd4852SIgor Russkikh fi 117*a27ac539SJ.J. Martzki} 1183cad8f91SDaniel T. Lee 119b64b0d1eSJesper Dangaard Brouer## -- General shell tricks -- 120b64b0d1eSJesper Dangaard Brouer 121b64b0d1eSJesper Dangaard Brouerfunction root_check_run_with_sudo() { 122b64b0d1eSJesper Dangaard Brouer # Trick so, program can be run as normal user, will just use "sudo" 123b64b0d1eSJesper Dangaard Brouer # call as root_check_run_as_sudo "$@" 124b64b0d1eSJesper Dangaard Brouer if [ "$EUID" -ne 0 ]; then 125b64b0d1eSJesper Dangaard Brouer if [ -x $0 ]; then # Directly executable use sudo 126b64b0d1eSJesper Dangaard Brouer info "Not root, running with sudo" 1277caeabd7SJuhee Kang sudo -E "$0" "$@" 128b64b0d1eSJesper Dangaard Brouer exit $? 129b64b0d1eSJesper Dangaard Brouer fi 130b64b0d1eSJesper Dangaard Brouer err 4 "cannot perform sudo run of $0" 131b64b0d1eSJesper Dangaard Brouer fi 132b64b0d1eSJesper Dangaard Brouer} 13322ac5ad4SRobert Hoo 13422ac5ad4SRobert Hoo# Exact input device's NUMA node info 13522ac5ad4SRobert Hoofunction get_iface_node() 13622ac5ad4SRobert Hoo{ 13722ac5ad4SRobert Hoo local node=$(</sys/class/net/$1/device/numa_node) 13822ac5ad4SRobert Hoo if [[ $node == -1 ]]; then 13922ac5ad4SRobert Hoo echo 0 14022ac5ad4SRobert Hoo else 14122ac5ad4SRobert Hoo echo $node 14222ac5ad4SRobert Hoo fi 14322ac5ad4SRobert Hoo} 14422ac5ad4SRobert Hoo 14522ac5ad4SRobert Hoo# Given an Dev/iface, get its queues' irq numbers 14622ac5ad4SRobert Hoofunction get_iface_irqs() 14722ac5ad4SRobert Hoo{ 14822ac5ad4SRobert Hoo local IFACE=$1 14922ac5ad4SRobert Hoo local queues="${IFACE}-.*TxRx" 15022ac5ad4SRobert Hoo 15122ac5ad4SRobert Hoo irqs=$(grep "$queues" /proc/interrupts | cut -f1 -d:) 15222ac5ad4SRobert Hoo [ -z "$irqs" ] && irqs=$(grep $IFACE /proc/interrupts | cut -f1 -d:) 15322ac5ad4SRobert Hoo [ -z "$irqs" ] && irqs=$(for i in `ls -Ux /sys/class/net/$IFACE/device/msi_irqs` ;\ 15422ac5ad4SRobert Hoo do grep "$i:.*TxRx" /proc/interrupts | grep -v fdir | cut -f 1 -d : ;\ 15522ac5ad4SRobert Hoo done) 15622ac5ad4SRobert Hoo [ -z "$irqs" ] && err 3 "Could not find interrupts for $IFACE" 15722ac5ad4SRobert Hoo 15822ac5ad4SRobert Hoo echo $irqs 15922ac5ad4SRobert Hoo} 16022ac5ad4SRobert Hoo 16122ac5ad4SRobert Hoo# Given a NUMA node, return cpu ids belonging to it. 16222ac5ad4SRobert Hoofunction get_node_cpus() 16322ac5ad4SRobert Hoo{ 16422ac5ad4SRobert Hoo local node=$1 16522ac5ad4SRobert Hoo local node_cpu_list 16622ac5ad4SRobert Hoo local node_cpu_range_list=`cut -f1- -d, --output-delimiter=" " \ 16722ac5ad4SRobert Hoo /sys/devices/system/node/node$node/cpulist` 16822ac5ad4SRobert Hoo 16922ac5ad4SRobert Hoo for cpu_range in $node_cpu_range_list 17022ac5ad4SRobert Hoo do 17122ac5ad4SRobert Hoo node_cpu_list="$node_cpu_list "`seq -s " " ${cpu_range//-/ }` 17222ac5ad4SRobert Hoo done 17322ac5ad4SRobert Hoo 17422ac5ad4SRobert Hoo echo $node_cpu_list 17522ac5ad4SRobert Hoo} 176226b96c2SDaniel T. Lee 177f0681d95SDaniel T. Lee# Check $1 is in between $2, $3 ($2 <= $1 <= $3) 178f0681d95SDaniel T. Leefunction in_between() { [[ ($1 -ge $2) && ($1 -le $3) ]] ; } 179f0681d95SDaniel T. Lee 180f0681d95SDaniel T. Lee# Extend shrunken IPv6 address. 181f0681d95SDaniel T. Lee# fe80::42:bcff:fe84:e10a => fe80:0:0:0:42:bcff:fe84:e10a 182f0681d95SDaniel T. Leefunction extend_addr6() 183f0681d95SDaniel T. Lee{ 184f0681d95SDaniel T. Lee local addr=$1 185f0681d95SDaniel T. Lee local sep=: sep2=:: 186f0681d95SDaniel T. Lee local sep_cnt=$(tr -cd $sep <<< $1 | wc -c) 187f0681d95SDaniel T. Lee local shrink 188f0681d95SDaniel T. Lee 189f0681d95SDaniel T. Lee # separator count should be (2 <= $sep_cnt <= 7) 190f0681d95SDaniel T. Lee if ! (in_between $sep_cnt 2 7); then 191f0681d95SDaniel T. Lee err 5 "Invalid IP6 address: $1" 192f0681d95SDaniel T. Lee fi 193f0681d95SDaniel T. Lee 194f0681d95SDaniel T. Lee # if shrink '::' occurs multiple, it's malformed. 1956dcd6d01STiezhu Yang shrink=( $(grep -E -o "$sep{2,}" <<< $addr) ) 196f0681d95SDaniel T. Lee if [[ ${#shrink[@]} -ne 0 ]]; then 197f0681d95SDaniel T. Lee if [[ ${#shrink[@]} -gt 1 || ( ${shrink[0]} != $sep2 ) ]]; then 198f0681d95SDaniel T. Lee err 5 "Invalid IP6 address: $1" 199f0681d95SDaniel T. Lee fi 200f0681d95SDaniel T. Lee fi 201f0681d95SDaniel T. Lee 202f0681d95SDaniel T. Lee # add 0 at begin & end, and extend addr by adding :0 203f0681d95SDaniel T. Lee [[ ${addr:0:1} == $sep ]] && addr=0${addr} 204f0681d95SDaniel T. Lee [[ ${addr: -1} == $sep ]] && addr=${addr}0 205f0681d95SDaniel T. Lee echo "${addr/$sep2/$(printf ':0%.s' $(seq $[8-sep_cnt])):}" 206f0681d95SDaniel T. Lee} 207f0681d95SDaniel T. Lee 208f0681d95SDaniel T. Lee# Given a single IP(v4/v6) address, whether it is valid. 209f0681d95SDaniel T. Leefunction validate_addr() 210f0681d95SDaniel T. Lee{ 211f0681d95SDaniel T. Lee # check function is called with (funcname)6 212f0681d95SDaniel T. Lee [[ ${FUNCNAME[1]: -1} == 6 ]] && local IP6=6 213f0681d95SDaniel T. Lee local bitlen=$[ IP6 ? 128 : 32 ] 214f0681d95SDaniel T. Lee local len=$[ IP6 ? 8 : 4 ] 215f0681d95SDaniel T. Lee local max=$[ 2**(len*2)-1 ] 216f0681d95SDaniel T. Lee local net prefix 217f0681d95SDaniel T. Lee local addr sep 218f0681d95SDaniel T. Lee 219f0681d95SDaniel T. Lee IFS='/' read net prefix <<< $1 220f0681d95SDaniel T. Lee [[ $IP6 ]] && net=$(extend_addr6 $net) 221f0681d95SDaniel T. Lee 222f0681d95SDaniel T. Lee # if prefix exists, check (0 <= $prefix <= $bitlen) 223f0681d95SDaniel T. Lee if [[ -n $prefix ]]; then 224f0681d95SDaniel T. Lee if ! (in_between $prefix 0 $bitlen); then 225f0681d95SDaniel T. Lee err 5 "Invalid prefix: /$prefix" 226f0681d95SDaniel T. Lee fi 227f0681d95SDaniel T. Lee fi 228f0681d95SDaniel T. Lee 229f0681d95SDaniel T. Lee # set separator for each IP(v4/v6) 230f0681d95SDaniel T. Lee [[ $IP6 ]] && sep=: || sep=. 231f0681d95SDaniel T. Lee IFS=$sep read -a addr <<< $net 232f0681d95SDaniel T. Lee 233f0681d95SDaniel T. Lee # array length 234f0681d95SDaniel T. Lee if [[ ${#addr[@]} != $len ]]; then 235f0681d95SDaniel T. Lee err 5 "Invalid IP$IP6 address: $1" 236f0681d95SDaniel T. Lee fi 237f0681d95SDaniel T. Lee 238f0681d95SDaniel T. Lee # check each digit (0 <= $digit <= $max) 239f0681d95SDaniel T. Lee for digit in "${addr[@]}"; do 240f0681d95SDaniel T. Lee [[ $IP6 ]] && digit=$[ 16#$digit ] 241f0681d95SDaniel T. Lee if ! (in_between $digit 0 $max); then 242f0681d95SDaniel T. Lee err 5 "Invalid IP$IP6 address: $1" 243f0681d95SDaniel T. Lee fi 244f0681d95SDaniel T. Lee done 245f0681d95SDaniel T. Lee 246f0681d95SDaniel T. Lee return 0 247f0681d95SDaniel T. Lee} 248f0681d95SDaniel T. Lee 249f0681d95SDaniel T. Leefunction validate_addr6() { validate_addr $@ ; } 250f0681d95SDaniel T. Lee 251f0681d95SDaniel T. Lee# Given a single IP(v4/v6) or CIDR, return minimum and maximum IP addr. 252f0681d95SDaniel T. Leefunction parse_addr() 253f0681d95SDaniel T. Lee{ 254f0681d95SDaniel T. Lee # check function is called with (funcname)6 255f0681d95SDaniel T. Lee [[ ${FUNCNAME[1]: -1} == 6 ]] && local IP6=6 256f0681d95SDaniel T. Lee local net prefix 257f0681d95SDaniel T. Lee local min_ip max_ip 258f0681d95SDaniel T. Lee 259f0681d95SDaniel T. Lee IFS='/' read net prefix <<< $1 260f0681d95SDaniel T. Lee [[ $IP6 ]] && net=$(extend_addr6 $net) 261f0681d95SDaniel T. Lee 262f0681d95SDaniel T. Lee if [[ -z $prefix ]]; then 263f0681d95SDaniel T. Lee min_ip=$net 264f0681d95SDaniel T. Lee max_ip=$net 265f0681d95SDaniel T. Lee else 266f0681d95SDaniel T. Lee # defining array for converting Decimal 2 Binary 267f0681d95SDaniel T. Lee # 00000000 00000001 00000010 00000011 00000100 ... 268f0681d95SDaniel T. Lee local d2b='{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}' 269f0681d95SDaniel T. Lee [[ $IP6 ]] && d2b+=$d2b 270f0681d95SDaniel T. Lee eval local D2B=($d2b) 271f0681d95SDaniel T. Lee 272f0681d95SDaniel T. Lee local bitlen=$[ IP6 ? 128 : 32 ] 273f0681d95SDaniel T. Lee local remain=$[ bitlen-prefix ] 274f0681d95SDaniel T. Lee local octet=$[ IP6 ? 16 : 8 ] 275f0681d95SDaniel T. Lee local min_mask max_mask 276f0681d95SDaniel T. Lee local min max 277f0681d95SDaniel T. Lee local ip_bit 278f0681d95SDaniel T. Lee local ip sep 279f0681d95SDaniel T. Lee 280f0681d95SDaniel T. Lee # set separator for each IP(v4/v6) 281f0681d95SDaniel T. Lee [[ $IP6 ]] && sep=: || sep=. 282f0681d95SDaniel T. Lee IFS=$sep read -ra ip <<< $net 283f0681d95SDaniel T. Lee 284f0681d95SDaniel T. Lee min_mask="$(printf '1%.s' $(seq $prefix))$(printf '0%.s' $(seq $remain))" 285f0681d95SDaniel T. Lee max_mask="$(printf '0%.s' $(seq $prefix))$(printf '1%.s' $(seq $remain))" 286f0681d95SDaniel T. Lee 287f0681d95SDaniel T. Lee # calculate min/max ip with &,| operator 288f0681d95SDaniel T. Lee for i in "${!ip[@]}"; do 289f0681d95SDaniel T. Lee digit=$[ IP6 ? 16#${ip[$i]} : ${ip[$i]} ] 290f0681d95SDaniel T. Lee ip_bit=${D2B[$digit]} 291f0681d95SDaniel T. Lee 292f0681d95SDaniel T. Lee idx=$[ octet*i ] 293f0681d95SDaniel T. Lee min[$i]=$[ 2#$ip_bit & 2#${min_mask:$idx:$octet} ] 294f0681d95SDaniel T. Lee max[$i]=$[ 2#$ip_bit | 2#${max_mask:$idx:$octet} ] 295f0681d95SDaniel T. Lee [[ $IP6 ]] && { min[$i]=$(printf '%X' ${min[$i]}); 296f0681d95SDaniel T. Lee max[$i]=$(printf '%X' ${max[$i]}); } 297f0681d95SDaniel T. Lee done 298f0681d95SDaniel T. Lee 299f0681d95SDaniel T. Lee min_ip=$(IFS=$sep; echo "${min[*]}") 300f0681d95SDaniel T. Lee max_ip=$(IFS=$sep; echo "${max[*]}") 301f0681d95SDaniel T. Lee fi 302f0681d95SDaniel T. Lee 303f0681d95SDaniel T. Lee echo $min_ip $max_ip 304f0681d95SDaniel T. Lee} 305f0681d95SDaniel T. Lee 306f0681d95SDaniel T. Leefunction parse_addr6() { parse_addr $@ ; } 307f0681d95SDaniel T. Lee 308226b96c2SDaniel T. Lee# Given a single or range of port(s), return minimum and maximum port number. 309226b96c2SDaniel T. Leefunction parse_ports() 310226b96c2SDaniel T. Lee{ 311226b96c2SDaniel T. Lee local port_str=$1 312226b96c2SDaniel T. Lee local port_list 313226b96c2SDaniel T. Lee local min_port 314226b96c2SDaniel T. Lee local max_port 315226b96c2SDaniel T. Lee 316226b96c2SDaniel T. Lee IFS="-" read -ra port_list <<< $port_str 317226b96c2SDaniel T. Lee 318226b96c2SDaniel T. Lee min_port=${port_list[0]} 319226b96c2SDaniel T. Lee max_port=${port_list[1]:-$min_port} 320226b96c2SDaniel T. Lee 321226b96c2SDaniel T. Lee echo $min_port $max_port 322226b96c2SDaniel T. Lee} 323226b96c2SDaniel T. Lee 324226b96c2SDaniel T. Lee# Given a minimum and maximum port, verify port number. 325226b96c2SDaniel T. Leefunction validate_ports() 326226b96c2SDaniel T. Lee{ 327226b96c2SDaniel T. Lee local min_port=$1 328226b96c2SDaniel T. Lee local max_port=$2 329226b96c2SDaniel T. Lee 330f0681d95SDaniel T. Lee # 1 <= port <= 65535 331f0681d95SDaniel T. Lee if (in_between $min_port 1 65535); then 332f0681d95SDaniel T. Lee if (in_between $max_port 1 65535); then 333226b96c2SDaniel T. Lee if [[ $min_port -le $max_port ]]; then 334226b96c2SDaniel T. Lee return 0 335226b96c2SDaniel T. Lee fi 336226b96c2SDaniel T. Lee fi 337226b96c2SDaniel T. Lee fi 338226b96c2SDaniel T. Lee 339226b96c2SDaniel T. Lee err 5 "Invalid port(s): $min_port-$max_port" 340226b96c2SDaniel T. Lee} 341