After rtalloc(), here's a simpler inliner diff to only use rtalloc1()
when dealing with route lookups.
ok?
Index: net/pf.c
===================================================================
RCS file: /home/ncvs/src/sys/net/pf.c,v
retrieving revision 1.887
diff -u -p -r1.887 pf.c
--- net/pf.c 27 Sep 2014 12:26:16 -0000 1.887
+++ net/pf.c 30 Sep 2014 08:48:00 -0000
@@ -2968,7 +2968,8 @@ pf_calc_mss(struct pf_addr *addr, sa_fam
dst->sin_len = sizeof(*dst);
dst->sin_addr = addr->v4;
ro.ro_tableid = rtableid;
- rtalloc_noclone(&ro);
+ ro.ro_rt = rtalloc1(&ro.ro_dst, RT_REPORT | RT_NOCLONING,
+ ro.ro_tableid);
rt = ro.ro_rt;
break;
#endif /* INET */
@@ -2981,7 +2982,8 @@ pf_calc_mss(struct pf_addr *addr, sa_fam
dst6->sin6_len = sizeof(*dst6);
dst6->sin6_addr = addr->v6;
ro6.ro_tableid = rtableid;
- rtalloc_noclone((struct route *)&ro6);
+ ro6.ro_rt = rtalloc1(sin6tosa(&ro6.ro_dst),
+ RT_REPORT | RT_NOCLONING, ro6.ro_tableid);
rt = ro6.ro_rt;
break;
#endif /* INET6 */
@@ -5435,7 +5437,8 @@ pf_routable(struct pf_addr *addr, sa_fam
if (kif != NULL && kif->pfik_ifp->if_type == IFT_ENC)
goto out;
- rtalloc_noclone((struct route *)&ro);
+ ro.ro_rt = rtalloc1((struct sockaddr *)&ro.ro_dst,
+ RT_REPORT | RT_NOCLONING, ro.ro_tableid);
if (ro.ro_rt != NULL) {
/* No interface given, this is a no-route check */
@@ -5502,7 +5505,8 @@ pf_rtlabel_match(struct pf_addr *addr, s
#endif /* INET6 */
}
- rtalloc_noclone((struct route *)&ro);
+ ro.ro_rt = rtalloc1((struct sockaddr *)&ro.ro_dst,
+ RT_REPORT | RT_NOCLONING, ro.ro_tableid);
if (ro.ro_rt != NULL) {
if (ro.ro_rt->rt_labelid == aw->v.rtlabel)
Index: net/route.c
===================================================================
RCS file: /home/ncvs/src/sys/net/route.c,v
retrieving revision 1.183
diff -u -p -r1.183 route.c
--- net/route.c 27 Sep 2014 12:26:16 -0000 1.183
+++ net/route.c 30 Sep 2014 08:48:00 -0000
@@ -310,18 +310,6 @@ rtable_exists(u_int id) /* verify table
return (1);
}
-/*
- * Packet routing routines.
- */
-void
-rtalloc_noclone(struct route *ro)
-{
- if (ro->ro_rt && ro->ro_rt->rt_ifp && (ro->ro_rt->rt_flags & RTF_UP))
- return; /* cached route is still valid */
- ro->ro_rt = rtalloc1(&ro->ro_dst, RT_REPORT | RT_NOCLONING,
- ro->ro_tableid);
-}
-
struct rtentry *
rtalloc1(struct sockaddr *dst, int flags, u_int tableid)
{
Index: net/route.h
===================================================================
RCS file: /home/ncvs/src/sys/net/route.h,v
retrieving revision 1.97
diff -u -p -r1.97 route.h
--- net/route.h 27 Sep 2014 12:26:16 -0000 1.97
+++ net/route.h 30 Sep 2014 08:48:00 -0000
@@ -380,7 +380,6 @@ void rt_timer_queue_destroy(struct
rt
unsigned long rt_timer_queue_count(struct rttimer_queue *);
void rt_timer_timer(void *);
-void rtalloc_noclone(struct route *);
#ifdef SMALL_KERNEL
#define rtalloc_mpath(dst, s, rtableid) rtalloc1((dst), RT_REPORT,
(rtableid))
#endif