From: Brent Cook <bcook@bpointsys.com>
To: Michele BOLOGNA <michele.bologna@gmail.com>
Cc: yoshfuji@linux-ipv6.org, netdev@vger.kernel.org
Subject: Re: strange behaviour in ping when specifying timeout in msec
Date: Mon, 10 Aug 2009 14:09:43 -0500 [thread overview]
Message-ID: <200908101409.44106.bcook@bpointsys.com> (raw)
In-Reply-To: <13b17b8a0908051627n32ce7461j75e8459a2c54909c@mail.gmail.com>
On Wednesday 05 August 2009 06:27:14 pm Michele BOLOGNA wrote:
> Dear Mr. Yoshifuji,
> I recently noticed a strange behaviour in ping from iputils.
>
> First of all some information:
> mbologna@neptune:~$ ping -V
> ping utility, iputils-sss20071127
>
> Now, I want to specify a timeout and after it expires I would like
> that ping exits, regardless of the packets received, so I use the -W
> option:
>
> -W timeout
> Time to wait for a response, in seconds. The option affects
> only timeout in absense of any responses, otherwise ping waits for two
> RTTs.
If you check out the source to ping, you will see that the results of non-
integer arguments to -W is undefined, since atoi cannot detect errors. In your
case, its probably being interpreted as 0. You can enter almost any value for
-W without it showing an error, e.g. 'cat' or 'dog'.
case 'W':
lingertime = atoi(optarg);
if (lingertime < 0 || lingertime > INT_MAX/1000000) {
fprintf(stderr, "ping: bad linger time.\n");
exit(2);
}
lingertime *= 1000;
break;
Your best bet is perhaps to modify ping to parse time using strtof perhaps.
- Brent
prev parent reply other threads:[~2009-08-10 19:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-05 23:27 strange behaviour in ping when specifying timeout in msec Michele BOLOGNA
2009-08-10 19:09 ` Brent Cook [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200908101409.44106.bcook@bpointsys.com \
--to=bcook@bpointsys.com \
--cc=michele.bologna@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.