NetBSD-Bugs archive

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

bin/47304: traceroute6: can't work -s (source IPv6 address to be used) option



>Number:         47304
>Category:       bin
>Synopsis:       traceroute6: can't work -s (source IPv6 address to be used) 
>option
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 10 11:25:00 +0000 2012
>Originator:     Kouki Ooyatsu
>Release:        NetBSD-current
>Organization:
Personal
>Environment:
>Description:
traceroute6:

can't bind as the source address, even if you specify the correct source IPv6 
address.

>How-To-Repeat:
$ traceroute -s <valid source address> 2001:db8::1
traceroute6: bind: Can't assign requested address

>Fix:
variable 'res' is stored in the destination address.
valid variable is 'res0'.

cvs diff: Diffing .
Index: traceroute6.c
===================================================================
RCS file: /cvsroot/NetBSD/src/usr.sbin/traceroute6/traceroute6.c,v
retrieving revision 1.42
diff -u -p -r1.42 traceroute6.c
--- traceroute6.c       4 Jan 2012 16:09:44 -0000     1.42
+++ traceroute6.c       10 Dec 2012 11:21:31 -0000
@@ -724,10 +724,10 @@ main(int argc, char *argv[])
            if (error0)
              errx(1, "Cannot get address for `%s' (%s)", source,
                  gai_strerror(error0));
-           if (res->ai_addrlen > sizeof(Src))
+           if (res0->ai_addrlen > sizeof(Src))
              errx(1, "Bad incompatible address length");
-           memcpy(&Src, res->ai_addr, res->ai_addrlen);
-           freeaddrinfo(res);
+           memcpy(&Src, res0->ai_addr, res0->ai_addrlen);
+           freeaddrinfo(res0);
        } else {
            struct sockaddr_in6 Nxt;
            int dummy;



Home | Main Index | Thread Index | Old Index