.IR ttl .
.HP 7
.TP
-.B no-route
-There was no route to the host used in a
+.B no-route-network
+.B no-route-host
+There was no route to the network or the host itself for the
.B send-probe
-request.
+request used to reach the host.
.TP
.B network-down
A probe could not be sent because the network is down.
.TP
+.B host-down
+A probe could not be sent because the host is down.
+.TP
.B probes-exhausted
A probe could not be sent because there are already too many unresolved
probes in flight.
if (icmp_type == ICMP_TIME_EXCEEDED) {
result = "ttl-expired";
} else if (icmp_type == ICMP_DEST_UNREACH) {
- result = "no-route";
+ /* XXX icmphdr->code is not known here, so assume that host is unreachable */
+ result = "no-route-host";
} else {
assert(icmp_type == ICMP_ECHOREPLY);
result = "reply";
printf("%d invalid-argument\n", command_token);
} else if (errno == ENETDOWN) {
printf("%d network-down\n", command_token);
+ } else if (errno == EHOSTDOWN) {
+ printf("%d host-down\n", command_token);
} else if (errno == ENETUNREACH) {
- printf("%d no-route\n", command_token);
+ printf("%d no-route-network\n", command_token);
} else if (errno == EHOSTUNREACH) {
- printf("%d no-route\n", command_token);
+ printf("%d no-route-host\n", command_token);
} else if (errno == EPERM) {
printf("%d permission-denied\n", command_token);
} else if (errno == EADDRINUSE) {
if (!strcmp(reply_name, "reply")
|| !strcmp(reply_name, "ttl-expired")) {
err = 0;
- } else if (!strcmp(reply_name, "no-route")) {
- err = ENETUNREACH;
} else if (!strcmp(reply_name, "network-down")) {
err = ENETDOWN;
+ } else if (!strcmp(reply_name, "host-down")) {
+ err = EHOSTDOWN;
+ } else if (!strcmp(reply_name, "no-route-network")) {
+ err = ENETUNREACH;
+ } else if (!strcmp(reply_name, "no-route-host")) {
+ err = EHOSTUNREACH;
} else {
/* If the reply type is unknown, ignore it */
return;
char *host_error_to_string(
int err)
{
- if (err == ENETUNREACH) {
+ if (err == ENETDOWN)
+ return "network is down";
+ else if (err == EHOSTDOWN)
+ return "host is down";
+ else if (err == ENETUNREACH)
+ return "no route to network";
+ else if (err == EHOSTUNREACH)
return "no route to host";
- }
-
- if (err == ENETDOWN) {
- return "network down";
- }
-
- if (err == 0) {
+ else if (err == 0)
return "waiting for reply";
- }
return strerror(err);
}