mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2026-01-28 01:47:18 +01:00
Fix udpecho protocol selection
This commit is contained in:
parent
7e708fba40
commit
679beb4edd
2 changed files with 5 additions and 7 deletions
|
|
@ -47,7 +47,6 @@ serverselection_launch() {
|
|||
[ -z "${port}" ] && port=7
|
||||
[ -z "${protocol_used}" ] && protocol_used="ICMP"
|
||||
ip_addr_used=$(get_ip_addr_used "${ip_proto}" "${iface}")
|
||||
if [ "$ip_proto" = "IPv4" ]; then ip_proto="-4"; elif [ "$ip_proto" = "IPv6" ]; then ip_proto="-6"; else ip_proto=""; fi
|
||||
[ -z "${timeout}" ] && timeout=1 || timeout=$((timeout/1000))
|
||||
|
||||
# Fail if hostlist is empty
|
||||
|
|
@ -66,6 +65,7 @@ serverselection_launch() {
|
|||
|
||||
for host in $(echo "$hostlist" | tr "," "\n"); do
|
||||
if [ "$protocol_used" = "ICMP" ]; then
|
||||
if [ "$ip_proto" = "IPv4" ]; then ip_proto="-4"; elif [ "$ip_proto" = "IPv6" ]; then ip_proto="-6"; else ip_proto=""; fi
|
||||
[ -n "${iface}" ] && device=$(ifstatus "${iface}" | jsonfilter -e @.l3_device) && device="-I $device" || device=""
|
||||
|
||||
while [ $i -lt "$nbr_of_rep" ]; do
|
||||
|
|
@ -112,13 +112,13 @@ serverselection_launch() {
|
|||
avg_time_sum=$((avg_time_sum+avg_time))
|
||||
done
|
||||
else
|
||||
[[ "$host" == *"."* ]] && ip_proto="4" || ip_proto="6"
|
||||
if [ "$ip_proto" = "IPv4" ]; then ip_proto="--protocol 4"; elif [ "$ip_proto" = "IPv6" ]; then ip_proto="--protocol 6"; else ip_proto=""; fi
|
||||
[ -n "${iface}" ] && device=$(ifstatus "${iface}" | jsonfilter -e @.l3_device) && device="-i $device" || device=""
|
||||
|
||||
while [ $i -lt "$nbr_of_rep" ]; do
|
||||
i=$((i+1))
|
||||
|
||||
res=$(udpechoclientd -c 1 -t $timeout --host "$host" --port "$port" --protocol "$ip_proto" $device 2>&1)
|
||||
res=$(udpechoclientd -c 1 -t $timeout --host "$host" --port "$port" $ip_proto $device 2>&1)
|
||||
|
||||
ba=$(echo "$res" | grep "Can't Resolve Host Name")
|
||||
[ -n "$ba" ] && {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ udpecho_launch() {
|
|||
[ -z "${dscp}" ] && dscp=0
|
||||
[ -n "${iface}" ] && device=$(ifstatus "${iface}" | jsonfilter -e @.l3_device) && device="-i $device" || device=""
|
||||
ip_addr_used=$(get_ip_addr_used "${ip_proto}" "${iface}")
|
||||
if [ "$ip_proto" = "IPv4" ]; then ip_proto="4"; elif [ "$ip_proto" = "IPv6" ]; then ip_proto="6"; else ip_proto="4"; fi
|
||||
if [ "$ip_proto" = "IPv4" ]; then ip_proto="--protocol 4"; elif [ "$ip_proto" = "IPv6" ]; then ip_proto="--protocol 6"; else ip_proto=""; fi
|
||||
[ -z "${timeout}" ] && timeout=1 || timeout=$((timeout/1000))
|
||||
[ -z "${inter_time}" ] && inter_time=1 || inter_time=$((inter_time/1000))
|
||||
tos=$((dscp<<2))
|
||||
|
|
@ -65,8 +65,6 @@ udpecho_launch() {
|
|||
return
|
||||
}
|
||||
|
||||
[[ "$host" = *"."* ]] && ip_proto="4" || ip_proto="6"
|
||||
|
||||
micros=1000
|
||||
success_count=0
|
||||
avg_time_sum=0
|
||||
|
|
@ -77,7 +75,7 @@ udpecho_launch() {
|
|||
while [ $i -lt "$nbr_of_rep" ]; do
|
||||
i=$((i+1))
|
||||
|
||||
res=$(udpechoclientd -c 1 -t $timeout --host "$host" --data-length "$dsize" --port "$port" --protocol "$ip_proto" $device 2>&1)
|
||||
res=$(udpechoclientd -c 1 -t $timeout --host "$host" --data-length "$dsize" --port "$port" $ip_proto $device 2>&1)
|
||||
|
||||
ba=$(echo "$res" | grep "Can't Resolve Host Name")
|
||||
[ -n "$ba" ] && {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue