From 80148aaf3356c2ae817b9d31e704afbf2b6421c1 Mon Sep 17 00:00:00 2001 From: archie Date: Fri, 25 Jun 1999 21:48:40 +0000 Subject: Fix bug (introduced by me) where UDP port numbers were starting at 1 instead of 33435 like before. Reported by: John Polstra --- contrib/traceroute/traceroute.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'contrib/traceroute') 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); -- cgit v1.1