OK bluhm@

On Sat, Oct 24, 2015 at 03:25:46PM +0200, Martin Pieuchot wrote:
> Index: netinet6/in6_ifattach.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet6/in6_ifattach.c,v
> retrieving revision 1.97
> diff -u -p -r1.97 in6_ifattach.c
> --- netinet6/in6_ifattach.c   22 Oct 2015 15:37:47 -0000      1.97
> +++ netinet6/in6_ifattach.c   24 Oct 2015 12:56:50 -0000
> @@ -546,7 +546,7 @@ in6_ifdetach(struct ifnet *ifp)
>       sin6.sin6_addr = in6addr_intfacelocal_allnodes;
>       sin6.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
>       rt = rtalloc(sin6tosa(&sin6), 0, ifp->if_rdomain);
> -     if (rt && rt->rt_ifp == ifp) {
> +     if (rt && rt->rt_ifidx == ifp->if_index) {
>               rtdeletemsg(rt, ifp->if_rdomain);
>               rtfree(rt);
>       }
> @@ -558,7 +558,7 @@ in6_ifdetach(struct ifnet *ifp)
>       sin6.sin6_addr = in6addr_linklocal_allnodes;
>       sin6.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
>       rt = rtalloc(sin6tosa(&sin6), 0, ifp->if_rdomain);
> -     if (rt && rt->rt_ifp == ifp) {
> +     if (rt && rt->rt_ifidx == ifp->if_index) {
>               rtdeletemsg(rt, ifp->if_rdomain);
>               rtfree(rt);
>       }
> Index: netinet6/in6_src.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet6/in6_src.c,v
> retrieving revision 1.66
> diff -u -p -r1.66 in6_src.c
> --- netinet6/in6_src.c        24 Oct 2015 12:33:16 -0000      1.66
> +++ netinet6/in6_src.c        24 Oct 2015 13:00:19 -0000
> @@ -233,8 +233,12 @@ in6_selectsrc(struct in6_addr **in6src, 
>                       rt = nd6_lookup(&sin6_next->sin6_addr, 1, NULL,
>                           rtableid);
>                       if (rt != NULL) {
> -                             ia6 = in6_ifawithscope(rt->rt_ifp, dst,
> -                                 rtableid);
> +                             ifp = if_get(rt->rt_ifidx);
> +                             if (ifp != NULL) {
> +                                     ia6 = in6_ifawithscope(ifp, dst,
> +                                         rtableid);
> +                                     if_put(ifp);
> +                             }
>                               if (ia6 == NULL)
>                                       ia6 = ifatoia6(rt->rt_ifa);
>                               rtfree(rt);
> @@ -285,8 +289,11 @@ in6_selectsrc(struct in6_addr **in6src, 
>                */
>  
>               if (ro->ro_rt) {
> -                     ia6 = in6_ifawithscope(ro->ro_rt->rt_ifp, dst,
> -                         rtableid);
> +                     ifp = if_get(ro->ro_rt->rt_ifidx);
> +                     if (ifp != NULL) {
> +                             ia6 = in6_ifawithscope(ifp, dst, rtableid);
> +                             if_put(ifp);
> +                     }
>                       if (ia6 == NULL) /* xxx scope error ?*/
>                               ia6 = ifatoia6(ro->ro_rt->rt_ifa);
>               }

Reply via email to