Module Name:    src
Committed By:   maxv
Date:           Mon Apr 23 06:51:26 UTC 2018

Modified Files:
        src/sbin/ping6: ping6.8 ping6.c

Log Message:
Remove the "hops" parameter, 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.30 -r1.31 src/sbin/ping6/ping6.8
cvs rdiff -u -r1.94 -r1.95 src/sbin/ping6/ping6.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/ping6/ping6.8
diff -u src/sbin/ping6/ping6.8:1.30 src/sbin/ping6/ping6.8:1.31
--- src/sbin/ping6/ping6.8:1.30	Fri May 15 08:02:39 2015
+++ src/sbin/ping6/ping6.8	Mon Apr 23 06:51:25 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ping6.8,v 1.30 2015/05/15 08:02:39 kefren Exp $
+.\"	$NetBSD: ping6.8,v 1.31 2018/04/23 06:51:25 maxv Exp $
 .\"	$KAME: ping6.8,v 1.57 2002/05/26 13:18:25 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 April 23, 2015
+.Dd April 23, 2018
 .Dt PING6 8
 .Os
 .Sh NAME
@@ -57,7 +57,6 @@ packets to network hosts
 .Op Fl s Ar packetsize
 .Op Fl x Ar maxwait
 .Op Fl X Ar deadline
-.Op Ar hops ...
 .Ar host
 .Sh DESCRIPTION
 .Nm
@@ -217,16 +216,9 @@ when finished.
 .It Fl R
 Make the kernel believe that the target
 .Ar host
-.Po
-or the first
-.Ar hop
-if you specify
-.Ar hops
-.Pc
 is reachable, by injecting upper-layer reachability confirmation hint.
 The option is meaningful only if the target
 .Ar host
-.Pq or the first hop
 is a neighbor.
 .It Fl S Ar sourceaddr
 Specifies the source address of request packets.
@@ -276,9 +268,6 @@ Time in milliseconds to wait for a reply
 .It Fl X Ar deadline
 Specify a timeout, in seconds, before ping exits regardless of
 how many packets have been received.
-.It Ar hops
-IPv6 addresses for intermediate nodes,
-which will be put into type 0 routing header.
 .It Ar host
 IPv6 address of the final destination node.
 .El

Index: src/sbin/ping6/ping6.c
diff -u src/sbin/ping6/ping6.c:1.94 src/sbin/ping6/ping6.c:1.95
--- src/sbin/ping6/ping6.c:1.94	Sun Apr 15 08:27:21 2018
+++ src/sbin/ping6/ping6.c	Mon Apr 23 06:51:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ping6.c,v 1.94 2018/04/15 08:27:21 maxv Exp $	*/
+/*	$NetBSD: ping6.c,v 1.95 2018/04/23 06:51:25 maxv Exp $	*/
 /*	$KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $	*/
 
 /*
@@ -77,7 +77,7 @@ static char sccsid[] = "@(#)ping.c	8.1 (
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.94 2018/04/15 08:27:21 maxv Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.95 2018/04/23 06:51:25 maxv Exp $");
 #endif
 #endif
 
@@ -315,7 +315,6 @@ main(int argc, char *argv[])
 	char *policy_out = NULL;
 #endif
 	double intval;
-	size_t rthlen;
 #ifdef IPV6_USE_MIN_MTU
 	int mflag = 0;
 #endif
@@ -605,21 +604,11 @@ main(int argc, char *argv[])
 	argc -= optind;
 	argv += optind;
 
-	if (argc < 1) {
+	if (argc != 1) {
 		usage();
 		/*NOTREACHED*/
 	}
 
-	if (argc > 1) {
-		rthlen = CMSG_SPACE(inet6_rth_space(IPV6_RTHDR_TYPE_0,
-		    argc - 1));
-		if (rthlen == 0) {
-			errx(1, "too many intermediate hops");
-			/*NOTREACHED*/
-		}
-		ip6optlen += rthlen;
-	}
-
 	if (options & F_NIGROUP) {
 		target = nigroup(argv[argc - 1]);
 		if (target == NULL) {
@@ -913,39 +902,6 @@ main(int argc, char *argv[])
 	}
 #endif
 
-	if (argc > 1) {	/* some intermediate addrs are specified */
-		int hops, error;
-		int rthdrlen;
-
-		rthdrlen = inet6_rth_space(IPV6_RTHDR_TYPE_0, argc - 1);
-		scmsgp->cmsg_len = CMSG_LEN(rthdrlen);
-		scmsgp->cmsg_level = IPPROTO_IPV6;
-		scmsgp->cmsg_type = IPV6_RTHDR;
-		rthdr = (struct ip6_rthdr *)CMSG_DATA(scmsgp);
-		rthdr = inet6_rth_init((void *)rthdr, rthdrlen,
-		    IPV6_RTHDR_TYPE_0, argc - 1);
-		if (rthdr == NULL)
-			errx(1, "can't initialize rthdr");
-
-		for (hops = 0; hops < argc - 1; hops++) {
-			struct addrinfo *iaip;
-
-			if ((error = getaddrinfo(argv[hops], NULL, &hints,
-			    &iaip)))
-				errx(1, "%s", gai_strerror(error));
-			if (SIN6(iaip->ai_addr)->sin6_family != AF_INET6)
-				errx(1,
-				    "bad addr family of an intermediate addr");
-
-			if (inet6_rth_add(rthdr,
-			    &(SIN6(iaip->ai_addr))->sin6_addr))
-				errx(1, "can't add an intermediate node");
-			freeaddrinfo(iaip);
-		}
-
-		scmsgp = CMSG_NXTHDR(&smsghdr, scmsgp);
-	}
-
 	if (!(options & F_SRCADDR)) {
 		/*
 		 * get the source address. XXX since we revoked the root
@@ -2699,6 +2655,6 @@ usage(void)
 	    "[-X deadline]\n"
 	    "\t[-x maxwait] [-S sourceaddr] "
             "[-s packetsize] [-h hoplimit]\n"
-	    "\t[-g gateway] [hops...] host\n");
+	    "\t[-g gateway] host\n");
 	exit(1);
 }

Reply via email to