David Lee wrote:
On Fri, 20 Apr 2007, Alan Robertson wrote:

Of course, we already have portable ping code in C in our base.   The
best way to do this portably is probably to use that code, which is
guaranteed not to change without us knowing about it...

Alan: The context of this discussion is for callers that are shell-scripts
(the proposed "pingd.sh"; also noting two "IPaddr.in") rather than C code.

The principle of calling the system "ping" is clean and simple -- far more
so (isn't it?) than having to (re-)write a ping-like command to call the C
code in our base.

Sadly, no, it isn't. The system pings are wildly incompatible and lacking in useful features. And since the C code already exists (or so I believe, as Alan made the claim), wrapping a main() and getopts() around it is trivial.

The current problem is simply that the system "ping" in different OSes has
different options, and the current discussion is about how to handle that.

So I'm wondering whether, in the case of script-based (not C) callers, we
could simply have a shell function (e.g. "pingfn") with a fixed interface
acting as a wrapper to the system-shell ping command and handling all the
relevant OS incompatibilities.

Good luck - mostly, you can't do so and keep useful semantics. How many ICMP ECHO REQUEST packets do you send? How many REPLY packets do you require for it to be "good"? How long do you wait for each packet? How long do you wait between each REQUEST, and does it depend on the timing of the REPLY? I've had to do this for our monitoring system, and ended up writing a wrapper around fping.

--
Carson
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to