Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/ping6 Remove the "hops" parameter, it uses...



details:   https://anonhg.NetBSD.org/src/rev/82271490605f
branches:  trunk
changeset: 318422:82271490605f
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Apr 23 06:51:25 2018 +0000
description:
Remove the "hops" parameter, it uses RH0, which is deprecated by RFC5095,
and doesn't work on modern networks anymore.

diffstat:

 sbin/ping6/ping6.8 |  15 ++-------------
 sbin/ping6/ping6.c |  52 ++++------------------------------------------------
 2 files changed, 6 insertions(+), 61 deletions(-)

diffs (150 lines):

diff -r 80fcfe821695 -r 82271490605f sbin/ping6/ping6.8
--- a/sbin/ping6/ping6.8        Mon Apr 23 06:42:02 2018 +0000
+++ b/sbin/ping6/ping6.8        Mon Apr 23 06:51:25 2018 +0000
@@ -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 @@
 .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 @@
 .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 @@
 .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
diff -r 80fcfe821695 -r 82271490605f sbin/ping6/ping6.c
--- a/sbin/ping6/ping6.c        Mon Apr 23 06:42:02 2018 +0000
+++ b/sbin/ping6/ping6.c        Mon Apr 23 06:51:25 2018 +0000
@@ -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 @@
 #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 @@
        char *policy_out = NULL;
 #endif
        double intval;
-       size_t rthlen;
 #ifdef IPV6_USE_MIN_MTU
        int mflag = 0;
 #endif
@@ -605,21 +604,11 @@
        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 @@
        }
 #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 @@
            "[-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);
 }



Home | Main Index | Thread Index | Old Index