When I added p2p_rtrequest() the RTF_LOCAL flag was not yet available, so I used RTF_LLINFO to say that a route should be used for local trafic.
The diff below removes this hack and correctly check for RTF_LOCAL in all the custom *_rtrequest() functions able to change the ifp of a route. ok? Index: net/if.c =================================================================== RCS file: /home/ncvs/src/sys/net/if.c,v retrieving revision 1.297 diff -u -p -r1.297 if.c --- net/if.c 12 Jul 2014 18:44:22 -0000 1.297 +++ net/if.c 22 Jul 2014 11:15:01 -0000 @@ -1001,12 +1001,7 @@ p2p_rtrequest(int req, struct rtentry *r switch (req) { case RTM_ADD: - /* - * XXX Here we abuse RTF_LLINFO to add a route to - * loopback. We do that to always have a route - * pointing to our address. - */ - if ((rt->rt_flags & RTF_LLINFO) == 0) + if ((rt->rt_flags & RTF_LOCAL) == 0) break; TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { Index: netinet/if_ether.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/if_ether.c,v retrieving revision 1.131 diff -u -p -r1.131 if_ether.c --- netinet/if_ether.c 12 Jul 2014 18:44:23 -0000 1.131 +++ netinet/if_ether.c 22 Jul 2014 11:15:01 -0000 @@ -175,7 +175,7 @@ arp_rtrequest(int req, struct rtentry *r satosin(rt_mask(rt))->sin_addr.s_addr != 0xffffffff) rt->rt_flags |= RTF_CLONING; if (rt->rt_flags & RTF_CLONING || - ((rt->rt_flags & RTF_LLINFO) && !la)) { + ((rt->rt_flags & (RTF_LLINFO | RTF_LOCAL)) && !la)) { /* * Case 1: This route should come from a route to iface. */ Index: netinet6/nd6.c =================================================================== RCS file: /home/ncvs/src/sys/netinet6/nd6.c,v retrieving revision 1.120 diff -u -p -r1.120 nd6.c --- netinet6/nd6.c 12 Jul 2014 18:44:23 -0000 1.120 +++ netinet6/nd6.c 22 Jul 2014 11:15:01 -0000 @@ -1010,7 +1010,7 @@ nd6_rtrequest(int req, struct rtentry *r * rt->rt_flags |= RTF_CLONING; */ if ((rt->rt_flags & RTF_CLONING) || - ((rt->rt_flags & RTF_LLINFO) && !ln)) { + ((rt->rt_flags & (RTF_LLINFO | RTF_LOCAL)) && !ln)) { /* * Case 1: This route should come from a route to * interface (RTF_CLONING case) or the route should be