[PATCH] Fix inconsistent packet size argument for IPv6

Denys Vlasenko vda.linux at googlemail.com
Wed Sep 28 16:49:07 UTC 2016


On Tue, Sep 27, 2016 at 12:57 PM, Francis Rounds
<Francis.Rounds at 4bridgeworks.com> wrote:
> When traceroute is used on an IPv4 address, the "BYTES" argument
> designates the size of the packet sent, so its minimum value is 46
> bytes (20 bytes for the IPv4 header, 8 bytes for the UDP or ICMP header
> and 18 bytes for the traceroute payload).
>
> When traceroute is used on an IPv6 address, however, the "BYTES"
> argument appears to designate the size of the _payload_, not the
> packet. The minimum value is reported as 24 bytes (sizeof(struct
> outdata6_t)), instead of 72 bytes (40 bytes for the IPv6 header, 8
> bytes for the UDP or ICMP header and 24 bytes for the traceroute
> payload).
>
> Before the fix:
>
>     $ traceroute 127.0.0.1 1
>     traceroute: number 1 is not in 46..32768 range
>     $ traceroute ::1 1
>     traceroute: number 1 is not in 24..32768 range
>
> After the fix:
>
>     $ traceroute 127.0.0.1 1
>     traceroute: number 1 is not in 46..32768 range
>     $ traceroute ::1 1
>     traceroute: number 1 is not in 72..32768 range
>
> Signed-off-by: Francis Rounds <francis.rounds at 4bridgeworks.com>
> ---
>  networking/traceroute.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/networking/traceroute.c b/networking/traceroute.c
> index e43a36d..2428eb1 100644
> --- a/networking/traceroute.c
> +++ b/networking/traceroute.c
> @@ -887,7 +887,10 @@ common_traceroute_main(int op, char **argv)
>         dest_lsa = xhost_and_af2sockaddr(argv[0], port, af);
>         af = dest_lsa->u.sa.sa_family;
>         if (af == AF_INET6)
> -               minpacket = sizeof(struct outdata6_t);
> +       {
> +               minpacket -= sizeof(*outdata) + sizeof(*outip);
> +               minpacket += sizeof(struct outdata6_t) + sizeof(struct ip6_hdr);
> +       }
>  #else
>         dest_lsa = xhost2sockaddr(argv[0], port);
>  #endif


Traceroute is much more broken than this... should be fixed in git.
Please try it now.


More information about the busybox mailing list