summaryrefslogtreecommitdiffstats
path: root/contrib/traceroute
diff options
context:
space:
mode:
authorarchie <archie@FreeBSD.org>1999-06-25 21:48:40 +0000
committerarchie <archie@FreeBSD.org>1999-06-25 21:48:40 +0000
commit80148aaf3356c2ae817b9d31e704afbf2b6421c1 (patch)
tree987b5f011880bed35465d9b54b049ae1ffb8cde9 /contrib/traceroute
parent9409c1b0e245abd218ec0f82bd3eb7f2adff8173 (diff)
downloadFreeBSD-src-80148aaf3356c2ae817b9d31e704afbf2b6421c1.zip
FreeBSD-src-80148aaf3356c2ae817b9d31e704afbf2b6421c1.tar.gz
Fix bug (introduced by me) where UDP port numbers were starting at 1 instead
of 33435 like before. Reported by: John Polstra <jdp@polstra.com>
Diffstat (limited to 'contrib/traceroute')
-rw-r--r--contrib/traceroute/traceroute.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/contrib/traceroute/traceroute.c b/contrib/traceroute/traceroute.c
index 641577c..8d75a55 100644
--- a/contrib/traceroute/traceroute.c
+++ b/contrib/traceroute/traceroute.c
@@ -24,7 +24,7 @@ static const char copyright[] =
"@(#) Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996\n\
The Regents of the University of California. All rights reserved.\n";
static const char rcsid[] =
- "@(#)$Header: /home/ncvs/src/contrib/traceroute/traceroute.c,v 1.9 1999/05/06 03:23:24 archie Exp $ (LBL)";
+ "@(#)$Header: /home/ncvs/src/contrib/traceroute/traceroute.c,v 1.10 1999/05/12 17:28:31 archie Exp $ (LBL)";
#endif
/*
@@ -388,6 +388,7 @@ main(int argc, char **argv)
register int tos = 0;
register int lsrr = 0;
register int optlen = 0;
+ int requestPort = -1;
int sump = 0;
int sockerrno;
@@ -487,8 +488,8 @@ main(int argc, char **argv)
break;
case 'p':
- port = atoi(optarg);
- if (port <= 0) {
+ requestPort = atoi(optarg);
+ if (requestPort <= 0) {
Fprintf(stderr, "%s: port must be > 0\n", prog);
exit(1);
}
@@ -542,6 +543,9 @@ main(int argc, char **argv)
usage();
}
+ /* Set requested port, if any, else default for this protocol */
+ port = (requestPort != -1) ? requestPort : proto->port;
+
/* Check min vs. max TTL */
if (min_ttl > max_ttl) {
Fprintf(stderr, "%s: min ttl must be <= max ttl\n", prog);
OpenPOWER on IntegriCloud