aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@mellanox.com>2018-01-07 05:45:13 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-07 21:29:40 -0500
commit4a8e56ee2c8551e674f69ba007aabede8f0b88d9 (patch)
treef7d264af413a331d014cfb31ff306e2d0bdc0f2b
parentb5cb5a755bd43047a9bd18d950fdb22fc828947a (diff)
ipv6: Export sernum update function
We are going to allow dead routes to stay in the FIB tree (e.g., when they are part of a multipath route, directly connected route with no carrier) and revive them when their nexthop device gains carrier or when it is put administratively up. This is equivalent to the addition of the route to the FIB tree and we should therefore take care of updating the sernum of all the parent nodes of the node where the route is stored. Otherwise, we risk sockets caching and using sub-optimal dst entries. Export the function that performs the above, so that it could be invoked from fib6_ifup() later on. Signed-off-by: Ido Schimmel <idosch@mellanox.com> Acked-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/ip6_fib.h1
-rw-r--r--net/ipv6/ip6_fib.c11
2 files changed, 9 insertions, 3 deletions
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index affea1aa6ae4..ddf53dd1e948 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -405,6 +405,7 @@ unsigned int fib6_tables_seq_read(struct net *net);
405int fib6_tables_dump(struct net *net, struct notifier_block *nb); 405int fib6_tables_dump(struct net *net, struct notifier_block *nb);
406 406
407void fib6_update_sernum(struct rt6_info *rt); 407void fib6_update_sernum(struct rt6_info *rt);
408void fib6_update_sernum_upto_root(struct net *net, struct rt6_info *rt);
408 409
409#ifdef CONFIG_IPV6_MULTIPLE_TABLES 410#ifdef CONFIG_IPV6_MULTIPLE_TABLES
410int fib6_rules_init(void); 411int fib6_rules_init(void);
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 5e4b5eef0ddd..c1bbe7bf9fdd 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1102,8 +1102,8 @@ void fib6_force_start_gc(struct net *net)
1102 jiffies + net->ipv6.sysctl.ip6_rt_gc_interval); 1102 jiffies + net->ipv6.sysctl.ip6_rt_gc_interval);
1103} 1103}
1104 1104
1105static void fib6_update_sernum_upto_root(struct rt6_info *rt, 1105static void __fib6_update_sernum_upto_root(struct rt6_info *rt,
1106 int sernum) 1106 int sernum)
1107{ 1107{
1108 struct fib6_node *fn = rcu_dereference_protected(rt->rt6i_node, 1108 struct fib6_node *fn = rcu_dereference_protected(rt->rt6i_node,
1109 lockdep_is_held(&rt->rt6i_table->tb6_lock)); 1109 lockdep_is_held(&rt->rt6i_table->tb6_lock));
@@ -1117,6 +1117,11 @@ static void fib6_update_sernum_upto_root(struct rt6_info *rt,
1117 } 1117 }
1118} 1118}
1119 1119
1120void fib6_update_sernum_upto_root(struct net *net, struct rt6_info *rt)
1121{
1122 __fib6_update_sernum_upto_root(rt, fib6_new_sernum(net));
1123}
1124
1120/* 1125/*
1121 * Add routing information to the routing tree. 1126 * Add routing information to the routing tree.
1122 * <destination addr>/<source addr> 1127 * <destination addr>/<source addr>
@@ -1230,7 +1235,7 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt,
1230 1235
1231 err = fib6_add_rt2node(fn, rt, info, mxc, extack); 1236 err = fib6_add_rt2node(fn, rt, info, mxc, extack);
1232 if (!err) { 1237 if (!err) {
1233 fib6_update_sernum_upto_root(rt, sernum); 1238 __fib6_update_sernum_upto_root(rt, sernum);
1234 fib6_start_gc(info->nl_net, rt); 1239 fib6_start_gc(info->nl_net, rt);
1235 } 1240 }
1236 1241