When the kernel cannot send out a packet to a host because the host or network
is unreachable, `sendto' may return with `EHOSTUNREACH' or `ENETUNREACH'. So
far all errors returned by `sendto' were considered fatal and the pinging was
aborted. This is wrong when the host is unreachable, so catching and ignoring
these errors is reasonable..
Thanks to Wolfgang Kroener for reporting and debigging this problem with me :)
(struct sockaddr *) ph->addr, ph->addrlen);
if (ret < 0)
+ {
+#if defined(EHOSTUNREACH)
+ if (errno == EHOSTUNREACH)
+ return (0);
+#endif
+#if defined(ENETUNREACH)
+ if (errno == ENETUNREACH)
+ return (0);
+#endif
ping_set_error (obj, "sendto", strerror (errno));
+ }
return (ret);
}