[PATCH] add traceroute6 applet

Leonid Lisovskiy lly.dev at gmail.com
Sun Nov 22 12:03:46 UTC 2009


On Sat, Nov 21, 2009 at 6:28 PM, Denys Vlasenko
<vda.linux at googlemail.com> wrote:

> Reviewed.

Patch reworked, one comment below:

> +               printf("\n%d bytes from %s to "
> +                      "%s: icmp type %d (%s) code %d\n",
> +                       cc,
> +                       inet_ntop(AF_INET6, &from_lsa->u.sin6.sin6_addr, pa1, sizeof(pa1)),
> +                       inet_ntop(AF_INET6, to, pa2, sizeof(pa2)),
> +                       type, pr_type(type, AF_INET6), icp->icmp6_code);
> +
> +               cc -= sizeof(struct icmp6_hdr);
> +               for (i = 0; i < cc ; i++) {
> +                       if (i % 16 == 0)
> +                               printf("%04x:", i);
> +                       if (i % 4 == 0)
> +                               printf(" ");
> +                       printf("%02x", 0xff & (unsigned)p[i]);
> +                       if (i % 16 == 15 && i + 1 < cc)
> +                               printf("\n");
> +               }

> Maybe bin2hex() can be used here?

Original author wants output formatted as:
0000: 00010203 04050607 08090a0b 0c0d0e0f

bin2hex() saves code only in case of no spaces between every four bytes.


Regards,
   Leonid
-------------- next part --------------
A non-text attachment was scrubbed...
Name: traceroute6.patch
Type: text/x-patch
Size: 24616 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20091122/dab7e452/attachment-0001.bin>


More information about the busybox mailing list