aboutsummaryrefslogtreecommitdiff
path: root/sys/net/route
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2020-11-29 13:54:49 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2020-11-29 13:54:49 +0000
commit3b1654cb14c2406b3f8d6023f9002a8bf3dd94c3 (patch)
treece3e61539bed8097ed0ed76227a05b1fd1f25344 /sys/net/route
parentf47fa260651411fc5f386bc7b66106808d6ebfa2 (diff)
Notes
Diffstat (limited to 'sys/net/route')
-rw-r--r--sys/net/route/route_ctl.h12
-rw-r--r--sys/net/route/route_helpers.c16
2 files changed, 18 insertions, 10 deletions
diff --git a/sys/net/route/route_ctl.h b/sys/net/route/route_ctl.h
index cd22b27d72e30..be3374f041fde 100644
--- a/sys/net/route/route_ctl.h
+++ b/sys/net/route/route_ctl.h
@@ -67,17 +67,19 @@ enum rib_walk_hook {
};
typedef int rib_walktree_f_t(struct rtentry *, void *);
typedef void rib_walk_hook_f_t(struct rib_head *rnh, enum rib_walk_hook stage,
- void *arg);
+ void *arg);
void rib_walk(uint32_t fibnum, int af, bool wlock, rib_walktree_f_t *wa_f,
- void *arg);
+ void *arg);
void rib_walk_ext(uint32_t fibnum, int af, bool wlock, rib_walktree_f_t *wa_f,
- rib_walk_hook_f_t *hook_f, void *arg);
+ rib_walk_hook_f_t *hook_f, void *arg);
+void rib_walk_ext_internal(struct rib_head *rnh, bool wlock,
+ rib_walktree_f_t *wa_f, rib_walk_hook_f_t *hook_f, void *arg);
void rib_walk_del(u_int fibnum, int family, rib_filter_f_t *filter_f,
- void *arg, bool report);
+ void *arg, bool report);
void rib_foreach_table_walk(int family, bool wlock, rib_walktree_f_t *wa_f,
- rib_walk_hook_f_t *hook_f, void *arg);
+ rib_walk_hook_f_t *hook_f, void *arg);
void rib_foreach_table_walk_del(int family, rib_filter_f_t *filter_f, void *arg);
struct route_nhop_data;
diff --git a/sys/net/route/route_helpers.c b/sys/net/route/route_helpers.c
index 62aa3087fff59..88733fff419b0 100644
--- a/sys/net/route/route_helpers.c
+++ b/sys/net/route/route_helpers.c
@@ -77,14 +77,10 @@ __FBSDID("$FreeBSD$");
* Table is traversed under read lock unless @wlock is set.
*/
void
-rib_walk_ext(uint32_t fibnum, int family, bool wlock, rib_walktree_f_t *wa_f,
+rib_walk_ext_internal(struct rib_head *rnh, bool wlock, rib_walktree_f_t *wa_f,
rib_walk_hook_f_t *hook_f, void *arg)
{
RIB_RLOCK_TRACKER;
- struct rib_head *rnh;
-
- if ((rnh = rt_tables_get_rnh(fibnum, family)) == NULL)
- return;
if (wlock)
RIB_WLOCK(rnh);
@@ -101,6 +97,16 @@ rib_walk_ext(uint32_t fibnum, int family, bool wlock, rib_walktree_f_t *wa_f,
RIB_RUNLOCK(rnh);
}
+void
+rib_walk_ext(uint32_t fibnum, int family, bool wlock, rib_walktree_f_t *wa_f,
+ rib_walk_hook_f_t *hook_f, void *arg)
+{
+ struct rib_head *rnh;
+
+ if ((rnh = rt_tables_get_rnh(fibnum, family)) != NULL)
+ rib_walk_ext_internal(rnh, wlock, wa_f, hook_f, arg);
+}
+
/*
* Calls @wa_f with @arg for each entry in the table specified by
* @af and @fibnum.