liboping icon indicating copy to clipboard operation
liboping copied to clipboard

Getting timeout reading PING_INFO_LATENCY on loopback

Open polaco1782 opened this issue 8 years ago • 3 comments

I'm having an issue when trying to read latency info from iterator, it always returns -1 on my mips testing board. I think it is an endian issue, I'll try to have a look on oping sources.

The same piece of code compiled on my x86 machine works fine.

Output from oping binary on my mips board

./oping 127.0.0.1

PING 127.0.0.1 (127.0.0.1) 56 bytes of data. echo reply from 127.0.0.1 (127.0.0.1): icmp_seq=1 timeout echo reply from 127.0.0.1 (127.0.0.1): icmp_seq=2 timeout echo reply from 127.0.0.1 (127.0.0.1): icmp_seq=3 timeout echo reply from 127.0.0.1 (127.0.0.1): icmp_seq=4 timeout ^C --- 127.0.0.1 ping statistics --- 4 packets transmitted, 0 received, 100.00% packet loss, time 0.0ms

Output from BusyBox ping:

ping 127.0.0.1

PING 127.0.0.1 (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: seq=0 ttl=64 time=10.000 ms 64 bytes from 127.0.0.1: seq=1 ttl=64 time=0.000 ms 64 bytes from 127.0.0.1: seq=2 ttl=64 time=0.000 ms 64 bytes from 127.0.0.1: seq=3 ttl=64 time=0.000 ms ^C --- 127.0.0.1 ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max = 0.000/2.500/10.000 ms

polaco1782 avatar Jul 03 '17 14:07 polaco1782

If I force it to use ipv4 it works against some hosts, but not on 127.0.0.1

./oping 127.0.0.1 -4

PING 127.0.0.1 (127.0.0.1) 56 bytes of data. echo reply from 127.0.0.1 (127.0.0.1): icmp_seq=1 timeout echo reply from 127.0.0.1 (127.0.0.1): icmp_seq=2 timeout echo reply from 127.0.0.1 (127.0.0.1): icmp_seq=3 timeout ^C --- 127.0.0.1 ping statistics --- 3 packets transmitted, 0 received, 100.00% packet loss, time 0.0ms

Pinging on IPv4 against a host:

./oping terra.com.br -4

PING 208.84.244.116 (208.84.244.116) 56 bytes of data. 56 bytes from 208.84.244.116 (208.84.244.116): icmp_seq=1 ttl=54 qos=0x01 time=160.00 ms 56 bytes from 208.84.244.116 (208.84.244.116): icmp_seq=2 ttl=54 qos=0x01 time=150.00 ms 56 bytes from 208.84.244.116 (208.84.244.116): icmp_seq=3 ttl=54 qos=0x01 time=150.00 ms ^C --- 208.84.244.116 ping statistics --- 3 packets transmitted, 3 received, 0.00% packet loss, time 460.0ms RTT[ms]: min = 150, median = 150, p(95) = 160, max = 160

The same host, but omit the -4 flag

./oping terra.com.br

PING 2604:600:0:aaaa:208:84:244:116 (2604:600:0:aaaa:208:84:244:116) 56 bytes of data. echo reply from 2604:600:0:aaaa:208:84:244:116 (2604:600:0:aaaa:208:84:244:116): icmp_seq=1 timeout echo reply from 2604:600:0:aaaa:208:84:244:116 (2604:600:0:aaaa:208:84:244:116): icmp_seq=2 timeout echo reply from 2604:600:0:aaaa:208:84:244:116 (2604:600:0:aaaa:208:84:244:116): icmp_seq=3 timeout echo reply from 2604:600:0:aaaa:208:84:244:116 (^C --- 2604:600:0:aaaa:208:84:244:116 ping statistics --- 4 packets transmitted, 0 received, 100.00% packet loss, time 0.0ms

Somehow oping prefers ipv6 over ipv4. Am I doing something wrong?

polaco1782 avatar Jul 03 '17 17:07 polaco1782

Hmm I figured out that this might be incorrect,

if (latency > 0.0)
{
.......
}
else
{
    HOST_PRINTF ("echo reply from %s (%s): icmp_seq=%u timeout\n",
		context->host, context->addr, sequence);
}

May lead to a false timeout on a fast network, and you cant probe loopback interfaces.

polaco1782 avatar Jul 03 '17 17:07 polaco1782

Did you try using '-w 10' to match the timeout in ping.c?

nihilus avatar Apr 20 '19 00:04 nihilus