summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2015-11-30 05:51:14 +0000
committermelifaro <melifaro@FreeBSD.org>2015-11-30 05:51:14 +0000
commite1984564835422629dc73f3551f3be70602c551a (patch)
tree0be60b29fa72a36767c89b7639430ba4896bcf2a /sys/netinet6
parent48efdd4beccfc6adef1e3c7e8cb51a875a76a814 (diff)
downloadFreeBSD-src-e1984564835422629dc73f3551f3be70602c551a.zip
FreeBSD-src-e1984564835422629dc73f3551f3be70602c551a.tar.gz
Add new rt_foreach_fib_walk_del() function for deleting route entries
by filter function instead of picking into routing table details in each consumer. Remove now-unused rt_expunge() (eliminating last external RTF_RNH_LOCKED user). This simplifies future nexthops/mulitipath changes and rtrequest1_fib() locking refactoring. Actual changes: Add "rt_chain" field to permit rte grouping while doing batched delete from routing table (thus growing rte 200->208 on amd64). Add "rti_filter" / "rti_filterdata" / "rti_spare" fields to rt_addrinfo to pass filter function to various routing subsystems in standard way. Convert all rt_expunge() customers to new rt_addinfo-based api and eliminate rt_expunge().
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/nd6.c31
-rw-r--r--sys/netinet6/nd6_rtr.c9
2 files changed, 19 insertions, 21 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 8ead873..a925470 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1307,6 +1307,15 @@ nd6_free(struct llentry *ln, int gc)
llentry_free(ln);
}
+static int
+nd6_isdynrte(const struct rtentry *rt, void *xap)
+{
+
+ if (rt->rt_flags == (RTF_UP | RTF_HOST | RTF_DYNAMIC))
+ return (1);
+
+ return (0);
+}
/*
* Remove the rtentry for the given llentry,
* both of which were installed by a redirect.
@@ -1315,26 +1324,16 @@ static void
nd6_free_redirect(const struct llentry *ln)
{
int fibnum;
- struct rtentry *rt;
- struct radix_node_head *rnh;
struct sockaddr_in6 sin6;
+ struct rt_addrinfo info;
lltable_fill_sa_entry(ln, (struct sockaddr *)&sin6);
- for (fibnum = 0; fibnum < rt_numfibs; fibnum++) {
- rnh = rt_tables_get_rnh(fibnum, AF_INET6);
- if (rnh == NULL)
- continue;
+ memset(&info, 0, sizeof(info));
+ info.rti_info[RTAX_DST] = (struct sockaddr *)&sin6;
+ info.rti_filter = nd6_isdynrte;
- RADIX_NODE_HEAD_LOCK(rnh);
- rt = in6_rtalloc1((struct sockaddr *)&sin6, 0,
- RTF_RNH_LOCKED, fibnum);
- if (rt) {
- if (rt->rt_flags == (RTF_UP | RTF_HOST | RTF_DYNAMIC))
- rt_expunge(rnh, rt);
- RTFREE_LOCKED(rt);
- }
- RADIX_NODE_HEAD_UNLOCK(rnh);
- }
+ for (fibnum = 0; fibnum < rt_numfibs; fibnum++)
+ rtrequest1_fib(RTM_DELETE, &info, NULL, fibnum);
}
/*
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index cbcca46..b57cf15 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -88,7 +88,7 @@ static void in6_init_address_ltimes(struct nd_prefix *,
static int nd6_prefix_onlink(struct nd_prefix *);
static int nd6_prefix_offlink(struct nd_prefix *);
-static int rt6_deleteroute(struct rtentry *, void *);
+static int rt6_deleteroute(const struct rtentry *, void *);
VNET_DECLARE(int, nd6_recalc_reachtm_interval);
#define V_nd6_recalc_reachtm_interval VNET(nd6_recalc_reachtm_interval)
@@ -2073,11 +2073,11 @@ rt6_flush(struct in6_addr *gateway, struct ifnet *ifp)
return;
/* XXX Do we really need to walk any but the default FIB? */
- rt_foreach_fib_walk(AF_INET6, NULL, rt6_deleteroute, (void *)gateway);
+ rt_foreach_fib_walk_del(AF_INET6, rt6_deleteroute, (void *)gateway);
}
static int
-rt6_deleteroute(struct rtentry *rt, void *arg)
+rt6_deleteroute(const struct rtentry *rt, void *arg)
{
#define SIN6(s) ((struct sockaddr_in6 *)s)
struct in6_addr *gate = (struct in6_addr *)arg;
@@ -2104,8 +2104,7 @@ rt6_deleteroute(struct rtentry *rt, void *arg)
if ((rt->rt_flags & RTF_HOST) == 0)
return (0);
- return (in6_rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway,
- rt_mask(rt), rt->rt_flags | RTF_RNH_LOCKED, NULL, rt->rt_fibnum));
+ return (1);
#undef SIN6
}
OpenPOWER on IntegriCloud