summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-10-12 03:19:53 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-10-12 03:19:53 +0000
commite416162e60b89d051d18efb54327ee1cca208cfa (patch)
tree96c3bbfae3a6b52e3f4608e366dd9d243aca90a4
parent89e12767b0ab4b4516e9f7b794f385ebf517c809 (diff)
Stop if the sum of unreachables and timeouts are >= number of probes, but
only if we have at least one unreachable
-rw-r--r--usr.sbin/traceroute/traceroute.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c
index 80bfb6f775a..5a6f0b88bc4 100644
--- a/usr.sbin/traceroute/traceroute.c
+++ b/usr.sbin/traceroute/traceroute.c
@@ -482,6 +482,7 @@ main(argc, argv)
u_long lastaddr = 0;
int got_there = 0;
int unreachable = 0;
+ int timeout = 0;
Printf("%2d ", ttl);
for (probe = 0; probe < nprobes; ++probe) {
@@ -544,12 +545,14 @@ main(argc, argv)
break;
}
}
- if (cc == 0)
+ if (cc == 0) {
Printf(" *");
+ timeout++;
+ }
(void) fflush(stdout);
}
putchar('\n');
- if (got_there || unreachable >= nprobes)
+ if (got_there || (unreachable && (unreachable + timeout) >= nprobes))
exit(0);
}
}