RH0 has been deprecated for quite some time now in RFC 5095. It's
quite useless on OpenBSD since our stack unconditionally drops packets
with a RH0 header so you can't get the packet out anyway.
And last but not least it might get in the way if I ever manage to
unify ping(8) and ping6(8).

OK?

diff --git ping6.8 ping6.8
index c8353a3..4dee864 100644
--- ping6.8
+++ ping6.8
@@ -49,7 +49,6 @@
 .Op Fl S Ar sourceaddr
 .Op Fl s Ar packetsize
 .Op Fl V Ar rtable
-.Op Ar hops ...
 .Ar host
 .Sh DESCRIPTION
 .Nm
@@ -279,9 +278,6 @@ rather than echo-request.
 has no effect if
 this option
 is specified.
-.It Ar hops
-IPv6 addresses of intermediate nodes,
-which will be put into a type 0 routing header.
 .It Ar host
 The IPv6 address of the final destination node.
 .El
diff --git ping6.c ping6.c
index 397f8da..24f600a 100644
--- ping6.c
+++ ping6.c
@@ -263,9 +263,7 @@ main(int argc, char *argv[])
        int sockbufsize = 0;
        int usepktinfo = 0;
        struct in6_pktinfo *pktinfo = NULL;
-       struct ip6_rthdr *rthdr = NULL;
        double intval;
-       size_t rthlen;
        int mflag = 0;
        uid_t uid;
        u_int rtableid;
@@ -485,14 +483,8 @@ main(int argc, char *argv[])
                /*NOTREACHED*/
        }
 
-       if (argc > 1) {
-               rthlen = inet6_rth_space(IPV6_RTHDR_TYPE_0, argc - 1);
-               if (rthlen == 0) {
-                       errx(1, "too many intermediate hops");
-                       /*NOTREACHED*/
-               }
-               ip6optlen += CMSG_SPACE(rthlen);
-       }
+       if (argc != 1)
+               usage();
 
        if (options & F_NIGROUP) {
                target = nigroup(argv[argc - 1]);
@@ -694,40 +686,6 @@ main(int argc, char *argv[])
                scmsgp = CMSG_NXTHDR(&smsghdr, scmsgp);
        }
 
-       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
@@ -759,11 +717,6 @@ main(int argc, char *argv[])
                    (void *)&hoplimit, sizeof(hoplimit)))
                        err(1, "UDP setsockopt(IPV6_MULTICAST_HOPS)");
 
-               if (rthdr &&
-                   setsockopt(dummy, IPPROTO_IPV6, IPV6_RTHDR,
-                   (void *)rthdr, (rthdr->ip6r_len + 1) << 3))
-                       err(1, "UDP setsockopt(IPV6_RTHDR)");
-
                if (connect(dummy, (struct sockaddr *)&src, len) < 0)
                        err(1, "UDP connect");
 
@@ -2424,7 +2377,6 @@ usage(void)
            "NnqtvWw"
            "] [-a addrtype] [-b bufsiz] [-c count] [-g gateway]\n\t"
            "[-h hoplimit] [-I interface] [-i wait] [-l preload] [-p pattern]"
-           "\n\t[-S sourceaddr] [-s packetsize] [-V rtable] [hops ...]"
-           " host\n");
+           "\n\t[-S sourceaddr] [-s packetsize] [-V rtable] host\n");
        exit(1);
 }


-- 
I'm not entirely sure you are real.

Reply via email to