From 4a6ee281d9b3cf45f2894b11bcdf2a27f508cdf7 Mon Sep 17 00:00:00 2001 From: "Alexander V. Chernikov" Date: Mon, 11 May 2020 06:09:18 +0000 Subject: [PATCH] Remove unused rnh_close callback from rtable & cleanup depends. rnh_close callbackes was used by the in[6]_clsroute() handlers, doing cleanup in the route cloning code. Route cloning was eliminated somewhere around r186119. Last callback user was eliminated in r186215, 11 years ago. Differential Revision: https://reviews.freebsd.org/D24793 --- sys/net/route.c | 16 ---------------- sys/net/route/route_var.h | 2 -- 2 files changed, 18 deletions(-) diff --git a/sys/net/route.c b/sys/net/route.c index cbac28f98e0f..1b966b691bd5 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -426,11 +426,8 @@ sys_setfib(struct thread *td, struct setfib_args *uap) void rtfree(struct rtentry *rt) { - struct rib_head *rnh; KASSERT(rt != NULL,("%s: NULL rt", __func__)); - rnh = rt_tables_get_rnh(rt->rt_fibnum, rt_key(rt)->sa_family); - KASSERT(rnh != NULL,("%s: NULL rnh", __func__)); RT_LOCK_ASSERT(rt); @@ -444,18 +441,6 @@ rtfree(struct rtentry *rt) goto done; } - /* - * On last reference give the "close method" a chance - * to cleanup private state. This also permits (for - * IPv4 and IPv6) a chance to decide if the routing table - * entry should be purged immediately or at a later time. - * When an immediate purge is to happen the close routine - * typically calls rtexpunge which clears the RTF_UP flag - * on the entry so that the code below reclaims the storage. - */ - if (rt->rt_refcnt == 0 && rnh->rnh_close) - rnh->rnh_close((struct radix_node *)rt, &rnh->head); - /* * If we are no longer "up" (and ref == 0) * then we can free the resources associated @@ -1501,7 +1486,6 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *info, return (ENOBUFS); } rt->rt_flags = RTF_UP | flags; - rt->rt_fibnum = rnh->rib_fibnum; rt->rt_nhop = nh; /* Fill in dst */ diff --git a/sys/net/route/route_var.h b/sys/net/route/route_var.h index 02bf15204fe6..3dfe7f152954 100644 --- a/sys/net/route/route_var.h +++ b/sys/net/route/route_var.h @@ -50,7 +50,6 @@ struct rib_head { rn_lookup_f_t *rnh_lookup; /* exact match for sockaddr */ rn_walktree_t *rnh_walktree; /* traverse tree */ rn_walktree_from_t *rnh_walktree_from; /* traverse tree below a */ - rn_close_t *rnh_close; /*do something when the last ref drops*/ rnh_preadd_entry_f_t *rnh_preadd; /* hook to alter record prior to insertion */ rt_gen_t rnh_gen; /* generation counter */ int rnh_multipath; /* multipath capable ? */ @@ -144,7 +143,6 @@ struct rtentry { int rt_flags; /* up/down?, host/net */ int rt_refcnt; /* # held references */ - u_int rt_fibnum; /* which FIB */ u_long rt_weight; /* absolute weight */ u_long rt_expire; /* lifetime for route, e.g. redirect */ #define rt_endzero rt_mtx