Here's an alternative path towards putting rtisvalid(9) checks in the
tree. The end goal is to stop using !RTF_UP routes, so simply bail if
such route is passed to ARP or NDP instead of trying to fetch a
compatible one.
I hope this will help me find some bugs, I'd appreciate tests and oks.
Index: net/route.c
===================================================================
RCS file: /cvs/src/sys/net/route.c,v
retrieving revision 1.242
diff -u -p -r1.242 route.c
--- net/route.c 23 Sep 2015 08:49:46 -0000 1.242
+++ net/route.c 23 Sep 2015 09:16:58 -0000
@@ -1099,14 +1099,8 @@ rt_checkgate(struct ifnet *ifp, struct r
KASSERT(rt != NULL);
- if ((rt->rt_flags & RTF_UP) == 0) {
- rt = rtalloc(dst, RT_REPORT|RT_RESOLVE, rtableid);
- if (rt == NULL)
- return (EHOSTUNREACH);
- rt->rt_refcnt--;
- if (rt->rt_ifp != ifp)
- return (EHOSTUNREACH);
- }
+ if ((rt->rt_flags & RTF_UP) == 0)
+ return (EHOSTUNREACH);
rt0 = rt;