CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: roy Date: Wed Feb 3 06:42:50 UTC 2021 Modified Files: src/usr.sbin/traceroute6: Makefile traceroute6.c Log Message: traceroute6: Remove __packed To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/traceroute6/Makefile cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/traceroute6/traceroute6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/Makefile diff -u src/usr.sbin/traceroute6/Makefile:1.11 src/usr.sbin/traceroute6/Makefile:1.12 --- src/usr.sbin/traceroute6/Makefile:1.11 Sun Sep 6 07:20:33 2020 +++ src/usr.sbin/traceroute6/Makefile Wed Feb 3 06:42:50 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.11 2020/09/06 07:20:33 mrg Exp $ +# $NetBSD: Makefile,v 1.12 2021/02/03 06:42:50 roy Exp $ USE_FORT?= yes # network client @@ -20,6 +20,4 @@ CPPFLAGS+=-I${TRACEROUTE} .PATH: ${TRACEROUTE} -CWARNFLAGS.gcc+=${GCC_NO_ADDR_OF_PACKED_MEMBER} - .include Index: src/usr.sbin/traceroute6/traceroute6.c diff -u src/usr.sbin/traceroute6/traceroute6.c:1.51 src/usr.sbin/traceroute6/traceroute6.c:1.52 --- src/usr.sbin/traceroute6/traceroute6.c:1.51 Mon Apr 23 18:59:03 2018 +++ src/usr.sbin/traceroute6/traceroute6.c Wed Feb 3 06:42:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: traceroute6.c,v 1.51 2018/04/23 18:59:03 maxv Exp $ */ +/* $NetBSD: traceroute6.c,v 1.52 2021/02/03 06:42:50 roy Exp $ */ /* $KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $ */ /* @@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c #else #include #ifndef lint -__RCSID("$NetBSD: traceroute6.c,v 1.51 2018/04/23 18:59:03 maxv Exp $"); +__RCSID("$NetBSD: traceroute6.c,v 1.52 2021/02/03 06:42:50 roy Exp $"); #endif #endif @@ -306,7 +306,7 @@ struct opacket { u_char hops; /* hop limit of the packet */ u_char pad[2]; struct tv32 tv; /* time packet left */ -} __packed; +}; static u_char packet[512]; /* last inbound (icmp) packet */ static struct opacket *outpacket; /* last output (udp) packet */
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: christos Date: Thu May 13 18:19:18 UTC 2010 Modified Files: src/usr.sbin/traceroute6: traceroute6.c Log Message: PR/19069: SUENAGA Hiroki: Original fix was defective because on big endian the expression is not truncated to 16 bits, thus sending to port 65536 makes the == 0 test fail and the packet ends up being sent. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/traceroute6/traceroute6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.c diff -u src/usr.sbin/traceroute6/traceroute6.c:1.38 src/usr.sbin/traceroute6/traceroute6.c:1.39 --- src/usr.sbin/traceroute6/traceroute6.c:1.38 Mon Feb 16 15:36:11 2009 +++ src/usr.sbin/traceroute6/traceroute6.c Thu May 13 14:19:18 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: traceroute6.c,v 1.38 2009/02/16 20:36:11 is Exp $ */ +/* $NetBSD: traceroute6.c,v 1.39 2010/05/13 18:19:18 christos Exp $ */ /* $KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $ */ /* @@ -75,7 +75,7 @@ #else #include #ifndef lint -__RCSID("$NetBSD: traceroute6.c,v 1.38 2009/02/16 20:36:11 is Exp $"); +__RCSID("$NetBSD: traceroute6.c,v 1.39 2010/05/13 18:19:18 christos Exp $"); #endif #endif @@ -864,7 +864,7 @@ struct timeval t1, t2; (void) gettimeofday(&t1, NULL); - if (!useicmp && htons(port + seq + 1) == 0) + if (!useicmp && htons((in_port_t)(port + seq + 1)) == 0) seq++; send_probe(++seq, hops); while ((cc = wait_for_reply(rcvsock, &rcvmhdr))) {
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: christos Date: Mon Dec 10 18:11:34 UTC 2012 Modified Files: src/usr.sbin/traceroute6: traceroute6.c Log Message: PR/47304: Kouki Ooyatsu: -s (source IPv6 address to be used) option does not work because the wrong variable is used. XXX: Pullup to 6. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/traceroute6/traceroute6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.c diff -u src/usr.sbin/traceroute6/traceroute6.c:1.42 src/usr.sbin/traceroute6/traceroute6.c:1.43 --- src/usr.sbin/traceroute6/traceroute6.c:1.42 Wed Jan 4 11:09:44 2012 +++ src/usr.sbin/traceroute6/traceroute6.c Mon Dec 10 13:11:33 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: traceroute6.c,v 1.42 2012/01/04 16:09:44 drochner Exp $ */ +/* $NetBSD: traceroute6.c,v 1.43 2012/12/10 18:11:33 christos Exp $ */ /* $KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $ */ /* @@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c #else #include #ifndef lint -__RCSID("$NetBSD: traceroute6.c,v 1.42 2012/01/04 16:09:44 drochner Exp $"); +__RCSID("$NetBSD: traceroute6.c,v 1.43 2012/12/10 18:11:33 christos Exp $"); #endif #endif @@ -724,10 +724,10 @@ main(int argc, char *argv[]) if (error0) errx(1, "Cannot get address for `%s' (%s)", source, gai_strerror(error0)); - if (res->ai_addrlen > sizeof(Src)) + if (res0->ai_addrlen > sizeof(Src)) errx(1, "Bad incompatible address length"); - memcpy(&Src, res->ai_addr, res->ai_addrlen); - freeaddrinfo(res); + memcpy(&Src, res0->ai_addr, res0->ai_addrlen); + freeaddrinfo(res0); } else { struct sockaddr_in6 Nxt; int dummy;
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: christos Date: Tue May 10 01:58:58 UTC 2011 Modified Files: src/usr.sbin/traceroute6: traceroute6.8 traceroute6.c Log Message: AS additions from Zafer Aydogan to print the AS path. Minor cleanups to compile without WARNS=1 hackery. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/traceroute6/traceroute6.8 cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/traceroute6/traceroute6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.8 diff -u src/usr.sbin/traceroute6/traceroute6.8:1.11 src/usr.sbin/traceroute6/traceroute6.8:1.12 --- src/usr.sbin/traceroute6/traceroute6.8:1.11 Sat Sep 17 11:16:11 2005 +++ src/usr.sbin/traceroute6/traceroute6.8 Mon May 9 21:58:58 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: traceroute6.8,v 1.11 2005/09/17 15:16:11 ginsbach Exp $ +.\" $NetBSD: traceroute6.8,v 1.12 2011/05/10 01:58:58 christos Exp $ .\" $KAME: traceroute6.8,v 1.8 2000/06/12 16:29:18 itojun Exp $ .\" .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -39,7 +39,7 @@ .Sh SYNOPSIS .Nm traceroute6 .Bk -words -.Op Fl dIlnrv +.Op Fl adIlnrv .Ek .Bk -words .Op Fl f Ar firsthop @@ -63,12 +63,19 @@ .Op Fl w Ar waittime .Ek .Bk -words +.Op Fl A Ar as_server +.Ek +.Bk -words .Ar target .Op Ar datalen .Ek .\" .Sh DESCRIPTION .Bl -tag -width Ds +.It Fl a +Turn on AS# lookups for each hop encountered. +.It Fl A +Turn on AS# lookups and use the given server instead of the default. .It Fl d Debug mode. .It Fl f Ar firsthop Index: src/usr.sbin/traceroute6/traceroute6.c diff -u src/usr.sbin/traceroute6/traceroute6.c:1.39 src/usr.sbin/traceroute6/traceroute6.c:1.40 --- src/usr.sbin/traceroute6/traceroute6.c:1.39 Thu May 13 14:19:18 2010 +++ src/usr.sbin/traceroute6/traceroute6.c Mon May 9 21:58:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: traceroute6.c,v 1.39 2010/05/13 18:19:18 christos Exp $ */ +/* $NetBSD: traceroute6.c,v 1.40 2011/05/10 01:58:58 christos Exp $ */ /* $KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $ */ /* @@ -75,7 +75,7 @@ #else #include #ifndef lint -__RCSID("$NetBSD: traceroute6.c,v 1.39 2010/05/13 18:19:18 christos Exp $"); +__RCSID("$NetBSD: traceroute6.c,v 1.40 2011/05/10 01:58:58 christos Exp $"); #endif #endif @@ -282,6 +282,8 @@ #include #endif +#include "as.h" + #define DUMMY_PORT 10010 #define MAXPACKET 65535 /* max ip packet size */ @@ -306,68 +308,71 @@ struct tv32 tv; /* time packet left */ } __packed; -u_char packet[512]; /* last inbound (icmp) packet */ -struct opacket *outpacket; /* last output (udp) packet */ +static u_char packet[512]; /* last inbound (icmp) packet */ +static struct opacket *outpacket; /* last output (udp) packet */ -int main __P((int, char *[])); -int wait_for_reply __P((int, struct msghdr *)); +static ssize_t wait_for_reply(int, struct msghdr *); #ifdef IPSEC #ifdef IPSEC_POLICY_IPSEC -int setpolicy __P((int so, char *policy)); +static int setpolicy(int so, const char *policy); +#endif #endif +static void send_probe(int, u_long); +static struct udphdr *get_udphdr(struct ip6_hdr *, u_char *); +#if 0 +static int get_hoplim(struct msghdr *); #endif -void send_probe __P((int, u_long)); -struct udphdr *get_udphdr __P((struct ip6_hdr *, u_char *)); -int get_hoplim __P((struct msghdr *)); -double deltaT __P((struct timeval *, struct timeval *)); -char *pr_type __P((int)); -int packet_ok __P((struct msghdr *, int, int)); -void print __P((struct msghdr *, int)); -const char *inetname __P((struct sockaddr *)); -void usage __P((void)); - -int rcvsock; /* receive (icmp) socket file descriptor */ -int sndsock; /* send (udp) socket file descriptor */ - -struct msghdr rcvmhdr; -struct iovec rcviov[2]; -int rcvhlim; -struct in6_pktinfo *rcvpktinfo; +static double deltaT(struct timeval *, struct timeval *); +static const char *pr_type(int); +static int packet_ok(struct msghdr *, ssize_t, int); +static void print(struct msghdr *, int); +static const char *inetname(struct sockaddr *); +static void usage(void) __attribute__((__noreturn__)); + +static int rcvsock; /* receive (icmp) socket file descriptor */ +static int sndsock; /* send (udp) socket file descriptor */ + +static struct msghdr rcvmhdr; +static struct iovec rcviov[2]; +static int rcvhlim; +static struct in6_pktinfo *rcvpktinfo; -struct sockaddr_in6 Src, Dst, Rcv; -u_long datalen; /* How much data */ +static struct sockaddr_in6 Src, Dst, Rcv; +static u_long datalen; /* How much data */ #define ICMP6ECHOLEN 8 /* XXX: 2064 = 127(max hops in type 0 rthdr) * sizeof(ip6_hdr) + 16(margin) */ -char rtbuf[2064]; +static char rtbuf[2064]; #ifdef USE_RFC3542 -struct ip6_rthdr *rth; +static struct ip6_rthdr *rth; #endif -struct cmsghdr *cmsg; +static struct cmsghdr *cmsg; -char *source = 0; -char *hostname; +static char *source; +static char *hostname; -u_long nprobes = 3
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: wiz Date: Thu May 12 08:42:25 UTC 2011 Modified Files: src/usr.sbin/traceroute6: traceroute6.8 Log Message: Sort options. Remove unnecessary quotes and Bk/Ek. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/traceroute6/traceroute6.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.8 diff -u src/usr.sbin/traceroute6/traceroute6.8:1.12 src/usr.sbin/traceroute6/traceroute6.8:1.13 --- src/usr.sbin/traceroute6/traceroute6.8:1.12 Tue May 10 01:58:58 2011 +++ src/usr.sbin/traceroute6/traceroute6.8 Thu May 12 08:42:24 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: traceroute6.8,v 1.12 2011/05/10 01:58:58 christos Exp $ +.\" $NetBSD: traceroute6.8,v 1.13 2011/05/12 08:42:24 wiz Exp $ .\" $KAME: traceroute6.8,v 1.8 2000/06/12 16:29:18 itojun Exp $ .\" .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -34,48 +34,28 @@ .\" .Sh NAME .Nm traceroute6 -.Nd "print the route IPv6 packets will take to the destination" +.Nd print the route IPv6 packets will take to the destination .\" .Sh SYNOPSIS .Nm traceroute6 -.Bk -words .Op Fl adIlnrv -.Ek -.Bk -words +.Op Fl A Ar as_server .Op Fl f Ar firsthop -.Ek -.Bk -words .Op Fl g Ar gateway -.Ek -.Bk -words .Op Fl m Ar hoplimit -.Ek -.Bk -words .Op Fl p Ar port -.Ek -.Bk -words .Op Fl q Ar probes -.Ek -.Bk -words .Op Fl s Ar src -.Ek -.Bk -words .Op Fl w Ar waittime -.Ek -.Bk -words -.Op Fl A Ar as_server -.Ek -.Bk -words .Ar target .Op Ar datalen -.Ek .\" .Sh DESCRIPTION .Bl -tag -width Ds -.It Fl a -Turn on AS# lookups for each hop encountered. .It Fl A Turn on AS# lookups and use the given server instead of the default. +.It Fl a +Turn on AS# lookups for each hop encountered. .It Fl d Debug mode. .It Fl f Ar firsthop
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: wiz Date: Sun May 15 00:06:23 UTC 2011 Modified Files: src/usr.sbin/traceroute6: traceroute6.c Log Message: Sync usage with manpage. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/traceroute6/traceroute6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.c diff -u src/usr.sbin/traceroute6/traceroute6.c:1.40 src/usr.sbin/traceroute6/traceroute6.c:1.41 --- src/usr.sbin/traceroute6/traceroute6.c:1.40 Tue May 10 01:58:58 2011 +++ src/usr.sbin/traceroute6/traceroute6.c Sun May 15 00:06:23 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: traceroute6.c,v 1.40 2011/05/10 01:58:58 christos Exp $ */ +/* $NetBSD: traceroute6.c,v 1.41 2011/05/15 00:06:23 wiz Exp $ */ /* $KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $ */ /* @@ -75,7 +75,7 @@ #else #include #ifndef lint -__RCSID("$NetBSD: traceroute6.c,v 1.40 2011/05/10 01:58:58 christos Exp $"); +__RCSID("$NetBSD: traceroute6.c,v 1.41 2011/05/15 00:06:23 wiz Exp $"); #endif #endif @@ -1300,8 +1300,8 @@ { fprintf(stderr, -"Usage: %s [-dIlnrv] [-f firsthop] [-g gateway] [-m hoplimit]\n" -"\t%s [-p port] [-q probes] [-s src] [-w waittime] target [datalen]\n", - getprogname(), getprogname()); +"Usage: %s [-adIlnrv] [-A as_server] [-f firsthop] [-g gateway]\n" +"\t[-m hoplimit] [-p port] [-q probes] [-s src] [-w waittime] target [datalen]\n", + getprogname()); exit(1); }
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: shm Date: Thu Nov 17 09:21:34 UTC 2016 Modified Files: src/usr.sbin/traceroute6: traceroute6.c Log Message: CID 978587: Removed unnecessary check against NULL. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/traceroute6/traceroute6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.c diff -u src/usr.sbin/traceroute6/traceroute6.c:1.43 src/usr.sbin/traceroute6/traceroute6.c:1.44 --- src/usr.sbin/traceroute6/traceroute6.c:1.43 Mon Dec 10 18:11:33 2012 +++ src/usr.sbin/traceroute6/traceroute6.c Thu Nov 17 09:21:34 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: traceroute6.c,v 1.43 2012/12/10 18:11:33 christos Exp $ */ +/* $NetBSD: traceroute6.c,v 1.44 2016/11/17 09:21:34 shm Exp $ */ /* $KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $ */ /* @@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c #else #include #ifndef lint -__RCSID("$NetBSD: traceroute6.c,v 1.43 2012/12/10 18:11:33 christos Exp $"); +__RCSID("$NetBSD: traceroute6.c,v 1.44 2016/11/17 09:21:34 shm Exp $"); #endif #endif @@ -569,7 +569,7 @@ main(int argc, char *argv[]) ep = NULL; errno = 0; datalen = strtoul(*argv, &ep, 0); - if (errno || !*argv || *ep) + if (errno || *ep) errx(1, "Invalid packet length `%s'", *argv); } if (useicmp)
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: wiz Date: Tue Jul 4 07:13:18 UTC 2017 Modified Files: src/usr.sbin/traceroute6: traceroute6.8 Log Message: Use Ex. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/traceroute6/traceroute6.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.8 diff -u src/usr.sbin/traceroute6/traceroute6.8:1.14 src/usr.sbin/traceroute6/traceroute6.8:1.15 --- src/usr.sbin/traceroute6/traceroute6.8:1.14 Mon Jul 3 21:35:32 2017 +++ src/usr.sbin/traceroute6/traceroute6.8 Tue Jul 4 07:13:18 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: traceroute6.8,v 1.14 2017/07/03 21:35:32 wiz Exp $ +.\" $NetBSD: traceroute6.8,v 1.15 2017/07/04 07:13:18 wiz Exp $ .\" $KAME: traceroute6.8,v 1.8 2000/06/12 16:29:18 itojun Exp $ .\" .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -106,9 +106,7 @@ Specify the delay time between probes. .El .\" .Sh EXIT STATUS -The -.Nm -command exits 0 on success, and >0 on errors. +.Ex -std traceroute6 .\" .Sh SEE ALSO .Xr ping 8 ,
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: ginsbach Date: Fri Aug 4 02:08:22 UTC 2017 Modified Files: src/usr.sbin/traceroute6: traceroute6.8 Log Message: Expand the traceroute6 man page - Add a proper description paragraph before launching into describing the options. More closely follow format of the traceroute(8) man page. - Improve the wording for some option descriptions. - Add description what what is printed and define what the possible annotations mean. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/traceroute6/traceroute6.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.8 diff -u src/usr.sbin/traceroute6/traceroute6.8:1.15 src/usr.sbin/traceroute6/traceroute6.8:1.16 --- src/usr.sbin/traceroute6/traceroute6.8:1.15 Tue Jul 4 07:13:18 2017 +++ src/usr.sbin/traceroute6/traceroute6.8 Fri Aug 4 02:08:21 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: traceroute6.8,v 1.15 2017/07/04 07:13:18 wiz Exp $ +.\" $NetBSD: traceroute6.8,v 1.16 2017/08/04 02:08:21 ginsbach Exp $ .\" $KAME: traceroute6.8,v 1.8 2000/06/12 16:29:18 itojun Exp $ .\" .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 17, 2005 +.Dd January 18, 2007 .Dt TRACEROUTE6 8 .Os .\" @@ -51,13 +51,27 @@ .Op Ar datalen .\" .Sh DESCRIPTION +.Nm +uses the IPv6 protocol hop limit field to elicit an ICMPv6 +.Dv TIME_EXCEEDED +response from each gateway along the path to some host. +.Pp +The only mandatory parameter is the destination host name or IPv6 address. +The default probe datagram carries 12 bytes of payload, +in addition to the IPv6 header. +The size of the payload can be specified by giving a length +.Po in bytes +.Pc +after the destination host name. +.Pp +Other options are: .Bl -tag -width Ds .It Fl A Turn on AS# lookups and use the given server instead of the default. .It Fl a Turn on AS# lookups for each hop encountered. .It Fl d -Debug mode. +Turn on socket-level debugging. .It Fl f Ar firsthop Specify how many hops to skip in trace. .It Fl g Ar gateway @@ -78,15 +92,32 @@ is not specified, and only numeric addre .Fl n is specified. .It Fl m Ar hoplimit -Specify maximum hoplimit. +Specify maximum +.Ar hoplimit, +up to 255. +The default is 30 hops. .It Fl n Do not resolve numeric address to hostname. .It Fl p Ar port -Set UDP port number to +Set the base UDP port number use in probes to .Ar port . +The default is 33434. +.Nm +hopes that nothing is listening on UDP ports +.Va base +to +.Va base + nhops - 1 +at the destination host (so an ICMPv6 +.Dv PORT_UNREACHABLE +message will be returned to terminate the route tracing). +If something is listening on a port in the default range, +this option can be used to pick an unused port range. .It Fl q Ar probes -Set the number of probe per hop count to +Set the number of probe packets sent per hop count to .Ar probes . +By default, +.Nm +sends three probe packets. .It Fl r Bypass the normal routing tables and send directly to a host on an attached network. @@ -97,12 +128,47 @@ through an interface that has no route t (e.g., after the interface was dropped by .Xr route6d 8 ) . .It Fl s Ar src -.Ar Src -specifies the source IPv6 address to be used. +Use the IPv6 address, +.Ar src , +as the source address in outgoing probe packets. .It Fl v Be verbose. +Received ICMPv6 packets other than +.Dv TIME_EXCEEDED +and +.Dv UNREACHABLEs +are listed. .It Fl w Ar waittime -Specify the delay time between probes. +Use +.Ar waittime +as the delay in seconds, between probes. +The default is 5 seconds. +.El +.Pp +This program prints the route to the given destination +and the round-trip time to each gateway, +in the same manner as traceroute. +.Pp +Here is a list of possible annotations after the +round-trip time for each gateway: +.Pp +.Bl -hang -offset indent +.It !N +Destination Unreachable - No Route to Host. +.It !X +Destination Unreachable - Administratively Prohibited. +.It !S +Destination Unreachable - Not a Neighbour. +.It !H +Destination Unreachable - Address Unreachable. +.It ! +This is printed if the hop limit is <= 1 on a port unreachable message. +This means that the packet got to the destination, +but that the reply had a hop limit that was just +large enough to allow it to get back to the source of the +.Nm . +This was more interesting in the IPv4 case, +where some IP stack bugs could be identified by this behaviour. .El .\" .Sh EXIT STATUS
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: wiz Date: Sat Aug 5 20:24:17 UTC 2017 Modified Files: src/usr.sbin/traceroute6: traceroute6.8 Log Message: Fix punctuation markup, remove superfluous Pp. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/traceroute6/traceroute6.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.8 diff -u src/usr.sbin/traceroute6/traceroute6.8:1.16 src/usr.sbin/traceroute6/traceroute6.8:1.17 --- src/usr.sbin/traceroute6/traceroute6.8:1.16 Fri Aug 4 02:08:21 2017 +++ src/usr.sbin/traceroute6/traceroute6.8 Sat Aug 5 20:24:17 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: traceroute6.8,v 1.16 2017/08/04 02:08:21 ginsbach Exp $ +.\" $NetBSD: traceroute6.8,v 1.17 2017/08/05 20:24:17 wiz Exp $ .\" $KAME: traceroute6.8,v 1.8 2000/06/12 16:29:18 itojun Exp $ .\" .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,7 +93,7 @@ is not specified, and only numeric addre is specified. .It Fl m Ar hoplimit Specify maximum -.Ar hoplimit, +.Ar hoplimit , up to 255. The default is 30 hops. .It Fl n @@ -151,7 +151,6 @@ in the same manner as traceroute. .Pp Here is a list of possible annotations after the round-trip time for each gateway: -.Pp .Bl -hang -offset indent .It !N Destination Unreachable - No Route to Host.
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: maxv Date: Mon Apr 23 06:42:02 UTC 2018 Modified Files: src/usr.sbin/traceroute6: traceroute6.8 traceroute6.c Log Message: Remove the "-g" option, it uses RH0, which is deprecated by RFC5095, and doesn't work on modern networks anymore. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/traceroute6/traceroute6.8 cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/traceroute6/traceroute6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.8 diff -u src/usr.sbin/traceroute6/traceroute6.8:1.17 src/usr.sbin/traceroute6/traceroute6.8:1.18 --- src/usr.sbin/traceroute6/traceroute6.8:1.17 Sat Aug 5 20:24:17 2017 +++ src/usr.sbin/traceroute6/traceroute6.8 Mon Apr 23 06:42:02 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: traceroute6.8,v 1.17 2017/08/05 20:24:17 wiz Exp $ +.\" $NetBSD: traceroute6.8,v 1.18 2018/04/23 06:42:02 maxv Exp $ .\" $KAME: traceroute6.8,v 1.8 2000/06/12 16:29:18 itojun Exp $ .\" .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 18, 2007 +.Dd April 23, 2018 .Dt TRACEROUTE6 8 .Os .\" @@ -74,12 +74,6 @@ Turn on AS# lookups for each hop encount Turn on socket-level debugging. .It Fl f Ar firsthop Specify how many hops to skip in trace. -.It Fl g Ar gateway -Specify intermediate gateway -.Po -.Nm -uses routing header -.Pc . .It Fl I Use ICMP6 ECHO instead of UDP datagrams. .It Fl l Index: src/usr.sbin/traceroute6/traceroute6.c diff -u src/usr.sbin/traceroute6/traceroute6.c:1.44 src/usr.sbin/traceroute6/traceroute6.c:1.45 --- src/usr.sbin/traceroute6/traceroute6.c:1.44 Thu Nov 17 09:21:34 2016 +++ src/usr.sbin/traceroute6/traceroute6.c Mon Apr 23 06:42:02 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: traceroute6.c,v 1.44 2016/11/17 09:21:34 shm Exp $ */ +/* $NetBSD: traceroute6.c,v 1.45 2018/04/23 06:42:02 maxv Exp $ */ /* $KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $ */ /* @@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c #else #include #ifndef lint -__RCSID("$NetBSD: traceroute6.c,v 1.44 2016/11/17 09:21:34 shm Exp $"); +__RCSID("$NetBSD: traceroute6.c,v 1.45 2018/04/23 06:42:02 maxv Exp $"); #endif #endif @@ -340,8 +340,6 @@ static struct in6_pktinfo *rcvpktinfo; static struct sockaddr_in6 Src, Dst, Rcv; static u_long datalen; /* How much data */ #define ICMP6ECHOLEN 8 -/* XXX: 2064 = 127(max hops in type 0 rthdr) * sizeof(ip6_hdr) + 16(margin) */ -static char rtbuf[2064]; #ifdef USE_RFC3542 static struct ip6_rthdr *rth; #endif @@ -376,7 +374,6 @@ main(int argc, char *argv[]) struct addrinfo hints, *res; static u_char *rcvcmsgbuf; u_long probe, hops, lport; - struct hostent *hp; size_t size; /* @@ -417,7 +414,7 @@ main(int argc, char *argv[]) seq = 0; - while ((ch = getopt(argc, argv, "aA:df:g:Ilm:np:q:rs:w:v")) != -1) + while ((ch = getopt(argc, argv, "aA:df:Ilm:np:q:rs:w:v")) != -1) switch (ch) { case 'a': as_path = 1; @@ -436,35 +433,6 @@ main(int argc, char *argv[]) if (errno || !*optarg || *ep|| first_hop > 255) errx(1, "Invalid min hoplimit `%s'", optarg); break; - case 'g': - hp = getipnodebyname(optarg, AF_INET6, 0, &h_errno); - if (hp == NULL) -errx(1, "Unknown host `%s'", optarg); -#ifdef USE_RFC3542 - if (rth == NULL) { -/* - * XXX: We can't detect the number of - * intermediate nodes yet. - */ -if ((rth = inet6_rth_init((void *)rtbuf, -sizeof(rtbuf), IPV6_RTHDR_TYPE_0, -0)) == NULL) { - errx(1, "inet6_rth_init failed"); -} - } - if (inet6_rth_add((void *)rth, - (struct in6_addr *)hp->h_addr)) -errx(1, "inet6_rth_add failed for `%s'", -optarg); -#else /* old advanced API */ - if (cmsg == NULL) -cmsg = inet6_rthdr_init(rtbuf, -IPV6_RTHDR_TYPE_0); - inet6_rthdr_add(cmsg, (struct in6_addr *)hp->h_addr, - IPV6_RTHDR_LOOSE); -#endif - freehostent(hp); - break; case 'I': useicmp++; /* same as ping6 */ @@ -1300,8 +1268,8 @@ usage(void) { fprintf(stderr, -"Usage: %s [-adIlnrv] [-A as_server] [-f firsthop] [-g gateway]\n" -"\t[-m hoplimit] [-p port] [-q probes] [-s src] [-w waittime] target [datalen]\n", +"Usage: %s [-adIlnrv] [-A as_server] [-f firsthop] [-m hoplimit]\n" +"\t[-p port] [-q probes] [-s src] [-w waittime] target [datalen]\n", getprogname()); exit(1); }
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: wiz Date: Mon Apr 23 07:13:50 UTC 2018 Modified Files: src/usr.sbin/traceroute6: traceroute6.8 Log Message: Remove -g from SYNOPSIS. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/traceroute6/traceroute6.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.8 diff -u src/usr.sbin/traceroute6/traceroute6.8:1.18 src/usr.sbin/traceroute6/traceroute6.8:1.19 --- src/usr.sbin/traceroute6/traceroute6.8:1.18 Mon Apr 23 06:42:02 2018 +++ src/usr.sbin/traceroute6/traceroute6.8 Mon Apr 23 07:13:50 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: traceroute6.8,v 1.18 2018/04/23 06:42:02 maxv Exp $ +.\" $NetBSD: traceroute6.8,v 1.19 2018/04/23 07:13:50 wiz Exp $ .\" $KAME: traceroute6.8,v 1.8 2000/06/12 16:29:18 itojun Exp $ .\" .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -41,7 +41,6 @@ .Op Fl adIlnrv .Op Fl A Ar as_server .Op Fl f Ar firsthop -.Op Fl g Ar gateway .Op Fl m Ar hoplimit .Op Fl p Ar port .Op Fl q Ar probes
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: maxv Date: Mon Apr 23 09:47:03 UTC 2018 Modified Files: src/usr.sbin/traceroute6: traceroute6.c Log Message: Remove now unused code. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/usr.sbin/traceroute6/traceroute6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.c diff -u src/usr.sbin/traceroute6/traceroute6.c:1.45 src/usr.sbin/traceroute6/traceroute6.c:1.46 --- src/usr.sbin/traceroute6/traceroute6.c:1.45 Mon Apr 23 06:42:02 2018 +++ src/usr.sbin/traceroute6/traceroute6.c Mon Apr 23 09:47:03 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: traceroute6.c,v 1.45 2018/04/23 06:42:02 maxv Exp $ */ +/* $NetBSD: traceroute6.c,v 1.46 2018/04/23 09:47:03 maxv Exp $ */ /* $KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $ */ /* @@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c #else #include #ifndef lint -__RCSID("$NetBSD: traceroute6.c,v 1.45 2018/04/23 06:42:02 maxv Exp $"); +__RCSID("$NetBSD: traceroute6.c,v 1.46 2018/04/23 09:47:03 maxv Exp $"); #endif #endif @@ -340,10 +340,6 @@ static struct in6_pktinfo *rcvpktinfo; static struct sockaddr_in6 Src, Dst, Rcv; static u_long datalen; /* How much data */ #define ICMP6ECHOLEN 8 -#ifdef USE_RFC3542 -static struct ip6_rthdr *rth; -#endif -static struct cmsghdr *cmsg; static char *source; static char *hostname; @@ -628,21 +624,7 @@ main(int argc, char *argv[]) if (options & SO_DONTROUTE) (void) setsockopt(sndsock, SOL_SOCKET, SO_DONTROUTE, (char *)&on, sizeof(on)); -#ifdef USE_RFC3542 - if (rth) {/* XXX: there is no library to finalize the header... */ - rth->ip6r_len = rth->ip6r_segleft * 2; - if (setsockopt(sndsock, IPPROTO_IPV6, IPV6_RTHDR, - (void *)rth, (rth->ip6r_len + 1) << 3)) - err(1, "setsockopt(IPV6_RTHDR)"); - } -#else /* old advanced API */ - if (cmsg != NULL) { - inet6_rthdr_lasthop(cmsg, IPV6_RTHDR_LOOSE); - if (setsockopt(sndsock, IPPROTO_IPV6, IPV6_PKTOPTIONS, - rtbuf, cmsg->cmsg_len) < 0) - err(1, "setsockopt(IPV6_PKTOPTIONS)"); - } -#endif /* USE_RFC3542 */ + #ifdef IPSEC #ifdef IPSEC_POLICY_IPSEC /* @@ -703,9 +685,7 @@ main(int argc, char *argv[]) Nxt = Dst; Nxt.sin6_port = htons(DUMMY_PORT); - if (cmsg != NULL) - memcpy( &Nxt.sin6_addr, inet6_rthdr_getaddr(cmsg, 1), - sizeof(Nxt.sin6_addr)); + if ((dummy = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) err(1, "socket"); if (connect(dummy, (struct sockaddr *)&Nxt, Nxt.sin6_len) < 0)
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: maxv Date: Mon Apr 23 09:58:35 UTC 2018 Modified Files: src/usr.sbin/traceroute6: traceroute6.c Log Message: Remove dead code. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/usr.sbin/traceroute6/traceroute6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.c diff -u src/usr.sbin/traceroute6/traceroute6.c:1.46 src/usr.sbin/traceroute6/traceroute6.c:1.47 --- src/usr.sbin/traceroute6/traceroute6.c:1.46 Mon Apr 23 09:47:03 2018 +++ src/usr.sbin/traceroute6/traceroute6.c Mon Apr 23 09:58:35 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: traceroute6.c,v 1.46 2018/04/23 09:47:03 maxv Exp $ */ +/* $NetBSD: traceroute6.c,v 1.47 2018/04/23 09:58:35 maxv Exp $ */ /* $KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $ */ /* @@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c #else #include #ifndef lint -__RCSID("$NetBSD: traceroute6.c,v 1.46 2018/04/23 09:47:03 maxv Exp $"); +__RCSID("$NetBSD: traceroute6.c,v 1.47 2018/04/23 09:58:35 maxv Exp $"); #endif #endif @@ -319,9 +319,6 @@ static int setpolicy(int so, const char #endif static void send_probe(int, u_long); static struct udphdr *get_udphdr(struct ip6_hdr *, u_char *); -#if 0 -static int get_hoplim(struct msghdr *); -#endif static double deltaT(struct timeval *, struct timeval *); static const char *pr_type(int); static int packet_ok(struct msghdr *, ssize_t, int); @@ -915,24 +912,6 @@ send_probe(int seq, u_long hops) } } -#if 0 -static int -get_hoplim(struct msghdr *mhdr) -{ - struct cmsghdr *cm; - - for (cm = (struct cmsghdr *)CMSG_FIRSTHDR(mhdr); cm; - cm = (struct cmsghdr *)CMSG_NXTHDR(mhdr, cm)) { - if (cm->cmsg_level == IPPROTO_IPV6 && - cm->cmsg_type == IPV6_HOPLIMIT && - cm->cmsg_len == CMSG_LEN(sizeof(int))) - return *(int *)CMSG_DATA(cm); - } - - return -1; -} -#endif - static double deltaT(struct timeval *t1p, struct timeval *t2p) {
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: maxv Date: Mon Apr 23 10:14:12 UTC 2018 Modified Files: src/usr.sbin/traceroute6: traceroute6.c Log Message: Remove dead/broken code. We want to favor RFC3542 over RFC2292. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/traceroute6/traceroute6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.c diff -u src/usr.sbin/traceroute6/traceroute6.c:1.47 src/usr.sbin/traceroute6/traceroute6.c:1.48 --- src/usr.sbin/traceroute6/traceroute6.c:1.47 Mon Apr 23 09:58:35 2018 +++ src/usr.sbin/traceroute6/traceroute6.c Mon Apr 23 10:14:12 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: traceroute6.c,v 1.47 2018/04/23 09:58:35 maxv Exp $ */ +/* $NetBSD: traceroute6.c,v 1.48 2018/04/23 10:14:12 maxv Exp $ */ /* $KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $ */ /* @@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c #else #include #ifndef lint -__RCSID("$NetBSD: traceroute6.c,v 1.47 2018/04/23 09:58:35 maxv Exp $"); +__RCSID("$NetBSD: traceroute6.c,v 1.48 2018/04/23 10:14:12 maxv Exp $"); #endif #endif @@ -384,26 +384,14 @@ main(int argc, char *argv[]) max_hops = i; /* specify to tell receiving interface */ -#ifdef IPV6_RECVPKTINFO if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on)) < 0) err(1, "setsockopt(IPV6_RECVPKTINFO)"); -#else /* old adv. API */ - if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_PKTINFO, &on, - sizeof(on)) < 0) - err(1, "setsockopt(IPV6_PKTINFO)"); -#endif /* specify to tell value of hoplimit field of received IP6 hdr */ -#ifdef IPV6_RECVHOPLIMIT if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &on, sizeof(on)) < 0) err(1, "setsockopt(IPV6_RECVHOPLIMIT)"); -#else /* old adv. API */ - if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_HOPLIMIT, &on, - sizeof(on)) < 0) - err(1, "setsockopt(IPV6_HOPLIMIT)"); -#endif seq = 0;
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: maxv Date: Mon Apr 23 10:19:11 UTC 2018 Modified Files: src/usr.sbin/traceroute6: Makefile Log Message: Remove CPPFLAGS+=-DUSE_RFC3542, it's not used anymore. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/traceroute6/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/Makefile diff -u src/usr.sbin/traceroute6/Makefile:1.9 src/usr.sbin/traceroute6/Makefile:1.10 --- src/usr.sbin/traceroute6/Makefile:1.9 Tue May 10 01:52:49 2011 +++ src/usr.sbin/traceroute6/Makefile Mon Apr 23 10:19:11 2018 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.9 2011/05/10 01:52:49 christos Exp $ +# $NetBSD: Makefile,v 1.10 2018/04/23 10:19:11 maxv Exp $ USE_FORT?= yes # network client @@ -12,7 +12,6 @@ BINMODE=4555 BINOWN= root CPPFLAGS+=-DINET6 -DIPSEC -CPPFLAGS+=-DUSE_RFC3542 LDADD+= -lipsec DPADD+= ${LIBIPSEC}
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: maxv Date: Mon Apr 23 10:22:18 UTC 2018 Modified Files: src/usr.sbin/traceroute6: traceroute6.c Log Message: Remove dead code. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/traceroute6/traceroute6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.c diff -u src/usr.sbin/traceroute6/traceroute6.c:1.48 src/usr.sbin/traceroute6/traceroute6.c:1.49 --- src/usr.sbin/traceroute6/traceroute6.c:1.48 Mon Apr 23 10:14:12 2018 +++ src/usr.sbin/traceroute6/traceroute6.c Mon Apr 23 10:22:18 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: traceroute6.c,v 1.48 2018/04/23 10:14:12 maxv Exp $ */ +/* $NetBSD: traceroute6.c,v 1.49 2018/04/23 10:22:18 maxv Exp $ */ /* $KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $ */ /* @@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c #else #include #ifndef lint -__RCSID("$NetBSD: traceroute6.c,v 1.48 2018/04/23 10:14:12 maxv Exp $"); +__RCSID("$NetBSD: traceroute6.c,v 1.49 2018/04/23 10:22:18 maxv Exp $"); #endif #endif @@ -980,27 +980,6 @@ packet_ok(struct msghdr *mhdr, ssize_t c int *hlimp; char hbuf[NI_MAXHOST]; -#ifdef OLDRAWSOCKET - int hlen; - struct ip6_hdr *ip; -#endif - -#ifdef OLDRAWSOCKET - ip = (struct ip6_hdr *) buf; - hlen = sizeof(struct ip6_hdr); - if (cc < hlen + sizeof(struct icmp6_hdr)) { - if (verbose) { - if (getnameinfo((struct sockaddr *)from, from->sin6_len, - hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0) -strlcpy(hbuf, "invalid", sizeof(hbuf)); - printf("packet too short (%d bytes) from %s\n", cc, - hbuf); - } - return 0; - } - cc -= hlen; - icp = (struct icmp6_hdr *)(buf + hlen); -#else if (cc < (ssize_t)sizeof(struct icmp6_hdr)) { if (verbose) { if (getnameinfo((struct sockaddr *)from, from->sin6_len, @@ -1012,7 +991,7 @@ packet_ok(struct msghdr *mhdr, ssize_t c return 0; } icp = (struct icmp6_hdr *)buf; -#endif + /* get optional information via advanced API */ rcvpktinfo = NULL; hlimp = NULL;
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: maxv Date: Mon Apr 23 10:23:38 UTC 2018 Modified Files: src/usr.sbin/traceroute6: traceroute6.c Log Message: ... another occurrence of OLDRAWSOCKET ... To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/traceroute6/traceroute6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.c diff -u src/usr.sbin/traceroute6/traceroute6.c:1.49 src/usr.sbin/traceroute6/traceroute6.c:1.50 --- src/usr.sbin/traceroute6/traceroute6.c:1.49 Mon Apr 23 10:22:18 2018 +++ src/usr.sbin/traceroute6/traceroute6.c Mon Apr 23 10:23:38 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: traceroute6.c,v 1.49 2018/04/23 10:22:18 maxv Exp $ */ +/* $NetBSD: traceroute6.c,v 1.50 2018/04/23 10:23:38 maxv Exp $ */ /* $KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $ */ /* @@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c #else #include #ifndef lint -__RCSID("$NetBSD: traceroute6.c,v 1.49 2018/04/23 10:22:18 maxv Exp $"); +__RCSID("$NetBSD: traceroute6.c,v 1.50 2018/04/23 10:23:38 maxv Exp $"); #endif #endif @@ -1138,15 +1138,9 @@ print(struct msghdr *mhdr, int cc) printf(" %s", inetname((struct sockaddr *)from)); if (verbose) { -#ifdef OLDRAWSOCKET - printf(" %d bytes to %s", cc, - rcvpktinfo ? inet_ntop(AF_INET6, &rcvpktinfo->ipi6_addr, - hbuf, sizeof(hbuf)) : "?"); -#else printf(" %d bytes of data to %s", cc, rcvpktinfo ? inet_ntop(AF_INET6, &rcvpktinfo->ipi6_addr, hbuf, sizeof(hbuf)) : "?"); -#endif } }
CVS commit: src/usr.sbin/traceroute6
Module Name:src Committed By: maxv Date: Mon Apr 23 18:59:03 UTC 2018 Modified Files: src/usr.sbin/traceroute6: traceroute6.c Log Message: Clean up the IPsec ifdefs, same as ping6. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/traceroute6/traceroute6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/traceroute6/traceroute6.c diff -u src/usr.sbin/traceroute6/traceroute6.c:1.50 src/usr.sbin/traceroute6/traceroute6.c:1.51 --- src/usr.sbin/traceroute6/traceroute6.c:1.50 Mon Apr 23 10:23:38 2018 +++ src/usr.sbin/traceroute6/traceroute6.c Mon Apr 23 18:59:03 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: traceroute6.c,v 1.50 2018/04/23 10:23:38 maxv Exp $ */ +/* $NetBSD: traceroute6.c,v 1.51 2018/04/23 18:59:03 maxv Exp $ */ /* $KAME: traceroute6.c,v 1.67 2004/01/25 03:24:39 itojun Exp $ */ /* @@ -75,7 +75,7 @@ static char sccsid[] = "@(#)traceroute.c #else #include #ifndef lint -__RCSID("$NetBSD: traceroute6.c,v 1.50 2018/04/23 10:23:38 maxv Exp $"); +__RCSID("$NetBSD: traceroute6.c,v 1.51 2018/04/23 18:59:03 maxv Exp $"); #endif #endif @@ -312,10 +312,8 @@ static u_char packet[512]; /* last inbo static struct opacket *outpacket; /* last output (udp) packet */ static ssize_t wait_for_reply(int, struct msghdr *); -#ifdef IPSEC -#ifdef IPSEC_POLICY_IPSEC -static int setpolicy(int so, const char *policy); -#endif +#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) +static int setpolicy(int, const char *); #endif static void send_probe(int, u_long); static struct udphdr *get_udphdr(struct ip6_hdr *, u_char *); @@ -555,38 +553,13 @@ main(int argc, char *argv[]) if (options & SO_DONTROUTE) (void) setsockopt(rcvsock, SOL_SOCKET, SO_DONTROUTE, (char *)&on, sizeof(on)); -#ifdef IPSEC -#ifdef IPSEC_POLICY_IPSEC - /* - * do not raise error even if setsockopt fails, kernel may have ipsec - * turned off. - */ + +#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) if (setpolicy(rcvsock, "in bypass") < 0) errx(1, "%s", ipsec_strerror()); if (setpolicy(rcvsock, "out bypass") < 0) errx(1, "%s", ipsec_strerror()); -#else -{ - int level = IPSEC_LEVEL_NONE; - - (void)setsockopt(rcvsock, IPPROTO_IPV6, IPV6_ESP_TRANS_LEVEL, &level, - sizeof(level)); - (void)setsockopt(rcvsock, IPPROTO_IPV6, IPV6_ESP_NETWORK_LEVEL, &level, - sizeof(level)); -#ifdef IP_AUTH_TRANS_LEVEL - (void)setsockopt(rcvsock, IPPROTO_IPV6, IPV6_AUTH_TRANS_LEVEL, &level, - sizeof(level)); -#else - (void)setsockopt(rcvsock, IPPROTO_IPV6, IPV6_AUTH_LEVEL, &level, - sizeof(level)); -#endif -#ifdef IP_AUTH_NETWORK_LEVEL - (void)setsockopt(rcvsock, IPPROTO_IPV6, IPV6_AUTH_NETWORK_LEVEL, &level, - sizeof(level)); #endif -} -#endif /*IPSEC_POLICY_IPSEC*/ -#endif /*IPSEC*/ /* * Send UDP or ICMP @@ -597,12 +570,12 @@ main(int argc, char *argv[]) if ((sndsock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) err(5, "socket(SOCK_DGRAM)"); } -#ifdef SO_SNDBUF + i = datalen; if (setsockopt(sndsock, SOL_SOCKET, SO_SNDBUF, (char *)&i, sizeof(i)) < 0) err(6, "setsockopt(SO_SNDBUF)"); -#endif /* SO_SNDBUF */ + if (options & SO_DEBUG) (void) setsockopt(sndsock, SOL_SOCKET, SO_DEBUG, (char *)&on, sizeof(on)); @@ -610,38 +583,12 @@ main(int argc, char *argv[]) (void) setsockopt(sndsock, SOL_SOCKET, SO_DONTROUTE, (char *)&on, sizeof(on)); -#ifdef IPSEC -#ifdef IPSEC_POLICY_IPSEC - /* - * do not raise error even if setsockopt fails, kernel may have ipsec - * turned off. - */ +#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) if (setpolicy(sndsock, "in bypass") < 0) errx(1, "%s", ipsec_strerror()); if (setpolicy(sndsock, "out bypass") < 0) errx(1, "%s", ipsec_strerror()); -#else -{ - int level = IPSEC_LEVEL_BYPASS; - - (void)setsockopt(sndsock, IPPROTO_IPV6, IPV6_ESP_TRANS_LEVEL, &level, - sizeof(level)); - (void)setsockopt(sndsock, IPPROTO_IPV6, IPV6_ESP_NETWORK_LEVEL, &level, - sizeof(level)); -#ifdef IP_AUTH_TRANS_LEVEL - (void)setsockopt(sndsock, IPPROTO_IPV6, IPV6_AUTH_TRANS_LEVEL, &level, - sizeof(level)); -#else - (void)setsockopt(sndsock, IPPROTO_IPV6, IPV6_AUTH_LEVEL, &level, - sizeof(level)); #endif -#ifdef IP_AUTH_NETWORK_LEVEL - (void)setsockopt(sndsock, IPPROTO_IPV6, IPV6_AUTH_NETWORK_LEVEL, &level, - sizeof(level)); -#endif -} -#endif /*IPSEC_POLICY_IPSEC*/ -#endif /*IPSEC*/ /* * Source selection @@ -832,13 +779,16 @@ wait_for_reply(int sock, struct msghdr * #endif } -#ifdef IPSEC -#ifdef IPSEC_POLICY_IPSEC +#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) static int setpolicy(int so, const char *policy) { char *buf; + /* + * do not raise error even if setsockopt fails, kernel may have ipsec + * turned off. + */ buf = ipsec_set_policy(policy, strlen(policy)); if (buf == NULL) { warnx("%s", ipsec_strerror()); @@ -852,7 +802,6 @@ setpolicy(int so, con