Two more cases, ok?
Index: netinet6/in6_src.c
===================================================================
RCS file: /cvs/src/sys/netinet6/in6_src.c,v
retrieving revision 1.64
diff -u -p -r1.64 in6_src.c
--- netinet6/in6_src.c 19 Oct 2015 12:11:28 -0000 1.64
+++ netinet6/in6_src.c 22 Oct 2015 14:25:26 -0000
@@ -285,7 +285,7 @@ in6_selectsrc(struct in6_addr **in6src,
*/
if (ro->ro_rt) {
- ia6 = in6_ifawithscope(ro->ro_rt->rt_ifa->ifa_ifp, dst,
+ ia6 = in6_ifawithscope(ro->ro_rt->rt_ifp, dst,
rtableid);
if (ia6 == NULL) /* xxx scope error ?*/
ia6 = ifatoia6(ro->ro_rt->rt_ifa);
@@ -456,15 +456,8 @@ in6_selectif(struct sockaddr_in6 *dstsoc
if (rt && (rt->rt_flags & (RTF_REJECT | RTF_BLACKHOLE)))
return (rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH);
- /*
- * Adjust the "outgoing" interface. If we're going to loop the packet
- * back to ourselves, the ifp would be the loopback interface.
- * However, we'd rather know the interface associated to the
- * destination address (which should probably be one of our own
- * addresses.)
- */
- if (rt && rt->rt_ifa && rt->rt_ifa->ifa_ifp)
- *retifp = if_ref(rt->rt_ifa->ifa_ifp);
+ if (rt != NULL)
+ *retifp = if_ref(rt->rt_ifp);
return (0);
}