forked from Minki/linux
ipv6: Refactor ip6_route_del for cached routes
Move the removal of cached routes to a helper, ip6_del_cached_rt, that can be invoked per nexthop. Rename the existig ip6_del_cached_rt to __ip6_del_cached_rt since it is called by ip6_del_cached_rt. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1cf844c747
commit
0fa6efc547
@ -3430,7 +3430,7 @@ out_put:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ip6_del_cached_rt(struct rt6_info *rt, struct fib6_config *cfg)
|
static int __ip6_del_cached_rt(struct rt6_info *rt, struct fib6_config *cfg)
|
||||||
{
|
{
|
||||||
int rc = -ESRCH;
|
int rc = -ESRCH;
|
||||||
|
|
||||||
@ -3446,10 +3446,25 @@ out:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ip6_del_cached_rt(struct fib6_config *cfg, struct fib6_info *rt,
|
||||||
|
struct fib6_nh *nh)
|
||||||
|
{
|
||||||
|
struct fib6_result res = {
|
||||||
|
.f6i = rt,
|
||||||
|
.nh = nh,
|
||||||
|
};
|
||||||
|
struct rt6_info *rt_cache;
|
||||||
|
|
||||||
|
rt_cache = rt6_find_cached_rt(&res, &cfg->fc_dst, &cfg->fc_src);
|
||||||
|
if (rt_cache)
|
||||||
|
return __ip6_del_cached_rt(rt_cache, cfg);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int ip6_route_del(struct fib6_config *cfg,
|
static int ip6_route_del(struct fib6_config *cfg,
|
||||||
struct netlink_ext_ack *extack)
|
struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct rt6_info *rt_cache;
|
|
||||||
struct fib6_table *table;
|
struct fib6_table *table;
|
||||||
struct fib6_info *rt;
|
struct fib6_info *rt;
|
||||||
struct fib6_node *fn;
|
struct fib6_node *fn;
|
||||||
@ -3474,21 +3489,12 @@ static int ip6_route_del(struct fib6_config *cfg,
|
|||||||
|
|
||||||
nh = rt->fib6_nh;
|
nh = rt->fib6_nh;
|
||||||
if (cfg->fc_flags & RTF_CACHE) {
|
if (cfg->fc_flags & RTF_CACHE) {
|
||||||
struct fib6_result res = {
|
|
||||||
.f6i = rt,
|
|
||||||
.nh = nh,
|
|
||||||
};
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rt_cache = rt6_find_cached_rt(&res,
|
rc = ip6_del_cached_rt(cfg, rt, nh);
|
||||||
&cfg->fc_dst,
|
if (rc != -ESRCH) {
|
||||||
&cfg->fc_src);
|
rcu_read_unlock();
|
||||||
if (rt_cache) {
|
return rc;
|
||||||
rc = ip6_del_cached_rt(rt_cache, cfg);
|
|
||||||
if (rc != -ESRCH) {
|
|
||||||
rcu_read_unlock();
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user