[PATCH] add traceroute6 applet

Leonid Lisovskiy lly.dev at gmail.com
Mon Nov 23 18:06:20 UTC 2009


On Mon, Nov 23, 2009 at 8:24 AM, Denys Vlasenko
<vda.linux at googlemail.com> wrote:

>
> +#if ENABLE_TRACEROUTE6
> +       else if (af == AF_INET6) {
> +               struct sockaddr_in6 firsthop = dest_lsa->u.sin6;
> +               len_and_sockaddr *source_lsa;
> +               int probe_fd = xsocket(AF_INET6, SOCK_DGRAM, 0);
> +
> +               if (op & OPT_DEVICE) {
> +                       setsockopt_bindtodevice(probe_fd, device);
> +               }
> +               firsthop.sin6_port = htons(1025);
> +               xconnect(probe_fd, (struct sockaddr*)&firsthop, sizeof(firsthop));
> +               source_lsa = get_sock_lsa(probe_fd);
> +               if (source_lsa == NULL)
> +                       bb_error_msg_and_die("can't get probe addr");
> +               close(probe_fd);
> +               source_lsa->u.sin6.sin6_port = 0;
> +
> +               xbind(sndsock, &source_lsa->u.sa, source_lsa->len);
> +               xbind(rcvsock, &source_lsa->u.sa, source_lsa->len);
> +               free(source_lsa);
> +       }
> +#endif
>
> What this code does? Why we don't do it for IPv4?

I copied this part of code from original traceroute6. Sorry, don't
know it's exact purpose :(

> Please review attached patch.
well done!

> Please try current git, I tested only "traceroute -6 ::1" ...
Unfortunately, some part of logic were broken:

$ ./traceroute6.old ipv6.google.com
traceroute to ipv6.google.com (2001:4860:a003::68), 30 hops max, 16 byte packets
 1  lly-1.tunnel.tserv24.sto1.ipv6.he.net (2001:470:27:10a::1)  19.726
ms  20.205 ms  19.876 ms
 2  gige-g2-20.core1.sto1.he.net (2001:470:0:11e::1)  21.942 ms
19.738 ms  19.667 ms
 3  10gigabitethernet3-3.core1.fra1.he.net (2001:470:0:110::1)  44.269
ms  44.588 ms  44.491 ms
 4  de-cix10.net.google.com (2001:7f8::3b41:0:1)  46.607 ms  45.039 ms
 82.129 ms
 5  *  *  *
 6  fx-in-x68.1e100.net (2001:4860:a003::68)  45.759 ms  46.032 ms  46.416 ms


$ ./traceroute6.new ipv6.google.com
traceroute to ipv6.google.com (2001:4860:a003::68), 30 hops max, 16 byte packets
 1  lly-1.tunnel.tserv24.sto1.ipv6.he.net (2001:470:27:10a::1)  22.040
ms  22.335 ms  23.165 ms
 2  gige-g2-20.core1.sto1.he.net (2001:470:0:11e::1)  19.792 ms
22.004 ms  23.475 ms
 3  10gigabitethernet3-3.core1.fra1.he.net (2001:470:0:110::1)  50.445
ms  48.177 ms  50.867 ms
 4  de-cix10.net.google.com (2001:7f8::3b41:0:1)  47.779 ms !S  52.634
ms !S  46.719 ms !S

Will try to find problem, but it will take some time.

Regards,
   Leonid


More information about the busybox mailing list