From 80ae8d609a68f95dc83f2f7b1dfabf03e8852676 Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Mon, 6 Jun 2016 12:49:47 +0000 Subject: [PATCH] Provide a public interface to rt_flushifroutes which takes the address family as an argument as well. This will be used to cleanup individual protocols during VNET teardown. Obtained from: projects/vnet Sponsored by: The FreeBSD Foundation --- sys/net/route.c | 9 +++++++++ sys/net/route.h | 1 + 2 files changed, 10 insertions(+) diff --git a/sys/net/route.c b/sys/net/route.c index 26e3b851c15a..f2f889793b9d 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1140,6 +1140,15 @@ rt_ifdelroute(const struct rtentry *rt, void *arg) * the entire routing table looking for routes which point * to this interface...oh well... */ +void +rt_flushifroutes_af(struct ifnet *ifp, int af) +{ + KASSERT((af >= 1 && af <= AF_MAX), ("%s: af %d not >= 1 and <= %d", + __func__, af, AF_MAX)); + + rt_foreach_fib_walk_del(af, rt_ifdelroute, ifp); +} + void rt_flushifroutes(struct ifnet *ifp) { diff --git a/sys/net/route.h b/sys/net/route.h index 46e2ace15f90..b6aa36dd4816 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -468,6 +468,7 @@ typedef int rt_walktree_f_t(struct rtentry *, void *); typedef void rt_setwarg_t(struct rib_head *, uint32_t, int, void *); void rt_foreach_fib_walk(int af, rt_setwarg_t *, rt_walktree_f_t *, void *); void rt_foreach_fib_walk_del(int af, rt_filter_f_t *filter_f, void *arg); +void rt_flushifroutes_af(struct ifnet *, int); void rt_flushifroutes(struct ifnet *ifp); /* XXX MRT COMPAT VERSIONS THAT SET UNIVERSE to 0 */