On Tue, Jun 14, 2016 at 12:02:34PM +0200, Martin Pieuchot wrote:
> --- netinet/in_pcb.c  19 Apr 2016 22:16:25 -0000      1.206
> +++ netinet/in_pcb.c  14 Jun 2016 09:57:25 -0000
> @@ -924,8 +924,10 @@ in_selectsrc(struct in_addr **insrc, str
>        * If we found a route, use the address
>        * corresponding to the outgoing interface.
>        */
> -     if (ro->ro_rt != NULL)
> -             ia = ifatoia(ro->ro_rt->rt_ifa);
> +     if (ro->ro_rt != NULL) {
> +             *insrc = &satosin(ro->ro_rt->rt_addr)->sin_addr;
> +             return (0);
> +     }
>  
>       if (ia == NULL)
>               return (EADDRNOTAVAIL);

A ia is never set, the code below this line is dead.  Perhaps change
the logic to
        if (ro->ro_rt == NULL)
                return (EADDRNOTAVAIL);

anyway OK bluhm@

> Index: netinet6/in6_src.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet6/in6_src.c,v
> retrieving revision 1.72
> diff -u -p -r1.72 in6_src.c
> --- netinet6/in6_src.c        5 Dec 2015 13:21:00 -0000       1.72
> +++ netinet6/in6_src.c        14 Jun 2016 09:57:26 -0000
> @@ -257,8 +257,11 @@ in6_selectsrc(struct in6_addr **in6src, 
>                               ia6 = in6_ifawithscope(ifp, dst, rtableid);
>                               if_put(ifp);
>                       }
> -                     if (ia6 == NULL) /* xxx scope error ?*/
> -                             ia6 = ifatoia6(ro->ro_rt->rt_ifa);
> +                     if (ia6 == NULL) { /* xxx scope error ?*/
> +                             *in6src =
> +                                 &satosin6(ro->ro_rt->rt_addr)->sin6_addr;
> +                             return (0);
> +                     }
>               }
>               if (ia6 == NULL)
>                       return (EHOSTUNREACH);  /* no route */

Reply via email to