Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/traceroute6 check port number range. sync w/kame, ...
details: https://anonhg.NetBSD.org/src/rev/65318ac6fc41
branches: trunk
changeset: 533385:65318ac6fc41
user: itojun <itojun%NetBSD.org@localhost>
date: Sat Jun 29 07:49:25 2002 +0000
description:
check port number range. sync w/kame, pointed out by deraadt
diffstat:
usr.sbin/traceroute6/traceroute6.c | 26 ++++++++++++++------------
1 files changed, 14 insertions(+), 12 deletions(-)
diffs (96 lines):
diff -r bddedaaac633 -r 65318ac6fc41 usr.sbin/traceroute6/traceroute6.c
--- a/usr.sbin/traceroute6/traceroute6.c Sat Jun 29 05:30:44 2002 +0000
+++ b/usr.sbin/traceroute6/traceroute6.c Sat Jun 29 07:49:25 2002 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: traceroute6.c,v 1.22 2002/06/09 02:45:26 itojun Exp $ */
-/* $KAME: traceroute6.c,v 1.50 2002/05/26 13:12:07 itojun Exp $ */
+/* $NetBSD: traceroute6.c,v 1.23 2002/06/29 07:49:25 itojun Exp $ */
+/* $KAME: traceroute6.c,v 1.53 2002/06/09 02:45:52 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -79,7 +79,7 @@
#else
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: traceroute6.c,v 1.22 2002/06/09 02:45:26 itojun Exp $");
+__RCSID("$NetBSD: traceroute6.c,v 1.23 2002/06/29 07:49:25 itojun Exp $");
#endif
#endif
@@ -349,8 +349,8 @@
int nprobes = 3;
int first_hop = 1;
int max_hops = 30;
-u_short srcport;
-u_short port = 32768+666; /* start udp dest port # for probe packets */
+u_int16_t srcport;
+u_int16_t port = 32768+666; /* start udp dest port # for probe packets */
int options; /* socket options */
int verbose;
int waittime = 5; /* time to wait for response (in seconds) */
@@ -371,6 +371,7 @@
char *ep;
int mib[4] = { CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_DEFHLIM };
size_t size = sizeof(max_hops);
+ u_long lport;
/*
* Receive ICMP
@@ -414,7 +415,7 @@
seq = 0;
while ((ch = getopt(argc, argv, "df:g:lm:np:q:rs:w:v")) != -1)
- switch(ch) {
+ switch (ch) {
case 'd':
options |= SO_DEBUG;
break;
@@ -492,16 +493,17 @@
break;
case 'p':
ep = NULL;
- port = strtoul(optarg, &ep, 0);
+ lport = strtoul(optarg, &ep, 0);
if (!*argv || *ep) {
fprintf(stderr, "traceroute6: port.\n");
exit(1);
}
- if (port < 1) {
+ if (lport == 0 || lport != (lport & 0xffff)) {
fprintf(stderr,
- "traceroute6: port must be >0.\n");
+ "traceroute6: port out of range.\n");
exit(1);
}
+ port = lport & 0xffff;
break;
case 'q':
ep = NULL;
@@ -850,7 +852,7 @@
lastaddr = Rcv.sin6_addr;
}
printf(" %g ms", deltaT(&t1, &t2));
- switch(i - 1) {
+ switch (i - 1) {
case ICMP6_DST_UNREACH_NOROUTE:
++unreachable;
printf(" !N");
@@ -1166,7 +1168,7 @@
if (getnameinfo((struct sockaddr *)from, from->sin6_len,
sbuf, sizeof(sbuf), NULL, 0, NI_NUMERICHOST) != 0)
- strlcpy(sbuf, "invalid", sizeof(hbuf));
+ strlcpy(sbuf, "invalid", sizeof(sbuf));
printf("\n%d bytes from %s to %s", cc, sbuf,
rcvpktinfo ? inet_ntop(AF_INET6, &rcvpktinfo->ipi6_addr,
dbuf, sizeof(dbuf)) : "?");
@@ -1207,7 +1209,7 @@
cp += sizeof(struct ip6_hdr);
while (lim - cp >= 8) {
- switch(nh) {
+ switch (nh) {
case IPPROTO_ESP:
case IPPROTO_TCP:
case IPPROTO_ICMPV6:
Home |
Main Index |
Thread Index |
Old Index