Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux ping is using deadline instead of timeout for probes #100

Closed
sa-linetco opened this issue Aug 22, 2019 · 0 comments · Fixed by #101
Closed

linux ping is using deadline instead of timeout for probes #100

sa-linetco opened this issue Aug 22, 2019 · 0 comments · Fixed by #101

Comments

@sa-linetco
Copy link
Contributor

sa-linetco commented Aug 22, 2019

According to the ping manpage the parameter used for timeout should be -W. Currently -w is used, which sets the deadline option on linux. The deadline option overrides the packet count option (-n) (in some scenarios) which results in more ping requests than expected.

man ping
       -w deadline
              Specify  a  timeout,  in seconds, before ping exits regardless of how many packets have been sent or received. In this case ping does not stop after count packet are sent, it waits either for
              deadline expire or until count probes are answered or for some error notification from network.

       -W timeout
              Time to wait for a response, in seconds. The option affects only timeout in absence of any responses, otherwise ping waits for two RTTs.

Comparison between -w and -W (have a look at the "packets transmitted" count):

:~$ time /bin/ping -n -w 5 -c 1 172.29.14.32
PING 172.29.14.32 (172.29.14.32) 56(84) bytes of data.

--- 172.29.14.32 ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4098ms

real	0m5,008s
user	0m0,006s
sys	0m0,000s
:~$ time /bin/ping -n -W 5 -c 1 172.29.14.32
PING 172.29.14.32 (172.29.14.32) 56(84) bytes of data.

--- 172.29.14.32 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

real	0m5,006s
user	0m0,001s
sys	0m0,004s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant